From 3d82ba06a7538c0e8dca88b2c758a91bc293663b Mon Sep 17 00:00:00 2001 From: Miroslav Koriatov Date: Wed, 2 Nov 2016 23:51:49 +0300 Subject: [PATCH 01/75] issue-51: Extend AVP dictionary, exposing original type --- .../api/validation/AvpRepresentation.java | 2 ++ .../impl/validation/AvpRepresentationImpl.java | 11 ++++++++++- .../common/impl/validation/DictionaryImpl.java | 14 +++++++++----- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/validation/AvpRepresentation.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/validation/AvpRepresentation.java index b573ef021..dc67ef8da 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/validation/AvpRepresentation.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/validation/AvpRepresentation.java @@ -175,6 +175,8 @@ enum Type { int getRuleVendorBitAsInt(); + String getOriginalType(); + String getType(); boolean isProtected(); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/AvpRepresentationImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/AvpRepresentationImpl.java index 31515b501..435bdc840 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/AvpRepresentationImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/AvpRepresentationImpl.java @@ -68,6 +68,7 @@ public class AvpRepresentationImpl implements AvpRepresentation { protected String ruleMandatory; protected String ruleProtected; protected String ruleVendorBit; + protected String originalType; protected String type; // String, in case user defines his own type // Usually this will be -1, as only SessionId has fixed position @@ -100,6 +101,7 @@ public AvpRepresentationImpl(AvpRepresentationImpl clone) { this.ruleMandatory = clone.ruleMandatory; this.ruleProtected = clone.ruleProtected; this.ruleVendorBit = clone.ruleVendorBit; + this.originalType = clone.originalType; this.type = clone.type; if (this.multiplicityIndicator.equals(_MP_NOT_ALLOWED)) { this.allowed = false; @@ -176,7 +178,7 @@ public AvpRepresentationImpl(int code, long vendor, String name) { } public AvpRepresentationImpl(String name, String description, int code, boolean mayEncrypt, String ruleMandatory, String ruleProtected, - String ruleVendorBit, long vendorId, String type) { + String ruleVendorBit, long vendorId, String originalType, String type) { // zero and more, since its definition. this(-1, code, vendorId, _MP_ZERO_OR_MORE, name); @@ -198,6 +200,7 @@ public AvpRepresentationImpl(String name, String description, int code, boolean this.ruleVendorBit = _DEFAULT_VENDOR; } + this.originalType = originalType; this.type = type; this._mandatory = this.ruleMandatory.equals("must"); this._protected = this.ruleProtected.equals("must"); @@ -409,6 +412,11 @@ public int getRuleVendorBitAsInt() { return Rule.valueOf(ruleVendorBit).ordinal(); } + @Override + public String getOriginalType() { + return originalType; + } + @Override public String getType() { return type; @@ -531,6 +539,7 @@ public Object clone() throws CloneNotSupportedException { clone.ruleMandatory = this.ruleMandatory; clone.ruleProtected = this.ruleProtected; clone.ruleVendorBit = this.ruleVendorBit; + clone.originalType = this.originalType; clone.type = this.type; List cloneChildren = new ArrayList(); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java index 1dd02f414..a027c1810 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/validation/DictionaryImpl.java @@ -331,7 +331,8 @@ protected void parseAvps(Document doc) { // ... // OR // ... - String avpType = UNDEFINED_AVP_TYPE; + String avpOriginalType = UNDEFINED_AVP_TYPE; + String avpType = avpOriginalType; List groupedAvpChilds = new ArrayList(); NodeList avpDefnChildNodes = avpNode.getChildNodes(); @@ -342,7 +343,8 @@ protected void parseAvps(Document doc) { Element avpDefnChildElement = (Element) avpDefnChildNode; if (avpDefnChildElement.getNodeName().equals("grouped")) { - avpType = "Grouped"; + avpOriginalType = "Grouped"; + avpType = avpOriginalType; // Let's fetch the childs // Format: @@ -403,7 +405,8 @@ protected void parseAvps(Document doc) { } } else if (avpDefnChildElement.getNodeName().equals("type")) { - avpType = avpDefnChildElement.getAttribute("type-name"); + avpOriginalType = avpDefnChildElement.getAttribute("type-name"); + avpType = avpOriginalType; //FIXME: baranowb: why this is like that? This changes type of AVP to primitive ONE..? Checks against type dont make sense, ie to check for Address type... avpType = typedefMap.get(avpType); @@ -422,7 +425,7 @@ else if (avpDefnChildElement.getNodeName().equals("type")) { AvpRepresentationImpl avp = null; avp = new AvpRepresentationImpl(avpName, "N/A", Integer.valueOf(avpCode), avpMayEncrypt.equals("yes"), avpMandatory, - avpProtected, avpVendorBit, vendorCode, avpType); + avpProtected, avpVendorBit, vendorCode, avpOriginalType, avpType); if (avp.isGrouped()) { avp.setChildren(groupedAvpChilds); @@ -454,7 +457,8 @@ else if (avpDefnChildElement.getNodeName().equals("type")) { logger.debug(new StringBuffer("[ERROR] Failed Parsing AVP: Name[").append(avpName).append("] Description[").append("N/A"). append("] Code[").append(avpCode).append("] May-Encrypt[").append(avpMayEncrypt).append("] Mandatory[").append(avpMandatory). append("] Protected [").append(avpProtected).append("] Vendor-Bit [").append(avpVendorBit).append("] Vendor-Id [").append(avpVendorId). - append("] Constrained[").append("N/A").append("] Type [").append(avpType).append("]").toString(), e); + append("] Constrained[").append("N/A").append("] OriginalType [").append(avpOriginalType). + append("] Type [").append(avpType).append("]").toString(), e); } } } From 5054ee5245786772ff80604a8e217b7ed08842e8 Mon Sep 17 00:00:00 2001 From: Jean Deruelle Date: Mon, 9 Jan 2017 21:04:22 +0100 Subject: [PATCH 02/75] Commenting out examples to maake the build pass --- release/build.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/release/build.xml b/release/build.xml index 2cd1e0a3c..3c110890e 100644 --- a/release/build.xml +++ b/release/build.xml @@ -97,10 +97,15 @@ - + + + + + + From 8662f876a3ae66b9a5cb258fafba57b99d2422b1 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 20 Jan 2017 13:09:49 +0200 Subject: [PATCH 03/75] Removing old staff for JBoss 4/5. (cherry picked from commit 34ef99999ba2347337a1788dd2ed6173a34c00dd) --- .../stack/DiameterStackMultiplexer.java | 993 ------------------ .../stack/DiameterStackMultiplexerMBean.java | 340 ------ core/mux/sar-jboss-4/pom.xml | 169 --- .../main/resources/META-INF/jboss-service.xml | 11 - core/mux/sar-jboss-5/pom.xml | 173 --- .../main/resources/META-INF/jboss-beans.xml | 10 - .../main/resources/META-INF/jboss-service.xml | 3 - .../resources/META-INF/jboss-structure.xml | 15 - 8 files changed, 1714 deletions(-) delete mode 100644 core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java delete mode 100644 core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java delete mode 100644 core/mux/sar-jboss-4/pom.xml delete mode 100644 core/mux/sar-jboss-4/src/main/resources/META-INF/jboss-service.xml delete mode 100644 core/mux/sar-jboss-5/pom.xml delete mode 100644 core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml delete mode 100644 core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml delete mode 100644 core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java deleted file mode 100644 index d033edf2e..000000000 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java +++ /dev/null @@ -1,993 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.stack; - -import static org.jdiameter.client.impl.helpers.Parameters.CeaTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.Concurrent; -import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityDescription; -import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityName; -import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityPoolSize; -import static org.jdiameter.client.impl.helpers.Parameters.DpaTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.DwaTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.IacTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.MessageTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.OwnDiameterURI; -import static org.jdiameter.client.impl.helpers.Parameters.OwnIPAddress; -import static org.jdiameter.client.impl.helpers.Parameters.OwnRealm; -import static org.jdiameter.client.impl.helpers.Parameters.OwnVendorID; -import static org.jdiameter.client.impl.helpers.Parameters.RealmEntry; -import static org.jdiameter.client.impl.helpers.Parameters.RealmTable; -import static org.jdiameter.client.impl.helpers.Parameters.RecTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerDelay; -import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerPause; -import static org.jdiameter.client.impl.helpers.Parameters.StopTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.UseUriAsFqdn; -import static org.jdiameter.server.impl.helpers.Parameters.AcceptUndefinedPeer; -import static org.jdiameter.server.impl.helpers.Parameters.DuplicateTimer; -import static org.jdiameter.server.impl.helpers.Parameters.OwnIPAddresses; -import static org.jdiameter.server.impl.helpers.Parameters.RealmHosts; -import static org.jdiameter.server.impl.helpers.Parameters.RealmName; - -import java.io.InputStream; -import java.net.InetAddress; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.ReentrantLock; -import java.util.regex.Pattern; - -import javax.management.MBeanException; - -import org.jboss.system.ServiceMBeanSupport; -import org.jdiameter.api.Answer; -import org.jdiameter.api.ApplicationAlreadyUseException; -import org.jdiameter.api.ApplicationId; -import org.jdiameter.api.Avp; -import org.jdiameter.api.Configuration; -import org.jdiameter.api.DisconnectCause; -import org.jdiameter.api.EventListener; -import org.jdiameter.api.InternalException; -import org.jdiameter.api.LocalAction; -import org.jdiameter.api.Message; -import org.jdiameter.api.MutableConfiguration; -import org.jdiameter.api.MutablePeerTable; -import org.jdiameter.api.Network; -import org.jdiameter.api.NetworkReqListener; -import org.jdiameter.api.PeerTable; -import org.jdiameter.api.Request; -import org.jdiameter.api.ResultCode; -import org.jdiameter.api.Session; -import org.jdiameter.api.Stack; -import org.jdiameter.client.api.controller.IRealm; -import org.jdiameter.client.api.controller.IRealmTable; -import org.jdiameter.client.impl.DictionarySingleton; -import org.jdiameter.client.impl.controller.PeerImpl; -import org.jdiameter.client.impl.helpers.AppConfiguration; -import org.jdiameter.common.impl.validation.DictionaryImpl; -import org.jdiameter.server.impl.NetworkImpl; -import org.jdiameter.server.impl.StackImpl; -import org.jdiameter.server.impl.helpers.XMLConfiguration; -import org.mobicents.diameter.api.DiameterMessageFactory; -import org.mobicents.diameter.api.DiameterProvider; -import org.mobicents.diameter.dictionary.AvpDictionary; -import org.mobicents.diameter.stack.management.DiameterConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ -public class DiameterStackMultiplexer extends ServiceMBeanSupport implements DiameterStackMultiplexerMBean, DiameterProvider, NetworkReqListener, - EventListener, DiameterMessageFactory { - - private static final Logger logger = LoggerFactory.getLogger(DiameterStackMultiplexer.class); - - protected Stack stack = null; - - protected HashMap> listenerToAppId = - new HashMap>(3); - protected HashMap appIdToListener = new HashMap(3); - - // This is for synch - protected ReentrantLock lock = new ReentrantLock(); - - protected DiameterProvider provider; - - // ===== STACK MANAGEMENT ===== - - private void initStack() throws Exception { - initStack(this.getClass().getClassLoader().getResourceAsStream("config/jdiameter-config.xml")); - } - - private void initStack(InputStream is) throws Exception { - try { - // Create and configure stack - this.stack = new StackImpl(); - - // Load the configuration - Configuration config = new XMLConfiguration(is); - - this.stack.init(config); - - Network network = stack.unwrap(Network.class); - - Set appIds = stack.getMetaData().getLocalPeer().getCommonApplications(); - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Supporting {} applications.", appIds.size()); - } - //network.addNetworkReqListener(this, ApplicationId.createByAccAppId(193, 19302)); - - for (org.jdiameter.api.ApplicationId appId : appIds) { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Adding Listener for [{}].", appId); - } - network.addNetworkReqListener(this, appId); - - if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAcctAppId(), null); - } - else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAuthAppId(), null); - } - } - - try { - if (logger.isInfoEnabled()) { - logger.info("Parsing AVP Dictionary file..."); - } - AvpDictionary.INSTANCE.parseDictionary(Thread.currentThread().getContextClassLoader().getResourceAsStream("dictionary.xml")); - if (logger.isInfoEnabled()) { - logger.info("AVP Dictionary file successfuly parsed!"); - } - } - catch (Exception e) { - logger.error("Error while parsing dictionary file.", e); - } - - this.stack.start(); - } - finally { - if (is != null) { - is.close(); - } - - is = null; - } - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Successfully initialized stack."); - } - } - - private void doStopStack(int disconnectCause) throws Exception { - try { - if (logger.isInfoEnabled()) { - logger.info("Stopping Diameter Mux Stack..."); - } - - stack.stop(10, TimeUnit.SECONDS, disconnectCause); - - if (logger.isInfoEnabled()) { - logger.info("Diameter Mux Stack Stopped Successfully."); - } - } - catch (Exception e) { - logger.error("Failure while stopping stack", e); - } - - stack.destroy(); - } - - private DiameterListener findListener(Message message) { - List appIds = message.getApplicationIdAvps(); - - if (appIds.size() > 0) { - for (org.jdiameter.api.ApplicationId appId : appIds) { - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: AVP AppId [" + appId + "]"); - } - - DiameterListener listener; - - Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); - - if ((listener = this.appIdToListener.get(appIdValue)) != null) { - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); - } - - return listener; - } - } - } - else { - Long appId = message.getApplicationId(); - - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: Header AppId [" + appId + "]"); - } - - DiameterListener listener; - - if ((listener = this.appIdToListener.get(appId)) != null) { - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); - } - - return listener; - } - } - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: findListener :: No Listener Found."); - } - - return null; - } - - // ===== NetworkReqListener IMPLEMENTATION ===== - - @Override - public Answer processRequest(Request request) { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: processRequest :: Command-Code [" + request.getCommandCode() + "]"); - } - - DiameterListener listener = findListener(request); - - if (listener != null) { - return listener.processRequest(request); - } - else { - try { - Answer answer = request.createAnswer(ResultCode.APPLICATION_UNSUPPORTED); - //this.stack.getSessionFactory().getNewRawSession().send(answer); - return answer; - } - catch (Exception e) { - logger.error("Failed to create APPLICATION UNSUPPORTED answer.", e); - } - } - return null; - } - - // ===== EventListener IMPLEMENTATION ===== - - @Override - public void receivedSuccessMessage(Request request, Answer answer) { - DiameterListener listener = findListener(request); - - if (listener != null) { - listener.receivedSuccessMessage(request, answer); - } - } - - @Override - public void timeoutExpired(Request request) { - DiameterListener listener = findListener(request); - - if (listener != null) { - listener.timeoutExpired(request); - } - } - - // ===== SERVICE LIFECYCLE MANAGEMENT ===== - - @Override - protected void startService() throws Exception { - super.startService(); - initStack(); - } - - @Override - protected void stopService() throws Exception { - super.stopService(); - doStopStack(DisconnectCause.REBOOTING); - } - - @Override - public String sendMessage(Message message) { - try { - Avp sessionId = null; - Session session = null; - - if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { - session = stack.getSessionFactory().getNewSession(); - } - else { - session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); - } - - session.send(message); - - return session.getSessionId(); - } - catch (Exception e) { - logger.error("", e); - } - - return null; - } - - @Override - public Message sendMessageSync(Message message) { - try { - Avp sessionId = null; - Session session = null; - - if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { - session = stack.getSessionFactory().getNewSession(); - } - else { - session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); - } - - Future answer = session.send(message); - - return answer.get(); - } - catch (Exception e) { - logger.error("", e); - } - - return null; - } - - @Override - public Message createMessage(boolean isRequest, int commandCode, long applicationId) { - try { - Message message = this.stack.getSessionFactory().getNewRawSession(). - createMessage(commandCode, org.jdiameter.api.ApplicationId.createByAccAppId(applicationId), new Avp[]{}); - message.setRequest(isRequest); - - return message; - } - catch (Exception e) { - logger.error("Failure while creating message.", e); - } - - return null; - } - - @Override - public Message createRequest(int commandCode, long applicationId) { - return createMessage(true, commandCode, applicationId); - } - - @Override - public Message createAnswer(int commandCode, long applicationId) { - return createMessage(false, commandCode, applicationId); - } - - // ===== MBEAN OPERATIONS ===== - - @Override - public DiameterStackMultiplexerMBean getMultiplexerMBean() { - return this; - } - - @Override - public DiameterMessageFactory getMessageFactory() { - return this; - } - - @Override - public DiameterProvider getProvider() { - return this; - } - - @Override - public Stack getStack() { - return new DiameterStackProxy(this.stack); - } - - @Override - public void registerListener(DiameterListener listener, org.jdiameter.api.ApplicationId[] appIds) throws IllegalStateException { - if (listener == null) { - logger.warn("Trying to register a null Listener. Give up..."); - return; - } - - int curAppIdIndex = 0; - - try { - lock.lock(); - - // Register the selected appIds in the stack - Network network = stack.unwrap(Network.class); - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Registering " + appIds.length + " applications."); - } - - for (; curAppIdIndex < appIds.length; curAppIdIndex++) { - org.jdiameter.api.ApplicationId appId = appIds[curAppIdIndex]; - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Adding Listener for [" + appId + "]."); - } - network.addNetworkReqListener(this, appId); - - if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAcctAppId(), listener); - } - else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAuthAppId(), listener); - } - } - - // And add the listener and it's holder - Collection registeredAppIds = this.listenerToAppId.get(listener); - - // Merge the existing (if any) with new. - if (registeredAppIds != null) { - registeredAppIds.addAll(Arrays.asList(appIds)); - } - else { - this.listenerToAppId.put(listener, Arrays.asList(appIds)); - } - } - catch (ApplicationAlreadyUseException aaue) { - // Let's remove what we've done so far... - try { - Network network = stack.unwrap(Network.class); - - for (; curAppIdIndex >= 0; curAppIdIndex--) { - ApplicationId appId = appIds[curAppIdIndex]; - Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); - - // Remove the app id from map - this.appIdToListener.remove(appIdValue); - - // Unregister it from stack listener - network.removeNetworkReqListener(appId); - } - } - catch (Exception e) { - logger.error("", e); - } - } - catch (Exception e) { - logger.error("", e); - } - finally { - lock.unlock(); - } - } - - @Override - public void unregisterListener(DiameterListener listener) { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: unregisterListener :: Listener [" + listener + "]"); - } - - if (listener == null) { - logger.warn("Diameter Stack Mux :: unregisterListener :: Trying to unregister a null Listener. Give up..."); - return; - } - - try { - lock.lock(); - - Collection appIds = this.listenerToAppId.remove(listener); - - if (appIds == null) { - logger.warn("Diameter Stack Mux :: unregisterListener :: Listener has no App-Ids registered. Give up..."); - return; - } - - Network network = stack.unwrap(Network.class); - - for (org.jdiameter.api.ApplicationId appId : appIds) { - try { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: unregisterListener :: Unregistering AppId [" + appId + "]"); - } - - Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); - - // Remove the appid from map - this.appIdToListener.remove(appIdValue); - - // and unregister the listener from stack - network.removeNetworkReqListener(appId); - } - catch (Exception e) { - logger.error("", e); - } - } - } - catch (InternalException ie) { - logger.error("", ie); - } - finally { - lock.unlock(); - } - } - - // management operations ---------------------------------------------- - - /* - * -- MutableConfiguration Parameters -- - * Levels Parameters name - * Runtime - * y DuplicateTimer - * y AcceptUndefinedPeer - * y MessageTimeOut - * y StopTimeOut - * y CeaTimeOut - * y IacTimeOut - * y DwaTimeOut - * y DpaTimeOut - * y RecTimeOut - * y PeerTable, Peer, PeerName, PeerRating, PeerAttemptConnection (by NetWork interface) - * y RealmTable, Realm, RealmEntry RealmName, RealmHosts, RealmLocalAction, RealmEntryIsDynamic, RealmEntryExpTime (by NetWork interface) - * Restart stack - * y OwnDiameterURI - * y OwnIPAddresses, OwnIPAddress - * y OwnRealm - * y OwnVendorID - * n OwnProductName - * n OwnFirmwareRevision - * n ApplicationId, VendorId, AuthApplId, AcctApplId - * Not changeable - * n OverloadMonitor, OverloadMonitorEntry, OverloadMonitorData, OverloadEntryIndex, OverloadEntryhighThreshold, OverloadEntrylowThreshold - * n DuplicateProtection - * n QueueSize - */ - - private final String DEFAULT_STRING = "default_string"; - - private MutableConfiguration getMutableConfiguration() throws MBeanException { - return (MutableConfiguration) stack.getMetaData().getConfiguration(); - } - - private AppConfiguration getClientConfiguration() { - return org.jdiameter.client.impl.helpers.EmptyConfiguration.getInstance(); - } - - final Pattern IP_PATTERN = Pattern.compile("\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" - + "\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); - - @Override - public void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException { - // validate ip address - if (IP_PATTERN.matcher(ipAddress).matches()) { - Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); - - List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); - AppConfiguration newIPAddress = getClientConfiguration().add(OwnIPAddress, ipAddress); - newIPAddressesConfig.add(newIPAddress); - - getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer IP Address successfully changed to " + ipAddress + ". Restart to Diameter stack is needed to apply changes."); - } - } - else { - throw new MBeanException(new IllegalArgumentException("Invalid IP address entered (" + ipAddress + ")")); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_removeIPAddress(java.lang.String) - */ - @Override - public void _LocalPeer_removeIPAddress(String ipAddress) throws MBeanException { - Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); - - Configuration ipAddressToRemove = null; - - List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); - for (Configuration curIPAddress : newIPAddressesConfig) { - if (curIPAddress.getStringValue(OwnIPAddress.ordinal(), DEFAULT_STRING).equals(ipAddress)) { - ipAddressToRemove = curIPAddress; - break; - } - } - - if (ipAddressToRemove != null) { - newIPAddressesConfig.remove(ipAddressToRemove); - - getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer IP Address " + ipAddress + " successfully added. Restart to Diameter stack is needed to apply changes."); - } - } - else { - if (logger.isInfoEnabled()) { - logger.info("Local Peer IP Address " + ipAddress + " not found. No changes were made."); - } - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setRealm(java.lang.String) - */ - @Override - public void _LocalPeer_setRealm(String realm) throws MBeanException { - getMutableConfiguration().setStringValue(OwnRealm.ordinal(), realm); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer Realm successfully changed to '" + realm + "'. Restart to Diameter stack is needed to apply changes."); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setURI(java.lang.String) - */ - @Override - public void _LocalPeer_setURI(String uri) throws MBeanException { - // validate uri - try { - new URI(uri); - - getMutableConfiguration().setStringValue(OwnDiameterURI.ordinal(), uri); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer URI successfully changed to '" + uri + "'. Restart to Diameter stack is needed to apply changes."); - } - } - catch (URISyntaxException use) { - throw new MBeanException(use); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setVendorId(java.lang.String) - */ - @Override - public void _LocalPeer_setVendorId(long vendorId) throws MBeanException { - // validate vendor-id - try { - getMutableConfiguration().setLongValue(OwnVendorID.ordinal(), vendorId); - if (logger.isInfoEnabled()) { - logger.info("Local Peer Vendor-Id successfully changed to '" + vendorId + "'. Restart to Diameter stack is needed to apply changes."); - } - } - catch (NumberFormatException nfe) { - throw new MBeanException(nfe); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int) - */ - @Override - public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) throws MBeanException { - try { - NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); - /*Peer p =*/ n.addPeer(name, "", attemptConnect); // FIXME: This requires realm... - } - catch (IllegalArgumentException e) { - logger.warn(e.getMessage()); - } - catch (InternalException e) { - throw new MBeanException(e, "Failed to add peer with name '" + name + "'"); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_removePeer(java.lang.String) - */ - @Override - public void _Network_Peers_removePeer(String name) throws MBeanException { - try { - MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); - n.removePeer(name); - } - catch (InternalException e) { - throw new MBeanException(e, "Failed to remove peer with name '" + name + "'"); - } - } - - @Override - public void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnect) throws MBeanException { - try { - NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); - /*Peer p =*/ n.addPeer(peerName, realmName, attemptConnect); - } - catch (IllegalArgumentException e) { - logger.warn(e.getMessage()); - } - catch (InternalException e) { - throw new MBeanException(e, "Failed to add peer with name '" + peerName + "' to realm '" + realmName + "'"); - } - } - - @Override - public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, - String agentConfiguration, boolean isDynamic, int expTime) throws MBeanException { - try { - org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); - ApplicationId appId = appAcctId == 0 ? org.jdiameter.api.ApplicationId.createByAuthAppId(appVendorId, appAuthId) : - org.jdiameter.api.ApplicationId.createByAccAppId(appVendorId, appAcctId); - org.jdiameter.api.Realm r = n.addRealm(name, appId, LocalAction.valueOf(localAction), agentConfiguration, isDynamic, expTime); - for (String peer : peers.split(",")) { - ((IRealm) r).addPeerName(peer); - } - } - catch (InternalException e) { - throw new MBeanException(e, "Failed to add realm with name '" + name + "'."); - } - } - - @Override - public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId) throws MBeanException { - _Network_Realms_addRealm(name, peers, appVendorId, appAcctId, appAuthId, "LOCAL", null, false, 1); - } - - @Override - public void _Network_Realms_removePeerFromRealm(String realmName, String peerName) throws MBeanException { - try { - IRealmTable rt = stack.unwrap(IRealmTable.class); - for (org.jdiameter.api.Realm r : rt.getRealms()) { - if (r.getName().equals(realmName)) { - ((IRealm) r).removePeerName(peerName); - } - } - } - catch (InternalException e) { - throw new MBeanException(e, "Failed to add peer '" + peerName + "' from realm with '" + realmName + "'."); - } - } - - @Override - public void _Network_Realms_removeRealm(String name) throws MBeanException { - try { - org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); - n.remRealm(name); - } - catch (InternalException e) { - throw new MBeanException(e, "Failed to remove realm '" + name + "'."); - } - } - - @Override - public void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer) throws MBeanException { - getMutableConfiguration().setBooleanValue(AcceptUndefinedPeer.ordinal(), acceptUndefinedPeer); - } - - @Override - public void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn) throws MBeanException { - getMutableConfiguration().setBooleanValue(UseUriAsFqdn.ordinal(), useUriAsFqdn); - } - - @Override - public void _Parameters_setDuplicateTimer(long duplicateTimer) throws MBeanException { - getMutableConfiguration().setLongValue(DuplicateTimer.ordinal(), duplicateTimer); - } - - @Override - public void _Parameters_setMessageTimeout(long messageTimeout) throws MBeanException { - getMutableConfiguration().setLongValue(MessageTimeOut.ordinal(), messageTimeout); - } - - @Override - public void _Parameters_setStopTimeout(long stopTimeout) throws MBeanException { - getMutableConfiguration().setLongValue(StopTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setCeaTimeout(long stopTimeout) throws MBeanException { - getMutableConfiguration().setLongValue(CeaTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setIacTimeout(long stopTimeout) throws MBeanException { - getMutableConfiguration().setLongValue(IacTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setDwaTimeout(long stopTimeout) throws MBeanException { - getMutableConfiguration().setLongValue(DwaTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setDpaTimeout(long stopTimeout) throws MBeanException { - getMutableConfiguration().setLongValue(DpaTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setRecTimeout(long stopTimeout) throws MBeanException { - getMutableConfiguration().setLongValue(RecTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setConcurrentEntity(String name, String desc, Integer size) throws MBeanException { - for (Configuration c : getMutableConfiguration().getChildren(Concurrent.ordinal())) { - if (name.equals(c.getStringValue(ConcurrentEntityName.ordinal(), null))) { - ((AppConfiguration) c).add(ConcurrentEntityPoolSize, size); - if (desc != null) { - ((AppConfiguration) c).add(ConcurrentEntityDescription, desc); - } - } - } - } - @Override - public void _Parameters_setStatisticLoggerDelay(long delay) throws MBeanException { - getMutableConfiguration().setLongValue(StatisticsLoggerDelay.ordinal(), delay); - } - - @Override - public void _Parameters_setStatisticLoggerPause(long pause) throws MBeanException { - getMutableConfiguration().setLongValue(StatisticsLoggerPause.ordinal(), pause); - } - - @Override - public void _Validation_setEnabled(boolean enableValidation) throws MBeanException { - ((DictionaryImpl) DictionarySingleton.getDictionary()).setEnabled(enableValidation) ; - } - - @Override - public String dumpStackConfiguration() throws MBeanException { - return getMutableConfiguration().toString(); - } - - @Override - public void startStack() throws MBeanException { - try { - this.stack.start(); - } - catch (Exception e) { - throw new MBeanException(e); - } - } - - @Override - public void stopStack(int disconnectCause) throws MBeanException { - try { - this.stack.stop(getMutableConfiguration().getLongValue(StopTimeOut.ordinal(), 10000L), TimeUnit.MILLISECONDS, disconnectCause); - } - catch (Exception e) { - throw new MBeanException(e); - } - } - - // Getters ------------------------------------------------------------- // - - @Override - public String _LocalPeer_getProductName() throws MBeanException { - return this.stack.getMetaData().getLocalPeer().getProductName(); - } - - @Override - public Long _LocalPeer_getVendorId() throws MBeanException { - return this.stack.getMetaData().getLocalPeer().getVendorId(); - } - - @Override - public Long _LocalPeer_getFirmware() throws MBeanException { - return this.stack.getMetaData().getLocalPeer().getFirmware(); - } - - @Override - public String _LocalPeer_getURI() throws MBeanException { - return this.stack.getMetaData().getLocalPeer().getUri().toString(); - } - - @Override - public String _LocalPeer_getRealmName() throws MBeanException { - return this.stack.getMetaData().getLocalPeer().getRealmName(); - } - - @Override - public InetAddress[] _LocalPeer_getIPAddresses() throws MBeanException { - return this.stack.getMetaData().getLocalPeer().getIPAddresses(); - } - - @Override - public Set _LocalPeer_getCommonApplicationIds() throws MBeanException { - return this.stack.getMetaData().getLocalPeer().getCommonApplications(); - } - - @Override - public String[] _Network_Realms_getRealms() throws MBeanException { - Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); - String[] realmNames = new String[realmEntries.length]; - - for (int i = 0; i < realmEntries.length; i++) { - realmNames[i] = realmEntries[i].getStringValue(RealmName.ordinal(), DEFAULT_STRING); - } - - return realmNames; - } - - @Override - public String[] _Network_Realms_getRealmPeers(String realmName) throws MBeanException { - Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); - String[] realmHosts = new String[realmEntries.length]; - - for (Configuration realmEntry : realmEntries) { - if (realmEntry.getStringValue(RealmName.ordinal(), DEFAULT_STRING).equals(realmName)) { - - String realmHostsString = realmEntry.getStringValue(RealmHosts.ordinal(), DEFAULT_STRING); - if (!realmHostsString.equals(DEFAULT_STRING)) { - realmHosts = realmHostsString.replaceAll(" ", "").split(","); - } - } - } - - return realmHosts; - } - - @Override - public DiameterConfiguration getDiameterConfiguration() throws MBeanException { - return new DiameterConfiguration(stack); - } - - @Override - public boolean _LocalPeer_isActive() throws MBeanException { - return this.stack.isActive(); - } - - @Override - public boolean _Network_Peers_isPeerConnected(String name) throws MBeanException { - try { - MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); - PeerImpl p = ((PeerImpl) n.getPeer(name)); - return p != null ? p.getContext().isConnected() : false; - } - catch (Exception e) { - throw new MBeanException(e, "Failed to get connection availability for peer with name '" + "'."); - } - } - - -} diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java deleted file mode 100644 index 8599ac34f..000000000 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java +++ /dev/null @@ -1,340 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.stack; - -import java.net.InetAddress; -import java.util.Set; - -import javax.management.MBeanException; - -import org.jboss.system.ServiceMBean; -import org.jdiameter.api.ApplicationId; -import org.jdiameter.api.Stack; -import org.mobicents.diameter.api.DiameterMessageFactory; -import org.mobicents.diameter.api.DiameterProvider; -import org.mobicents.diameter.stack.management.DiameterConfiguration; - -/** - * - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ -public interface DiameterStackMultiplexerMBean extends ServiceMBean { - - String MBEAN_NAME_PREFIX = "diameter:Service=DiameterStackMultiplexer,Name="; - - void registerListener(DiameterListener listener, ApplicationId[] appIds) throws IllegalStateException; - - void unregisterListener(DiameterListener listener); - - //For sake of simplicity in the pre Gamma :) - Stack getStack(); - - DiameterProvider getProvider(); - - DiameterMessageFactory getMessageFactory(); - - DiameterStackMultiplexerMBean getMultiplexerMBean(); - - // MANAGEMENT OPERATIONS - - // Get a Serializable Configuration - - DiameterConfiguration getDiameterConfiguration() throws MBeanException; - - // Local Peer ---------------------------------------------------------- - - /** - * Changes the URI of the Local Peer. - * - * @param uri the new URI to be used by the Local Peer - * @throws MBeanException if the operation is unable to perform correctly - */ - void _LocalPeer_setURI(String uri) throws MBeanException; - - /** - * Adds an IP Address to the Local Peer. - * @param ipAddress the IP Address to be added, if not present - * @throws MBeanException if the operation is unable to perform correctly - */ - void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException; - - /** - * Removes an IP Address from the Local Peer. - * - * @param ipAddress the IP Address to be removed, if present - * @throws MBeanException if the operation is unable to perform correctly - */ - void _LocalPeer_removeIPAddress(String ipAddress) throws MBeanException; - - /** - * Changes the Realm of the Local Peer. - * - * @param realm the new Realm to be used by the Local Peer - * @throws MBeanException if the operation is unable to perform correctly - */ - void _LocalPeer_setRealm(String realm) throws MBeanException; - - /** - * Sets the Local Peer Vendor-Id. - * - * @param vendorId the new Vendor-Id for the Peer - * @throws MBeanException if the operation is unable to perform correctly - */ - void _LocalPeer_setVendorId(long vendorId) throws MBeanException; - - // Parameters ---------------------------------------------------------- - - /** - * Sets whether the stack will accept connections from unknown peers or not (default: true) - * - * @param acceptUndefinedPeer indicates if the stack will accept unknown connections - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer) throws MBeanException; - - /** - * Sets whether the stack will use URI (aaa://IP_ADDRESS:PORT) as FQDN. Some Peers require it. - * - * @param useUriAsFqdn indicates if the stack will use URI as FQDN - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn) throws MBeanException; - - /** - * Sets the value to consider a message as a duplicate, in ms. (default: 240000, 4 minutes). - * - * @param duplicateTimer the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setDuplicateTimer(long duplicateTimer) throws MBeanException; - - // Parameters : Timeouts ----------------------------------------------- - - /** - * Sets the timeout for general Diameter messages, in ms. (default: 60000, 1 minute). - * - * @param messageTimeout the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setMessageTimeout(long messageTimeout) throws MBeanException; - - /** - * Sets the timeout for stopping the stack. (default: 10000, 10 seconds). - * - * @param stopTimeout the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setStopTimeout(long stopTimeout) throws MBeanException; - - /** - * Sets the timeout for CEA messages. (default: 10000, 10 seconds). - * - * @param ceaTimeout the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setCeaTimeout(long ceaTimeout) throws MBeanException; - - /** - * Sets the timeout for inactiveness. (default: 20000, 20 seconds). - * - * @param iacTimeout the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setIacTimeout(long iacTimeout) throws MBeanException; - - /** - * Sets the timeout for DWA messages. (default: 10000, 10 seconds). - * - * @param dwaTimeout the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setDwaTimeout(long dwaTimeout) throws MBeanException; - - /** - * Sets the timeout for DPA messages. (default: 5000, 5 seconds). - * - * @param dpaTimeout the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setDpaTimeout(long dpaTimeout) throws MBeanException; - - /** - * Sets the timeout for reconnecting. (default: 10000, 10 seconds). - * - * @param recTimeout the amount of time, in ms. - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Parameters_setRecTimeout(long recTimeout) throws MBeanException; - - void _Parameters_setConcurrentEntity(String name, String desc, Integer size) throws MBeanException; - - void _Parameters_setStatisticLoggerDelay(long delay) throws MBeanException; - - void _Parameters_setStatisticLoggerPause(long pause) throws MBeanException; - - // Network : Peers ----------------------------------------------------- - - /** - * Adds a peer definition to the stack. Same as element in XML Configuration. - * - * @param name the name/uri of the peer - * @param attemptConnect indicates if the stack should try to connect to this peer or wait for incoming connection - * @param rating the peer rating for decision on message routing - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) throws MBeanException; - - /** - * Removes a peer definition from stack. - * - * @param name the name/uri of the peer - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Network_Peers_removePeer(String name) throws MBeanException; - - // Network : Realms ---------------------------------------------------- - - /** - * Adds a new Realm to the stack. Same as element in XML Configuration. - * - * @param name the name of the Realm - * @param peers the Realm peer hosts, separated by comma - * @param appVendorId the vendor-id of the application supported by this realm - * @param appAcctId the accounting-id of the application supported by this realm - * @param appAuthId the authorization-id of the application supported by this realm - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId) throws MBeanException; - - void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, String agentConfiguration, - boolean isDynamic, int expTime) throws MBeanException; - - /** - * Removes a Realm from the stack. - * - * @param name the name of the Realm - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Network_Realms_removeRealm(String name) throws MBeanException; - - /** - * Adds a new Peer host to the Realm - * - * @param realmName the name of the Realm - * @param peerName the name/host of the Peer to be added - * @param attemptConnecting either try or not to connect the peer (client/server) - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnecting) throws MBeanException; - - /** - * Removes a Peer host from the Realm - * - * @param realmName the name of the Realm - * @param peerName the name/host of the Peer to be removed - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Network_Realms_removePeerFromRealm(String realmName, String peerName) throws MBeanException; - - // Stack Operation ----------------------------------------------------- - - /** - * Operation to stop the stack. - * - * @throws MBeanException - */ - void stopStack(int disconnectCause) throws MBeanException; - - /** - * Operation to start the stack. - * - * @throws MBeanException - */ - void startStack() throws MBeanException; - - // Validation ---------------------------------------------------------- - - /** - * Sets whether validation on Diameter messages/AVPs should be performed or not. - * - * @param enableValidation flag indicating if validation should be performed - * @throws MBeanException if the operation is unable to perform correctly - */ - void _Validation_setEnabled(boolean enableValidation) throws MBeanException; - - // Configuration Dump -------------------------------------------------- - - /** - * Dumps full stack configuration. - * - * @return a String with stack configuration - * @throws MBeanException if the operation is unable to perform correctly - */ - String dumpStackConfiguration() throws MBeanException; - - // Information dump methods -------------------------------------------- - - String _LocalPeer_getProductName() throws MBeanException; - - Long _LocalPeer_getVendorId() throws MBeanException; - - Long _LocalPeer_getFirmware() throws MBeanException; - - String _LocalPeer_getURI() throws MBeanException; - - String _LocalPeer_getRealmName() throws MBeanException; - - InetAddress[] _LocalPeer_getIPAddresses() throws MBeanException; - - Set _LocalPeer_getCommonApplicationIds() throws MBeanException; - - String[] _Network_Realms_getRealms() throws MBeanException; - - String[] _Network_Realms_getRealmPeers(String realmName) throws MBeanException; - - boolean _LocalPeer_isActive() throws MBeanException; - - boolean _Network_Peers_isPeerConnected(String name) throws MBeanException; - -} diff --git a/core/mux/sar-jboss-4/pom.xml b/core/mux/sar-jboss-4/pom.xml deleted file mode 100644 index 7b6ab17bd..000000000 --- a/core/mux/sar-jboss-4/pom.xml +++ /dev/null @@ -1,169 +0,0 @@ - - - 4.0.0 - - - org.mobicents.diameter - restcomm-diameter-mux-parent - 1.7.0-SNAPSHOT - ../pom.xml - - - restcomm-diameter-mux-sar-jboss-4 - - Restcomm :: Diameter Multiplexer :: ${project.artifactId} - - jboss-sar - - - - ${project.groupId} - restcomm-diameter-mux-jar - ${project.version} - runtime - - - - - restcomm-diameter-mux-${project.version} - - - - maven-resources-plugin - 2.7 - - - copy-resources - validate - - copy-resources - - - true - ${basedir}/target/classes/config - - - ../common/config - false - - - - - - - - - - org.codehaus.mojo - jboss-packaging-maven-plugin - 2.2 - true - - - apache-xerces:xml-apis - org.jboss.logging:jboss-logging-spi - org.jboss:jboss-common-core - org.jboss:jboss-vfs - org.jboss:jbossxb - org.jboss:jboss-reflect - wutka-dtdparser:dtdparser121 - javax.activation:activation - sun-jaxb:jaxb-api - org.jboss.deployers:jboss-deployers-core-spi - org.jboss.deployers:jboss-deployers-impl - org.jboss.deployers:jboss-deployers-spi - org.jboss.deployers:jboss-deployers-structure-spi - org.jboss.deployers:jboss-deployers-client-spi - org.jboss.man:jboss-managed - org.jboss.man:jboss-metatype - org.jboss:jboss-mdr - org.jboss.integration:jboss-classloading-spi - org.jboss.cl:jboss-classloading - org.jboss.cl:jboss-classloader - org.jboss.microcontainer:jboss-kernel - org.jboss.microcontainer:jboss-dependency - javassist:javassist - org.jboss.deployers:jboss-deployers-vfs - org.jboss.deployers:jboss-deployers-vfs-spi - stax:stax-api - org.jboss.cl:jboss-classloading-vfs - org.jboss.deployers:jboss-deployers-core - org.jboss.deployers:jboss-deployers-client - org.jboss.jbossas:jboss-as-j2se - oswego-concurrent:concurrent - org.jboss.bootstrap:jboss-bootstrap - org.jboss.jbossas:jboss-as-system - org.jboss.jbossas:jboss-as-system-jmx - org.jboss.aop:jboss-aop - org.apache.ant:ant - org.apache.ant:ant-launcher - qdox:qdox - trove:trove - log4j:log4j - org.jboss.logging:jboss-logging-log4j - org.jboss.integration:jboss-profileservice-spi - org.jboss.microcontainer:jboss-aop-mc-int - org.jboss.jbossas:jboss-as-jmx - org.jboss.jbossas:jboss-as-j2se - org.jboss.jbossas:jboss-as-mbeans - dom4j:dom4j - bcel:bcel - org.jboss.test:jboss-test - org.apache.ant:ant-junit - junit:junit - jboss.profiler.jvmti:jboss-profiler-jvmti - org.jboss.jbossas:jboss-server-manager - org.jboss.naming:jnp-client - org.jboss.security:jbosssx-client - org.jboss.security:jboss-security-spi - - xml-apis:xml-apis - - - - - - - - maven-antrun-plugin - - - deploy - install - - run - - - - - - - - - - - - - - - - undeploy - clean - - run - - - - - - - - - - - - - diff --git a/core/mux/sar-jboss-4/src/main/resources/META-INF/jboss-service.xml b/core/mux/sar-jboss-4/src/main/resources/META-INF/jboss-service.xml deleted file mode 100644 index a7e7accf1..000000000 --- a/core/mux/sar-jboss-4/src/main/resources/META-INF/jboss-service.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - diff --git a/core/mux/sar-jboss-5/pom.xml b/core/mux/sar-jboss-5/pom.xml deleted file mode 100644 index 98f159b29..000000000 --- a/core/mux/sar-jboss-5/pom.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - 4.0.0 - - - org.mobicents.diameter - restcomm-diameter-mux-parent - 1.7.0-SNAPSHOT - ../pom.xml - - - restcomm-diameter-mux-sar-jboss-5 - - Restcomm :: Diameter Multiplexer :: ${project.artifactId} - - jboss-sar - - - - ${project.groupId} - restcomm-diameter-mux-jar - ${project.version} - runtime - - - - - restcomm-diameter-mux-${project.version} - - - - maven-resources-plugin - 2.7 - - - copy-resources - validate - - copy-resources - - - true - ${basedir}/target/classes/config - - - ../common/config - false - - - - - - - - - - org.codehaus.mojo - jboss-packaging-maven-plugin - 2.2 - true - - - apache-xerces:xml-apis - org.jboss.logging:jboss-logging-spi - org.jboss:jboss-common-core - org.jboss:jboss-vfs - org.jboss:jbossxb - org.jboss:jboss-reflect - wutka-dtdparser:dtdparser121 - javax.activation:activation - sun-jaxb:jaxb-api - org.jboss.deployers:jboss-deployers-core-spi - org.jboss.deployers:jboss-deployers-impl - org.jboss.deployers:jboss-deployers-spi - org.jboss.deployers:jboss-deployers-structure-spi - org.jboss.deployers:jboss-deployers-client-spi - org.jboss.man:jboss-managed - org.jboss.man:jboss-metatype - org.jboss:jboss-mdr - org.jboss.integration:jboss-classloading-spi - org.jboss.cl:jboss-classloading - org.jboss.cl:jboss-classloader - org.jboss.microcontainer:jboss-kernel - org.jboss.microcontainer:jboss-dependency - javassist:javassist - org.jboss.deployers:jboss-deployers-vfs - org.jboss.deployers:jboss-deployers-vfs-spi - stax:stax-api - org.jboss.cl:jboss-classloading-vfs - org.jboss.deployers:jboss-deployers-core - org.jboss.deployers:jboss-deployers-client - org.jboss.jbossas:jboss-as-j2se - oswego-concurrent:concurrent - org.jboss.bootstrap:jboss-bootstrap - org.jboss.jbossas:jboss-as-system - org.jboss.jbossas:jboss-as-system-jmx - org.jboss.aop:jboss-aop - org.apache.ant:ant - org.apache.ant:ant-launcher - qdox:qdox - trove:trove - log4j:log4j - org.jboss.logging:jboss-logging-log4j - org.jboss.integration:jboss-profileservice-spi - org.jboss.microcontainer:jboss-aop-mc-int - org.jboss.jbossas:jboss-as-jmx - org.jboss.jbossas:jboss-as-j2se - org.jboss.jbossas:jboss-as-mbeans - dom4j:dom4j - bcel:bcel - org.jboss.test:jboss-test - org.apache.ant:ant-junit - junit:junit - jboss.profiler.jvmti:jboss-profiler-jvmti - org.jboss.jbossas:jboss-server-manager - org.jboss.naming:jnp-client - org.jboss.security:jbosssx-client - org.jboss.security:jboss-security-spi - - xml-apis:xml-apis - - - - - - - - maven-antrun-plugin - - - deploy - install - - run - - - - - - - - - - - - - - - - - - - - undeploy - clean - - run - - - - - - - - - - - - - diff --git a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml deleted file mode 100644 index 11694d23d..000000000 --- a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - @org.jboss.aop.microcontainer.aspects.jmx.JMX(name="diameter.mobicents:service=DiameterStackMultiplexer", exposedInterface=org.mobicents.diameter.stack.DiameterStackMultiplexerMBean.class, registerDirectly=true) - TransactionManager - - - diff --git a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml deleted file mode 100644 index 6439b1f28..000000000 --- a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - \ No newline at end of file diff --git a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml deleted file mode 100644 index 4a2d38d38..000000000 --- a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - From 5812c9b68053cdeeac7eb744dfbb014b8f865c18 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 20 Jan 2017 15:58:55 +0200 Subject: [PATCH 04/75] Fixed MBean interface and class names. Clearing. (cherry picked from commit 916313ee39b92df63ec1a0bd686abf1bdd4d2fcf) --- .../stack/DiameterStackMultiplexerAS7.java | 1132 +++++++++++++---- .../DiameterStackMultiplexerAS7Bean.java | 970 -------------- .../DiameterStackMultiplexerAS7MBean.java | 290 +++++ .../META-INF/jboss-deployment-structure.xml | 12 - core/mux/pom.xml | 24 +- .../META-INF/jboss-deployment-structure.xml | 10 - 6 files changed, 1205 insertions(+), 1233 deletions(-) delete mode 100644 core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7Bean.java create mode 100644 core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java delete mode 100644 core/mux/jar/src/main/resources/META-INF/jboss-deployment-structure.xml delete mode 100644 core/mux/sar-jboss-7/src/main/resources/META-INF/jboss-deployment-structure.xml diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java index e18d73ecc..ae1de4975 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java @@ -1,6 +1,5 @@ /* * TeleStax, Open Source Cloud Communications - * * Copyright 2011-2015, Telestax Inc. and individual contributors * by the @authors tag. * @@ -20,274 +19,955 @@ package org.mobicents.diameter.stack; +import static org.jdiameter.client.impl.helpers.Parameters.CeaTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.Concurrent; +import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityDescription; +import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityName; +import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityPoolSize; +import static org.jdiameter.client.impl.helpers.Parameters.DpaTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.DwaTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.IacTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.MessageTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.OwnDiameterURI; +import static org.jdiameter.client.impl.helpers.Parameters.OwnIPAddress; +import static org.jdiameter.client.impl.helpers.Parameters.OwnRealm; +import static org.jdiameter.client.impl.helpers.Parameters.OwnVendorID; +import static org.jdiameter.client.impl.helpers.Parameters.RealmEntry; +import static org.jdiameter.client.impl.helpers.Parameters.RealmTable; +import static org.jdiameter.client.impl.helpers.Parameters.RecTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerDelay; +import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerPause; +import static org.jdiameter.client.impl.helpers.Parameters.StopTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.UseUriAsFqdn; +import static org.jdiameter.server.impl.helpers.Parameters.AcceptUndefinedPeer; +import static org.jdiameter.server.impl.helpers.Parameters.DuplicateTimer; +import static org.jdiameter.server.impl.helpers.Parameters.OwnIPAddresses; +import static org.jdiameter.server.impl.helpers.Parameters.RealmHosts; +import static org.jdiameter.server.impl.helpers.Parameters.RealmName; + +import java.io.InputStream; import java.net.InetAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; import java.util.Set; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.ReentrantLock; +import java.util.regex.Pattern; -import javax.ejb.Local; - +import org.jdiameter.api.Answer; +import org.jdiameter.api.ApplicationAlreadyUseException; import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.Avp; +import org.jdiameter.api.Configuration; +import org.jdiameter.api.DisconnectCause; +import org.jdiameter.api.EventListener; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.LocalAction; +import org.jdiameter.api.Message; +import org.jdiameter.api.MutableConfiguration; +import org.jdiameter.api.MutablePeerTable; +import org.jdiameter.api.Network; +import org.jdiameter.api.NetworkReqListener; +import org.jdiameter.api.PeerTable; +import org.jdiameter.api.Request; +import org.jdiameter.api.ResultCode; +import org.jdiameter.api.Session; import org.jdiameter.api.Stack; +import org.jdiameter.client.api.controller.IRealm; +import org.jdiameter.client.api.controller.IRealmTable; +import org.jdiameter.client.impl.DictionarySingleton; +import org.jdiameter.client.impl.controller.PeerImpl; +import org.jdiameter.client.impl.helpers.AppConfiguration; +import org.jdiameter.common.impl.validation.DictionaryImpl; +import org.jdiameter.server.impl.NetworkImpl; +import org.jdiameter.server.impl.StackImpl; +import org.jdiameter.server.impl.helpers.XMLConfiguration; import org.mobicents.diameter.api.DiameterMessageFactory; import org.mobicents.diameter.api.DiameterProvider; +import org.mobicents.diameter.dictionary.AvpDictionary; import org.mobicents.diameter.stack.management.DiameterConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * * @author Alexandre Mendonca */ -@Local -public interface DiameterStackMultiplexerAS7 { +public class DiameterStackMultiplexerAS7 implements DiameterStackMultiplexerAS7MBean, DiameterProvider, NetworkReqListener, EventListener, + DiameterMessageFactory { + + private static final Logger logger = LoggerFactory.getLogger(DiameterStackMultiplexerAS7.class); - String MBEAN_NAME_PREFIX = "diameter:Service=DiameterStackMultiplexer,Name="; + public static final String OBJECT_NAME = "diameter.mobicents:service=DiameterStackMultiplexer"; - void registerListener(DiameterListener listener, ApplicationId[] appIds) throws IllegalStateException; + protected Stack stack = null; - void unregisterListener(DiameterListener listener); + protected HashMap> listenerToAppId = + new HashMap>(3); + protected HashMap appIdToListener = new HashMap(3); - //For sake of simplicity in the pre Gamma :) - Stack getStack(); + // This is for synch + protected ReentrantLock lock = new ReentrantLock(); - DiameterProvider getProvider(); + protected DiameterProvider provider; - DiameterMessageFactory getMessageFactory(); + // ===== STACK MANAGEMENT ===== - DiameterStackMultiplexerAS7 getMultiplexerMBean(); + private void initStack() throws Exception { + initStack(this.getClass().getClassLoader().getResourceAsStream("config/jdiameter-config.xml")); + } - // MANAGEMENT OPERATIONS + private void initStack(InputStream is) throws Exception { + try { + // Create and configure stack + this.stack = new StackImpl(); - // Get a Serializable Configuration + // Load the configuration + Configuration config = new XMLConfiguration(is); + + this.stack.init(config); - DiameterConfiguration getDiameterConfiguration(); + Network network = stack.unwrap(Network.class); - // Local Peer ---------------------------------------------------------- + Set appIds = stack.getMetaData().getLocalPeer().getCommonApplications(); - /** - * Changes the URI of the Local Peer. - * - * @param uri the new URI to be used by the Local Peer - */ - void _LocalPeer_setURI(String uri); + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Supporting {} applications.", appIds.size()); + } + //network.addNetworkReqListener(this, ApplicationId.createByAccAppId(193, 19302)); + + for (org.jdiameter.api.ApplicationId appId : appIds) { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Adding Listener for [{}].", appId); + } + network.addNetworkReqListener(this, appId); - /** - * Adds an IP Address to the Local Peer. - * @param ipAddress the IP Address to be added, if not present - */ - void _LocalPeer_addIPAddress(String ipAddress); + if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAcctAppId(), null); + } + else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAuthAppId(), null); + } + } - /** - * Removes an IP Address from the Local Peer. - * - * @param ipAddress the IP Address to be removed, if present + try { + if (logger.isInfoEnabled()) { + logger.info("Parsing AVP Dictionary file..."); + } + AvpDictionary.INSTANCE.parseDictionary(Thread.currentThread().getContextClassLoader().getResourceAsStream("dictionary.xml")); + if (logger.isInfoEnabled()) { + logger.info("AVP Dictionary file successfuly parsed!"); + } + } + catch (Exception e) { + logger.error("Error while parsing dictionary file.", e); + } + + this.stack.start(); + } + finally { + if (is != null) { + is.close(); + } + + is = null; + } + + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Successfully initialized stack."); + } + } + + private void doStopStack(int disconnectCause) throws Exception { + try { + if (logger.isInfoEnabled()) { + logger.info("Stopping Diameter Mux Stack..."); + } + + stack.stop(10, TimeUnit.SECONDS, disconnectCause); + + if (logger.isInfoEnabled()) { + logger.info("Diameter Mux Stack Stopped Successfully."); + } + } + catch (Exception e) { + logger.error("Failure while stopping stack", e); + } + + stack.destroy(); + } + + private DiameterListener findListener(Message message) { + List appIds = message.getApplicationIdAvps(); + + if (appIds.size() > 0) { + for (org.jdiameter.api.ApplicationId appId : appIds) { + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: AVP AppId [" + appId + "]"); + } + + DiameterListener listener; + + Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); + + if ((listener = this.appIdToListener.get(appIdValue)) != null) { + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); + } + + return listener; + } + } + } + else { + Long appId = message.getApplicationId(); + + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: Header AppId [" + appId + "]"); + } + + DiameterListener listener; + + if ((listener = this.appIdToListener.get(appId)) != null) { + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); + } + + return listener; + } + } + + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: findListener :: No Listener Found."); + } + + return null; + } + + // ===== NetworkReqListener IMPLEMENTATION ===== + + @Override + public Answer processRequest(Request request) { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: processRequest :: Command-Code [" + request.getCommandCode() + "]"); + } + + DiameterListener listener = findListener(request); + + if (listener != null) { + return listener.processRequest(request); + } + else { + try { + Answer answer = request.createAnswer(ResultCode.APPLICATION_UNSUPPORTED); + //this.stack.getSessionFactory().getNewRawSession().send(answer); + return answer; + } + catch (Exception e) { + logger.error("Failed to create APPLICATION UNSUPPORTED answer.", e); + } + } + return null; + } + + // ===== EventListener IMPLEMENTATION ===== + + @Override + public void receivedSuccessMessage(Request request, Answer answer) { + DiameterListener listener = findListener(request); + + if (listener != null) { + listener.receivedSuccessMessage(request, answer); + } + } + + @Override + public void timeoutExpired(Request request) { + DiameterListener listener = findListener(request); + + if (listener != null) { + listener.timeoutExpired(request); + } + } + + // ===== SERVICE LIFECYCLE MANAGEMENT ===== + + public void startService() { //throws Exception { + try { + logger.debug("startService"); + initStack(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void stopService() { // throws Exception { + try { + doStopStack(DisconnectCause.REBOOTING); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public String sendMessage(Message message) { + try { + Avp sessionId = null; + Session session = null; + + if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { + session = stack.getSessionFactory().getNewSession(); + } + else { + session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); + } + + session.send(message); + + return session.getSessionId(); + } + catch (Exception e) { + logger.error("", e); + } + + return null; + } + + @Override + public Message sendMessageSync(Message message) { + try { + Avp sessionId = null; + Session session = null; + + if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { + session = stack.getSessionFactory().getNewSession(); + } + else { + session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); + } + + Future answer = session.send(message); + + return answer.get(); + } + catch (Exception e) { + logger.error("", e); + } + + return null; + } + + @Override + public Message createMessage(boolean isRequest, int commandCode, long applicationId) { + try { + Message message = this.stack.getSessionFactory().getNewRawSession(). + createMessage(commandCode, org.jdiameter.api.ApplicationId.createByAccAppId(applicationId), new Avp[]{}); + message.setRequest(isRequest); + + return message; + } + catch (Exception e) { + logger.error("Failure while creating message.", e); + } + + return null; + } + + @Override + public Message createRequest(int commandCode, long applicationId) { + return createMessage(true, commandCode, applicationId); + } + + @Override + public Message createAnswer(int commandCode, long applicationId) { + return createMessage(false, commandCode, applicationId); + } + + // ===== MBEAN OPERATIONS ===== + + @Override + public DiameterStackMultiplexerAS7MBean getMultiplexerMBean() { + return (DiameterStackMultiplexerAS7MBean)this; + } + + @Override + public DiameterMessageFactory getMessageFactory() { + return this; + } + + @Override + public DiameterProvider getProvider() { + return this; + } + + @Override + public Stack getStack() { + return new DiameterStackProxy(this.stack); + } + + @Override + public void registerListener(DiameterListener listener, org.jdiameter.api.ApplicationId[] appIds) throws IllegalStateException { + if (listener == null) { + logger.warn("Trying to register a null Listener. Give up..."); + return; + } + + int curAppIdIndex = 0; + + try { + lock.lock(); + + // Register the selected appIds in the stack + Network network = stack.unwrap(Network.class); + + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Registering " + appIds.length + " applications."); + } + + for (; curAppIdIndex < appIds.length; curAppIdIndex++) { + org.jdiameter.api.ApplicationId appId = appIds[curAppIdIndex]; + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Adding Listener for [" + appId + "]."); + } + network.addNetworkReqListener(this, appId); + + if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAcctAppId(), listener); + } + else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAuthAppId(), listener); + } + } + + // And add the listener and it's holder + Collection registeredAppIds = this.listenerToAppId.get(listener); + + // Merge the existing (if any) with new. + if (registeredAppIds != null) { + registeredAppIds.addAll(Arrays.asList(appIds)); + } + else { + this.listenerToAppId.put(listener, Arrays.asList(appIds)); + } + } + catch (ApplicationAlreadyUseException aaue) { + // Let's remove what we've done so far... + try { + Network network = stack.unwrap(Network.class); + + for (; curAppIdIndex >= 0; curAppIdIndex--) { + ApplicationId appId = appIds[curAppIdIndex]; + Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); + + // Remove the app id from map + this.appIdToListener.remove(appIdValue); + + // Unregister it from stack listener + network.removeNetworkReqListener(appId); + } + } + catch (Exception e) { + logger.error("", e); + } + } + catch (Exception e) { + logger.error("", e); + } + finally { + lock.unlock(); + } + } + + @Override + public void unregisterListener(DiameterListener listener) { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: unregisterListener :: Listener [" + listener + "]"); + } + + if (listener == null) { + logger.warn("Diameter Stack Mux :: unregisterListener :: Trying to unregister a null Listener. Give up..."); + return; + } + + try { + lock.lock(); + + Collection appIds = this.listenerToAppId.remove(listener); + + if (appIds == null) { + logger.warn("Diameter Stack Mux :: unregisterListener :: Listener has no App-Ids registered. Give up..."); + return; + } + + Network network = stack.unwrap(Network.class); + + for (org.jdiameter.api.ApplicationId appId : appIds) { + try { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: unregisterListener :: Unregistering AppId [" + appId + "]"); + } + + Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); + + // Remove the appid from map + this.appIdToListener.remove(appIdValue); + + // and unregister the listener from stack + network.removeNetworkReqListener(appId); + } + catch (Exception e) { + logger.error("", e); + } + } + } + catch (InternalException ie) { + logger.error("", ie); + } + finally { + lock.unlock(); + } + } + + // management operations ---------------------------------------------- + + /* + * -- MutableConfiguration Parameters -- + * Levels Parameters name + * Runtime + * y DuplicateTimer + * y AcceptUndefinedPeer + * y MessageTimeOut + * y StopTimeOut + * y CeaTimeOut + * y IacTimeOut + * y DwaTimeOut + * y DpaTimeOut + * y RecTimeOut + * y PeerTable, Peer, PeerName, PeerRating, PeerAttemptConnection (by NetWork interface) + * y RealmTable, Realm, RealmEntry RealmName, RealmHosts, RealmLocalAction, RealmEntryIsDynamic, RealmEntryExpTime (by NetWork interface) + * Restart stack + * y OwnDiameterURI + * y OwnIPAddresses, OwnIPAddress + * y OwnRealm + * y OwnVendorID + * n OwnProductName + * n OwnFirmwareRevision + * n ApplicationId, VendorId, AuthApplId, AcctApplId + * Not changeable + * n OverloadMonitor, OverloadMonitorEntry, OverloadMonitorData, OverloadEntryIndex, OverloadEntryhighThreshold, OverloadEntrylowThreshold + * n DuplicateProtection + * n QueueSize */ - void _LocalPeer_removeIPAddress(String ipAddress); - /** - * Changes the Realm of the Local Peer. - * - * @param realm the new Realm to be used by the Local Peer - */ - void _LocalPeer_setRealm(String realm); + private final String DEFAULT_STRING = "default_string"; - /** - * Sets the Local Peer Vendor-Id. - * - * @param vendorId the new Vendor-Id for the Peer - */ - void _LocalPeer_setVendorId(long vendorId); + private MutableConfiguration getMutableConfiguration() { + return (MutableConfiguration) stack.getMetaData().getConfiguration(); + } - // Parameters ---------------------------------------------------------- + private AppConfiguration getClientConfiguration() { + return org.jdiameter.client.impl.helpers.EmptyConfiguration.getInstance(); + } - /** - * Sets whether the stack will accept connections from unknown peers or not (default: true) - * - * @param acceptUndefinedPeer indicates if the stack will accept unknown connections - */ - void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer); + final Pattern IP_PATTERN = Pattern.compile("\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" + + "\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); - /** - * Sets whether the stack will use URI (aaa://IP_ADDRESS:PORT) as FQDN. Some Peers require it. - * - * @param useUriAsFqdn indicates if the stack will use URI as FQDN - */ - void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn); + @Override + public void _LocalPeer_addIPAddress(String ipAddress) { + // validate ip address + if (IP_PATTERN.matcher(ipAddress).matches()) { + Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); - /** - * Sets the value to consider a message as a duplicate, in ms. (default: 240000, 4 minutes). - * - * @param duplicateTimer the amount of time, in ms. - */ - void _Parameters_setDuplicateTimer(long duplicateTimer); + List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); + AppConfiguration newIPAddress = getClientConfiguration().add(OwnIPAddress, ipAddress); + newIPAddressesConfig.add(newIPAddress); - // Parameters : Timeouts ----------------------------------------------- + getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); - /** - * Sets the timeout for general Diameter messages, in ms. (default: 60000, 1 minute). - * - * @param messageTimeout the amount of time, in ms. - */ - void _Parameters_setMessageTimeout(long messageTimeout); + if (logger.isInfoEnabled()) { + logger.info("Local Peer IP Address successfully changed to " + ipAddress + ". Restart to Diameter stack is needed to apply changes."); + } + } + else { + throw new RuntimeException(new IllegalArgumentException("Invalid IP address entered (" + ipAddress + ")")); + } + } - /** - * Sets the timeout for stopping the stack. (default: 10000, 10 seconds). - * - * @param stopTimeout the amount of time, in ms. + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_removeIPAddress(java.lang.String) */ - void _Parameters_setStopTimeout(long stopTimeout); - - /** - * Sets the timeout for CEA messages. (default: 10000, 10 seconds). - * - * @param ceaTimeout the amount of time, in ms. + @Override + public void _LocalPeer_removeIPAddress(String ipAddress) { + Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); + + Configuration ipAddressToRemove = null; + + List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); + for (Configuration curIPAddress : newIPAddressesConfig) { + if (curIPAddress.getStringValue(OwnIPAddress.ordinal(), DEFAULT_STRING).equals(ipAddress)) { + ipAddressToRemove = curIPAddress; + break; + } + } + + if (ipAddressToRemove != null) { + newIPAddressesConfig.remove(ipAddressToRemove); + + getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); + + if (logger.isInfoEnabled()) { + logger.info("Local Peer IP Address " + ipAddress + " successfully added. Restart to Diameter stack is needed to apply changes."); + } + } + else { + if (logger.isInfoEnabled()) { + logger.info("Local Peer IP Address " + ipAddress + " not found. No changes were made."); + } + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setRealm(java.lang.String) */ - void _Parameters_setCeaTimeout(long ceaTimeout); - - /** - * Sets the timeout for inactiveness. (default: 20000, 20 seconds). - * - * @param iacTimeout the amount of time, in ms. + @Override + public void _LocalPeer_setRealm(String realm) { + getMutableConfiguration().setStringValue(OwnRealm.ordinal(), realm); + + if (logger.isInfoEnabled()) { + logger.info("Local Peer Realm successfully changed to '" + realm + "'. Restart to Diameter stack is needed to apply changes."); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setURI(java.lang.String) */ - void _Parameters_setIacTimeout(long iacTimeout); - - /** - * Sets the timeout for DWA messages. (default: 10000, 10 seconds). - * - * @param dwaTimeout the amount of time, in ms. + @Override + public void _LocalPeer_setURI(String uri) { + // validate uri + try { + new URI(uri); + + getMutableConfiguration().setStringValue(OwnDiameterURI.ordinal(), uri); + + if (logger.isInfoEnabled()) { + logger.info("Local Peer URI successfully changed to '" + uri + "'. Restart to Diameter stack is needed to apply changes."); + } + } + catch (URISyntaxException use) { + throw new RuntimeException(use); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setVendorId(java.lang.String) */ - void _Parameters_setDwaTimeout(long dwaTimeout); - - /** - * Sets the timeout for DPA messages. (default: 5000, 5 seconds). - * - * @param dpaTimeout the amount of time, in ms. + @Override + public void _LocalPeer_setVendorId(long vendorId) { + // validate vendor-id + try { + getMutableConfiguration().setLongValue(OwnVendorID.ordinal(), vendorId); + if (logger.isInfoEnabled()) { + logger.info("Local Peer Vendor-Id successfully changed to '" + vendorId + "'. Restart to Diameter stack is needed to apply changes."); + } + } + catch (NumberFormatException nfe) { + throw new RuntimeException(nfe); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int) */ - void _Parameters_setDpaTimeout(long dpaTimeout); - - /** - * Sets the timeout for reconnecting. (default: 10000, 10 seconds). - * - * @param recTimeout the amount of time, in ms. - */ - void _Parameters_setRecTimeout(long recTimeout); - - void _Parameters_setConcurrentEntity(String name, String desc, Integer size); - - void _Parameters_setStatisticLoggerDelay(long delay); - - void _Parameters_setStatisticLoggerPause(long pause); - - // Network : Peers ----------------------------------------------------- - - /** - * Adds a peer definition to the stack. Same as element in XML Configuration. - * - * @param name the name/uri of the peer - * @param attemptConnect indicates if the stack should try to connect to this peer or wait for incoming connection - * @param rating the peer rating for decision on message routing - */ - void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating); - - /** - * Removes a peer definition from stack. - * - * @param name the name/uri of the peer - */ - void _Network_Peers_removePeer(String name); - - // Network : Realms ---------------------------------------------------- - - /** - * Adds a new Realm to the stack. Same as element in XML Configuration. - * - * @param name the name of the Realm - * @param peers the Realm peer hosts, separated by comma - * @param appVendorId the vendor-id of the application supported by this realm - * @param appAcctId the accounting-id of the application supported by this realm - * @param appAuthId the authorization-id of the application supported by this realm - */ - void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId); - - void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, String agentConfiguration, - boolean isDynamic, int expTime); - - /** - * Removes a Realm from the stack. - * - * @param name the name of the Realm + @Override + public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) { + try { + NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); + /*Peer p =*/ n.addPeer(name, "", attemptConnect); // FIXME: This requires realm... + } + catch (IllegalArgumentException e) { + logger.warn(e.getMessage()); + } + catch (InternalException e) { + throw new RuntimeException("Failed to add peer with name '" + name + "'", e); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_removePeer(java.lang.String) */ - void _Network_Realms_removeRealm(String name); - - /** - * Adds a new Peer host to the Realm - * - * @param realmName the name of the Realm - * @param peerName the name/host of the Peer to be added - * @param attemptConnecting either try or not to connect the peer (client/server) - */ - void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnecting); - - /** - * Removes a Peer host from the Realm - * - * @param realmName the name of the Realm - * @param peerName the name/host of the Peer to be removed - */ - void _Network_Realms_removePeerFromRealm(String realmName, String peerName); - - // Stack Operation ----------------------------------------------------- - - /** - * Operation to stop the stack. - * - */ - void stopStack(int disconnectCause); - - /** - * Operation to start the stack. - * - */ - void startStack(); - - // Validation ---------------------------------------------------------- - - /** - * Sets whether validation on Diameter messages/AVPs should be performed or not. - * - * @param enableValidation flag indicating if validation should be performed - */ - void _Validation_setEnabled(boolean enableValidation); - - // Configuration Dump -------------------------------------------------- - - /** - * Dumps full stack configuration. - * - * @return a String with stack configuration - */ - String dumpStackConfiguration(); - - // Information dump methods -------------------------------------------- - - String _LocalPeer_getProductName(); - - Long _LocalPeer_getVendorId(); - - Long _LocalPeer_getFirmware(); - - String _LocalPeer_getURI(); - - String _LocalPeer_getRealmName(); - - InetAddress[] _LocalPeer_getIPAddresses(); - - Set _LocalPeer_getCommonApplicationIds(); - - String[] _Network_Realms_getRealms(); - - String[] _Network_Realms_getRealmPeers(String realmName); - - boolean _LocalPeer_isActive(); - - boolean _Network_Peers_isPeerConnected(String name); + @Override + public void _Network_Peers_removePeer(String name) { + try { + MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); + n.removePeer(name); + } + catch (InternalException e) { + throw new RuntimeException("Failed to remove peer with name '" + name + "'", e); + } + } + + @Override + public void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnect) { + try { + NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); + /*Peer p =*/ n.addPeer(peerName, realmName, attemptConnect); + } + catch (IllegalArgumentException e) { + logger.warn(e.getMessage()); + } + catch (InternalException e) { + throw new RuntimeException("Failed to add peer with name '" + peerName + "' to realm '" + realmName + "'", e); + } + } + + @Override + public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, + String agentConfiguration, boolean isDynamic, int expTime) { + try { + org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); + ApplicationId appId = appAcctId == 0 ? org.jdiameter.api.ApplicationId.createByAuthAppId(appVendorId, appAuthId) : + org.jdiameter.api.ApplicationId.createByAccAppId(appVendorId, appAcctId); + org.jdiameter.api.Realm r = n.addRealm(name, appId, LocalAction.valueOf(localAction), agentConfiguration, isDynamic, expTime); + for (String peer : peers.split(",")) { + ((IRealm) r).addPeerName(peer); + } + } + catch (InternalException e) { + throw new RuntimeException("Failed to add realm with name '" + name + "'.", e); + } + } + + @Override + public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId) { + _Network_Realms_addRealm(name, peers, appVendorId, appAcctId, appAuthId, "LOCAL", null, false, 1); + } + + @Override + public void _Network_Realms_removePeerFromRealm(String realmName, String peerName) { + try { + IRealmTable rt = stack.unwrap(IRealmTable.class); + for (org.jdiameter.api.Realm r : rt.getRealms()) { + if (r.getName().equals(realmName)) { + ((IRealm) r).removePeerName(peerName); + } + } + } + catch (InternalException e) { + throw new RuntimeException("Failed to add peer '" + peerName + "' from realm with '" + realmName + "'.", e); + } + } + + @Override + public void _Network_Realms_removeRealm(String name) { + try { + org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); + n.remRealm(name); + } + catch (InternalException e) { + throw new RuntimeException("Failed to remove realm '" + name + "'.", e); + } + } + + @Override + public void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer) { + getMutableConfiguration().setBooleanValue(AcceptUndefinedPeer.ordinal(), acceptUndefinedPeer); + } + + @Override + public void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn) { + getMutableConfiguration().setBooleanValue(UseUriAsFqdn.ordinal(), useUriAsFqdn); + } + + @Override + public void _Parameters_setDuplicateTimer(long duplicateTimer) { + getMutableConfiguration().setLongValue(DuplicateTimer.ordinal(), duplicateTimer); + } + + @Override + public void _Parameters_setMessageTimeout(long messageTimeout) { + getMutableConfiguration().setLongValue(MessageTimeOut.ordinal(), messageTimeout); + } + + @Override + public void _Parameters_setStopTimeout(long stopTimeout) { + getMutableConfiguration().setLongValue(StopTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setCeaTimeout(long stopTimeout) { + getMutableConfiguration().setLongValue(CeaTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setIacTimeout(long stopTimeout) { + getMutableConfiguration().setLongValue(IacTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setDwaTimeout(long stopTimeout) { + getMutableConfiguration().setLongValue(DwaTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setDpaTimeout(long stopTimeout) { + getMutableConfiguration().setLongValue(DpaTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setRecTimeout(long stopTimeout) { + getMutableConfiguration().setLongValue(RecTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setConcurrentEntity(String name, String desc, Integer size) { + for (Configuration c : getMutableConfiguration().getChildren(Concurrent.ordinal())) { + if (name.equals(c.getStringValue(ConcurrentEntityName.ordinal(), null))) { + ((AppConfiguration) c).add(ConcurrentEntityPoolSize, size); + if (desc != null) { + ((AppConfiguration) c).add(ConcurrentEntityDescription, desc); + } + } + } + } + @Override + public void _Parameters_setStatisticLoggerDelay(long delay) { + getMutableConfiguration().setLongValue(StatisticsLoggerDelay.ordinal(), delay); + } + + @Override + public void _Parameters_setStatisticLoggerPause(long pause) { + getMutableConfiguration().setLongValue(StatisticsLoggerPause.ordinal(), pause); + } + + @Override + public void _Validation_setEnabled(boolean enableValidation) { + ((DictionaryImpl) DictionarySingleton.getDictionary()).setEnabled(enableValidation) ; + } + + @Override + public String dumpStackConfiguration() { + return getMutableConfiguration().toString(); + } + + @Override + public void startStack() { + try { + this.stack.start(); + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public void stopStack(int disconnectCause) { + try { + this.stack.stop(getMutableConfiguration().getLongValue(StopTimeOut.ordinal(), 10000L), TimeUnit.MILLISECONDS, disconnectCause); + } + catch (Exception e) { + throw new RuntimeException(e); + } + } + + // Getters ------------------------------------------------------------- // + + @Override + public String _LocalPeer_getProductName() { + return this.stack.getMetaData().getLocalPeer().getProductName(); + } + + @Override + public Long _LocalPeer_getVendorId() { + return this.stack.getMetaData().getLocalPeer().getVendorId(); + } + + @Override + public Long _LocalPeer_getFirmware() { + return this.stack.getMetaData().getLocalPeer().getFirmware(); + } + + @Override + public String _LocalPeer_getURI() { + return this.stack.getMetaData().getLocalPeer().getUri().toString(); + } + + @Override + public String _LocalPeer_getRealmName() { + return this.stack.getMetaData().getLocalPeer().getRealmName(); + } + + @Override + public InetAddress[] _LocalPeer_getIPAddresses() { + return this.stack.getMetaData().getLocalPeer().getIPAddresses(); + } + + @Override + public Set _LocalPeer_getCommonApplicationIds() { + return this.stack.getMetaData().getLocalPeer().getCommonApplications(); + } + + @Override + public String[] _Network_Realms_getRealms() { + Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); + String[] realmNames = new String[realmEntries.length]; + + for (int i = 0; i < realmEntries.length; i++) { + realmNames[i] = realmEntries[i].getStringValue(RealmName.ordinal(), DEFAULT_STRING); + } + + return realmNames; + } + + @Override + public String[] _Network_Realms_getRealmPeers(String realmName) { + Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); + String[] realmHosts = new String[realmEntries.length]; + + for (Configuration realmEntry : realmEntries) { + if (realmEntry.getStringValue(RealmName.ordinal(), DEFAULT_STRING).equals(realmName)) { + + String realmHostsString = realmEntry.getStringValue(RealmHosts.ordinal(), DEFAULT_STRING); + if (!realmHostsString.equals(DEFAULT_STRING)) { + realmHosts = realmHostsString.replaceAll(" ", "").split(","); + } + } + } + + return realmHosts; + } + + @Override + public DiameterConfiguration getDiameterConfiguration() { + return new DiameterConfiguration(stack); + } + + @Override + public boolean _LocalPeer_isActive() { + return this.stack.isActive(); + } + + @Override + public boolean _Network_Peers_isPeerConnected(String name) { + try { + MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); + PeerImpl p = ((PeerImpl) n.getPeer(name)); + return p != null ? p.getContext().isConnected() : false; + } + catch (Exception e) { + throw new RuntimeException("Failed to get connection availability for peer with name '" + "'.", e); + } + } } diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7Bean.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7Bean.java deleted file mode 100644 index 1666e5f49..000000000 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7Bean.java +++ /dev/null @@ -1,970 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2015, Telestax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.stack; - -import static org.jdiameter.client.impl.helpers.Parameters.CeaTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.Concurrent; -import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityDescription; -import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityName; -import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityPoolSize; -import static org.jdiameter.client.impl.helpers.Parameters.DpaTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.DwaTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.IacTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.MessageTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.OwnDiameterURI; -import static org.jdiameter.client.impl.helpers.Parameters.OwnIPAddress; -import static org.jdiameter.client.impl.helpers.Parameters.OwnRealm; -import static org.jdiameter.client.impl.helpers.Parameters.OwnVendorID; -import static org.jdiameter.client.impl.helpers.Parameters.RealmEntry; -import static org.jdiameter.client.impl.helpers.Parameters.RealmTable; -import static org.jdiameter.client.impl.helpers.Parameters.RecTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerDelay; -import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerPause; -import static org.jdiameter.client.impl.helpers.Parameters.StopTimeOut; -import static org.jdiameter.client.impl.helpers.Parameters.UseUriAsFqdn; -import static org.jdiameter.server.impl.helpers.Parameters.AcceptUndefinedPeer; -import static org.jdiameter.server.impl.helpers.Parameters.DuplicateTimer; -import static org.jdiameter.server.impl.helpers.Parameters.OwnIPAddresses; -import static org.jdiameter.server.impl.helpers.Parameters.RealmHosts; -import static org.jdiameter.server.impl.helpers.Parameters.RealmName; - -import java.io.InputStream; -import java.net.InetAddress; -import java.net.URI; -import java.net.URISyntaxException; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Set; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.ReentrantLock; -import java.util.regex.Pattern; - -import javax.annotation.PostConstruct; -import javax.annotation.PreDestroy; -import javax.ejb.Singleton; -import javax.ejb.Startup; - -import org.jdiameter.api.Answer; -import org.jdiameter.api.ApplicationAlreadyUseException; -import org.jdiameter.api.ApplicationId; -import org.jdiameter.api.Avp; -import org.jdiameter.api.Configuration; -import org.jdiameter.api.DisconnectCause; -import org.jdiameter.api.EventListener; -import org.jdiameter.api.InternalException; -import org.jdiameter.api.LocalAction; -import org.jdiameter.api.Message; -import org.jdiameter.api.MutableConfiguration; -import org.jdiameter.api.MutablePeerTable; -import org.jdiameter.api.Network; -import org.jdiameter.api.NetworkReqListener; -import org.jdiameter.api.PeerTable; -import org.jdiameter.api.Request; -import org.jdiameter.api.ResultCode; -import org.jdiameter.api.Session; -import org.jdiameter.api.Stack; -import org.jdiameter.client.api.controller.IRealm; -import org.jdiameter.client.api.controller.IRealmTable; -import org.jdiameter.client.impl.DictionarySingleton; -import org.jdiameter.client.impl.controller.PeerImpl; -import org.jdiameter.client.impl.helpers.AppConfiguration; -import org.jdiameter.common.impl.validation.DictionaryImpl; -import org.jdiameter.server.impl.NetworkImpl; -import org.jdiameter.server.impl.StackImpl; -import org.jdiameter.server.impl.helpers.XMLConfiguration; -import org.mobicents.diameter.api.DiameterMessageFactory; -import org.mobicents.diameter.api.DiameterProvider; -import org.mobicents.diameter.dictionary.AvpDictionary; -import org.mobicents.diameter.stack.management.DiameterConfiguration; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Alexandre Mendonca - */ -@Startup -@Singleton(name = "mux") -public class DiameterStackMultiplexerAS7Bean implements DiameterStackMultiplexerAS7, DiameterProvider, NetworkReqListener, EventListener, - DiameterMessageFactory { - - private static final Logger logger = LoggerFactory.getLogger(DiameterStackMultiplexerAS7Bean.class); - - protected Stack stack = null; - - protected HashMap> listenerToAppId = - new HashMap>(3); - protected HashMap appIdToListener = new HashMap(3); - - // This is for synch - protected ReentrantLock lock = new ReentrantLock(); - - protected DiameterProvider provider; - - // ===== STACK MANAGEMENT ===== - - private void initStack() throws Exception { - initStack(this.getClass().getClassLoader().getResourceAsStream("config/jdiameter-config.xml")); - } - - private void initStack(InputStream is) throws Exception { - try { - // Create and configure stack - this.stack = new StackImpl(); - - // Load the configuration - Configuration config = new XMLConfiguration(is); - - this.stack.init(config); - - Network network = stack.unwrap(Network.class); - - Set appIds = stack.getMetaData().getLocalPeer().getCommonApplications(); - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Supporting {} applications.", appIds.size()); - } - //network.addNetworkReqListener(this, ApplicationId.createByAccAppId(193, 19302)); - - for (org.jdiameter.api.ApplicationId appId : appIds) { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Adding Listener for [{}].", appId); - } - network.addNetworkReqListener(this, appId); - - if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAcctAppId(), null); - } - else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAuthAppId(), null); - } - } - - try { - if (logger.isInfoEnabled()) { - logger.info("Parsing AVP Dictionary file..."); - } - AvpDictionary.INSTANCE.parseDictionary(Thread.currentThread().getContextClassLoader().getResourceAsStream("dictionary.xml")); - if (logger.isInfoEnabled()) { - logger.info("AVP Dictionary file successfuly parsed!"); - } - } - catch (Exception e) { - logger.error("Error while parsing dictionary file.", e); - } - - this.stack.start(); - } - finally { - if (is != null) { - is.close(); - } - - is = null; - } - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Successfully initialized stack."); - } - } - - private void doStopStack(int disconnectCause) throws Exception { - try { - if (logger.isInfoEnabled()) { - logger.info("Stopping Diameter Mux Stack..."); - } - - stack.stop(10, TimeUnit.SECONDS, disconnectCause); - - if (logger.isInfoEnabled()) { - logger.info("Diameter Mux Stack Stopped Successfully."); - } - } - catch (Exception e) { - logger.error("Failure while stopping stack", e); - } - - stack.destroy(); - } - - private DiameterListener findListener(Message message) { - List appIds = message.getApplicationIdAvps(); - - if (appIds.size() > 0) { - for (org.jdiameter.api.ApplicationId appId : appIds) { - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: AVP AppId [" + appId + "]"); - } - - DiameterListener listener; - - Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); - - if ((listener = this.appIdToListener.get(appIdValue)) != null) { - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); - } - - return listener; - } - } - } - else { - Long appId = message.getApplicationId(); - - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: Header AppId [" + appId + "]"); - } - - DiameterListener listener; - - if ((listener = this.appIdToListener.get(appId)) != null) { - if (logger.isDebugEnabled()) { - logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); - } - - return listener; - } - } - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: findListener :: No Listener Found."); - } - - return null; - } - - // ===== NetworkReqListener IMPLEMENTATION ===== - - @Override - public Answer processRequest(Request request) { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: processRequest :: Command-Code [" + request.getCommandCode() + "]"); - } - - DiameterListener listener = findListener(request); - - if (listener != null) { - return listener.processRequest(request); - } - else { - try { - Answer answer = request.createAnswer(ResultCode.APPLICATION_UNSUPPORTED); - //this.stack.getSessionFactory().getNewRawSession().send(answer); - return answer; - } - catch (Exception e) { - logger.error("Failed to create APPLICATION UNSUPPORTED answer.", e); - } - } - return null; - } - - // ===== EventListener IMPLEMENTATION ===== - - @Override - public void receivedSuccessMessage(Request request, Answer answer) { - DiameterListener listener = findListener(request); - - if (listener != null) { - listener.receivedSuccessMessage(request, answer); - } - } - - @Override - public void timeoutExpired(Request request) { - DiameterListener listener = findListener(request); - - if (listener != null) { - listener.timeoutExpired(request); - } - } - - // ===== SERVICE LIFECYCLE MANAGEMENT ===== - - @PostConstruct - protected void startService() throws Exception { - initStack(); - } - - @PreDestroy - protected void stopService() throws Exception { - doStopStack(DisconnectCause.REBOOTING); - } - - @Override - public String sendMessage(Message message) { - try { - Avp sessionId = null; - Session session = null; - - if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { - session = stack.getSessionFactory().getNewSession(); - } - else { - session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); - } - - session.send(message); - - return session.getSessionId(); - } - catch (Exception e) { - logger.error("", e); - } - - return null; - } - - @Override - public Message sendMessageSync(Message message) { - try { - Avp sessionId = null; - Session session = null; - - if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { - session = stack.getSessionFactory().getNewSession(); - } - else { - session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); - } - - Future answer = session.send(message); - - return answer.get(); - } - catch (Exception e) { - logger.error("", e); - } - - return null; - } - - @Override - public Message createMessage(boolean isRequest, int commandCode, long applicationId) { - try { - Message message = this.stack.getSessionFactory().getNewRawSession(). - createMessage(commandCode, org.jdiameter.api.ApplicationId.createByAccAppId(applicationId), new Avp[]{}); - message.setRequest(isRequest); - - return message; - } - catch (Exception e) { - logger.error("Failure while creating message.", e); - } - - return null; - } - - @Override - public Message createRequest(int commandCode, long applicationId) { - return createMessage(true, commandCode, applicationId); - } - - @Override - public Message createAnswer(int commandCode, long applicationId) { - return createMessage(false, commandCode, applicationId); - } - - // ===== MBEAN OPERATIONS ===== - - @Override - public DiameterStackMultiplexerAS7 getMultiplexerMBean() { - return this; - } - - @Override - public DiameterMessageFactory getMessageFactory() { - return this; - } - - @Override - public DiameterProvider getProvider() { - return this; - } - - @Override - public Stack getStack() { - return new DiameterStackProxy(this.stack); - } - - @Override - public void registerListener(DiameterListener listener, org.jdiameter.api.ApplicationId[] appIds) throws IllegalStateException { - if (listener == null) { - logger.warn("Trying to register a null Listener. Give up..."); - return; - } - - int curAppIdIndex = 0; - - try { - lock.lock(); - - // Register the selected appIds in the stack - Network network = stack.unwrap(Network.class); - - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Registering " + appIds.length + " applications."); - } - - for (; curAppIdIndex < appIds.length; curAppIdIndex++) { - org.jdiameter.api.ApplicationId appId = appIds[curAppIdIndex]; - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: Adding Listener for [" + appId + "]."); - } - network.addNetworkReqListener(this, appId); - - if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAcctAppId(), listener); - } - else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { - this.appIdToListener.put(appId.getAuthAppId(), listener); - } - } - - // And add the listener and it's holder - Collection registeredAppIds = this.listenerToAppId.get(listener); - - // Merge the existing (if any) with new. - if (registeredAppIds != null) { - registeredAppIds.addAll(Arrays.asList(appIds)); - } - else { - this.listenerToAppId.put(listener, Arrays.asList(appIds)); - } - } - catch (ApplicationAlreadyUseException aaue) { - // Let's remove what we've done so far... - try { - Network network = stack.unwrap(Network.class); - - for (; curAppIdIndex >= 0; curAppIdIndex--) { - ApplicationId appId = appIds[curAppIdIndex]; - Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); - - // Remove the app id from map - this.appIdToListener.remove(appIdValue); - - // Unregister it from stack listener - network.removeNetworkReqListener(appId); - } - } - catch (Exception e) { - logger.error("", e); - } - } - catch (Exception e) { - logger.error("", e); - } - finally { - lock.unlock(); - } - } - - @Override - public void unregisterListener(DiameterListener listener) { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: unregisterListener :: Listener [" + listener + "]"); - } - - if (listener == null) { - logger.warn("Diameter Stack Mux :: unregisterListener :: Trying to unregister a null Listener. Give up..."); - return; - } - - try { - lock.lock(); - - Collection appIds = this.listenerToAppId.remove(listener); - - if (appIds == null) { - logger.warn("Diameter Stack Mux :: unregisterListener :: Listener has no App-Ids registered. Give up..."); - return; - } - - Network network = stack.unwrap(Network.class); - - for (org.jdiameter.api.ApplicationId appId : appIds) { - try { - if (logger.isInfoEnabled()) { - logger.info("Diameter Stack Mux :: unregisterListener :: Unregistering AppId [" + appId + "]"); - } - - Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); - - // Remove the appid from map - this.appIdToListener.remove(appIdValue); - - // and unregister the listener from stack - network.removeNetworkReqListener(appId); - } - catch (Exception e) { - logger.error("", e); - } - } - } - catch (InternalException ie) { - logger.error("", ie); - } - finally { - lock.unlock(); - } - } - - // management operations ---------------------------------------------- - - /* - * -- MutableConfiguration Parameters -- - * Levels Parameters name - * Runtime - * y DuplicateTimer - * y AcceptUndefinedPeer - * y MessageTimeOut - * y StopTimeOut - * y CeaTimeOut - * y IacTimeOut - * y DwaTimeOut - * y DpaTimeOut - * y RecTimeOut - * y PeerTable, Peer, PeerName, PeerRating, PeerAttemptConnection (by NetWork interface) - * y RealmTable, Realm, RealmEntry RealmName, RealmHosts, RealmLocalAction, RealmEntryIsDynamic, RealmEntryExpTime (by NetWork interface) - * Restart stack - * y OwnDiameterURI - * y OwnIPAddresses, OwnIPAddress - * y OwnRealm - * y OwnVendorID - * n OwnProductName - * n OwnFirmwareRevision - * n ApplicationId, VendorId, AuthApplId, AcctApplId - * Not changeable - * n OverloadMonitor, OverloadMonitorEntry, OverloadMonitorData, OverloadEntryIndex, OverloadEntryhighThreshold, OverloadEntrylowThreshold - * n DuplicateProtection - * n QueueSize - */ - - private final String DEFAULT_STRING = "default_string"; - - private MutableConfiguration getMutableConfiguration() { - return (MutableConfiguration) stack.getMetaData().getConfiguration(); - } - - private AppConfiguration getClientConfiguration() { - return org.jdiameter.client.impl.helpers.EmptyConfiguration.getInstance(); - } - - final Pattern IP_PATTERN = Pattern.compile("\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" - + "\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); - - @Override - public void _LocalPeer_addIPAddress(String ipAddress) { - // validate ip address - if (IP_PATTERN.matcher(ipAddress).matches()) { - Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); - - List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); - AppConfiguration newIPAddress = getClientConfiguration().add(OwnIPAddress, ipAddress); - newIPAddressesConfig.add(newIPAddress); - - getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer IP Address successfully changed to " + ipAddress + ". Restart to Diameter stack is needed to apply changes."); - } - } - else { - throw new RuntimeException(new IllegalArgumentException("Invalid IP address entered (" + ipAddress + ")")); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_removeIPAddress(java.lang.String) - */ - @Override - public void _LocalPeer_removeIPAddress(String ipAddress) { - Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); - - Configuration ipAddressToRemove = null; - - List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); - for (Configuration curIPAddress : newIPAddressesConfig) { - if (curIPAddress.getStringValue(OwnIPAddress.ordinal(), DEFAULT_STRING).equals(ipAddress)) { - ipAddressToRemove = curIPAddress; - break; - } - } - - if (ipAddressToRemove != null) { - newIPAddressesConfig.remove(ipAddressToRemove); - - getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer IP Address " + ipAddress + " successfully added. Restart to Diameter stack is needed to apply changes."); - } - } - else { - if (logger.isInfoEnabled()) { - logger.info("Local Peer IP Address " + ipAddress + " not found. No changes were made."); - } - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setRealm(java.lang.String) - */ - @Override - public void _LocalPeer_setRealm(String realm) { - getMutableConfiguration().setStringValue(OwnRealm.ordinal(), realm); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer Realm successfully changed to '" + realm + "'. Restart to Diameter stack is needed to apply changes."); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setURI(java.lang.String) - */ - @Override - public void _LocalPeer_setURI(String uri) { - // validate uri - try { - new URI(uri); - - getMutableConfiguration().setStringValue(OwnDiameterURI.ordinal(), uri); - - if (logger.isInfoEnabled()) { - logger.info("Local Peer URI successfully changed to '" + uri + "'. Restart to Diameter stack is needed to apply changes."); - } - } - catch (URISyntaxException use) { - throw new RuntimeException(use); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setVendorId(java.lang.String) - */ - @Override - public void _LocalPeer_setVendorId(long vendorId) { - // validate vendor-id - try { - getMutableConfiguration().setLongValue(OwnVendorID.ordinal(), vendorId); - if (logger.isInfoEnabled()) { - logger.info("Local Peer Vendor-Id successfully changed to '" + vendorId + "'. Restart to Diameter stack is needed to apply changes."); - } - } - catch (NumberFormatException nfe) { - throw new RuntimeException(nfe); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int) - */ - @Override - public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) { - try { - NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); - /*Peer p =*/ n.addPeer(name, "", attemptConnect); // FIXME: This requires realm... - } - catch (IllegalArgumentException e) { - logger.warn(e.getMessage()); - } - catch (InternalException e) { - throw new RuntimeException("Failed to add peer with name '" + name + "'", e); - } - } - - /* - * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_removePeer(java.lang.String) - */ - @Override - public void _Network_Peers_removePeer(String name) { - try { - MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); - n.removePeer(name); - } - catch (InternalException e) { - throw new RuntimeException("Failed to remove peer with name '" + name + "'", e); - } - } - - @Override - public void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnect) { - try { - NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); - /*Peer p =*/ n.addPeer(peerName, realmName, attemptConnect); - } - catch (IllegalArgumentException e) { - logger.warn(e.getMessage()); - } - catch (InternalException e) { - throw new RuntimeException("Failed to add peer with name '" + peerName + "' to realm '" + realmName + "'", e); - } - } - - @Override - public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, - String agentConfiguration, boolean isDynamic, int expTime) { - try { - org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); - ApplicationId appId = appAcctId == 0 ? org.jdiameter.api.ApplicationId.createByAuthAppId(appVendorId, appAuthId) : - org.jdiameter.api.ApplicationId.createByAccAppId(appVendorId, appAcctId); - org.jdiameter.api.Realm r = n.addRealm(name, appId, LocalAction.valueOf(localAction), agentConfiguration, isDynamic, expTime); - for (String peer : peers.split(",")) { - ((IRealm) r).addPeerName(peer); - } - } - catch (InternalException e) { - throw new RuntimeException("Failed to add realm with name '" + name + "'.", e); - } - } - - @Override - public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId) { - _Network_Realms_addRealm(name, peers, appVendorId, appAcctId, appAuthId, "LOCAL", null, false, 1); - } - - @Override - public void _Network_Realms_removePeerFromRealm(String realmName, String peerName) { - try { - IRealmTable rt = stack.unwrap(IRealmTable.class); - for (org.jdiameter.api.Realm r : rt.getRealms()) { - if (r.getName().equals(realmName)) { - ((IRealm) r).removePeerName(peerName); - } - } - } - catch (InternalException e) { - throw new RuntimeException("Failed to add peer '" + peerName + "' from realm with '" + realmName + "'.", e); - } - } - - @Override - public void _Network_Realms_removeRealm(String name) { - try { - org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); - n.remRealm(name); - } - catch (InternalException e) { - throw new RuntimeException("Failed to remove realm '" + name + "'.", e); - } - } - - @Override - public void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer) { - getMutableConfiguration().setBooleanValue(AcceptUndefinedPeer.ordinal(), acceptUndefinedPeer); - } - - @Override - public void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn) { - getMutableConfiguration().setBooleanValue(UseUriAsFqdn.ordinal(), useUriAsFqdn); - } - - @Override - public void _Parameters_setDuplicateTimer(long duplicateTimer) { - getMutableConfiguration().setLongValue(DuplicateTimer.ordinal(), duplicateTimer); - } - - @Override - public void _Parameters_setMessageTimeout(long messageTimeout) { - getMutableConfiguration().setLongValue(MessageTimeOut.ordinal(), messageTimeout); - } - - @Override - public void _Parameters_setStopTimeout(long stopTimeout) { - getMutableConfiguration().setLongValue(StopTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setCeaTimeout(long stopTimeout) { - getMutableConfiguration().setLongValue(CeaTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setIacTimeout(long stopTimeout) { - getMutableConfiguration().setLongValue(IacTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setDwaTimeout(long stopTimeout) { - getMutableConfiguration().setLongValue(DwaTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setDpaTimeout(long stopTimeout) { - getMutableConfiguration().setLongValue(DpaTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setRecTimeout(long stopTimeout) { - getMutableConfiguration().setLongValue(RecTimeOut.ordinal(), stopTimeout); - } - - @Override - public void _Parameters_setConcurrentEntity(String name, String desc, Integer size) { - for (Configuration c : getMutableConfiguration().getChildren(Concurrent.ordinal())) { - if (name.equals(c.getStringValue(ConcurrentEntityName.ordinal(), null))) { - ((AppConfiguration) c).add(ConcurrentEntityPoolSize, size); - if (desc != null) { - ((AppConfiguration) c).add(ConcurrentEntityDescription, desc); - } - } - } - } - @Override - public void _Parameters_setStatisticLoggerDelay(long delay) { - getMutableConfiguration().setLongValue(StatisticsLoggerDelay.ordinal(), delay); - } - - @Override - public void _Parameters_setStatisticLoggerPause(long pause) { - getMutableConfiguration().setLongValue(StatisticsLoggerPause.ordinal(), pause); - } - - @Override - public void _Validation_setEnabled(boolean enableValidation) { - ((DictionaryImpl) DictionarySingleton.getDictionary()).setEnabled(enableValidation) ; - } - - @Override - public String dumpStackConfiguration() { - return getMutableConfiguration().toString(); - } - - @Override - public void startStack() { - try { - this.stack.start(); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - @Override - public void stopStack(int disconnectCause) { - try { - this.stack.stop(getMutableConfiguration().getLongValue(StopTimeOut.ordinal(), 10000L), TimeUnit.MILLISECONDS, disconnectCause); - } - catch (Exception e) { - throw new RuntimeException(e); - } - } - - // Getters ------------------------------------------------------------- // - - @Override - public String _LocalPeer_getProductName() { - return this.stack.getMetaData().getLocalPeer().getProductName(); - } - - @Override - public Long _LocalPeer_getVendorId() { - return this.stack.getMetaData().getLocalPeer().getVendorId(); - } - - @Override - public Long _LocalPeer_getFirmware() { - return this.stack.getMetaData().getLocalPeer().getFirmware(); - } - - @Override - public String _LocalPeer_getURI() { - return this.stack.getMetaData().getLocalPeer().getUri().toString(); - } - - @Override - public String _LocalPeer_getRealmName() { - return this.stack.getMetaData().getLocalPeer().getRealmName(); - } - - @Override - public InetAddress[] _LocalPeer_getIPAddresses() { - return this.stack.getMetaData().getLocalPeer().getIPAddresses(); - } - - @Override - public Set _LocalPeer_getCommonApplicationIds() { - return this.stack.getMetaData().getLocalPeer().getCommonApplications(); - } - - @Override - public String[] _Network_Realms_getRealms() { - Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); - String[] realmNames = new String[realmEntries.length]; - - for (int i = 0; i < realmEntries.length; i++) { - realmNames[i] = realmEntries[i].getStringValue(RealmName.ordinal(), DEFAULT_STRING); - } - - return realmNames; - } - - @Override - public String[] _Network_Realms_getRealmPeers(String realmName) { - Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); - String[] realmHosts = new String[realmEntries.length]; - - for (Configuration realmEntry : realmEntries) { - if (realmEntry.getStringValue(RealmName.ordinal(), DEFAULT_STRING).equals(realmName)) { - - String realmHostsString = realmEntry.getStringValue(RealmHosts.ordinal(), DEFAULT_STRING); - if (!realmHostsString.equals(DEFAULT_STRING)) { - realmHosts = realmHostsString.replaceAll(" ", "").split(","); - } - } - } - - return realmHosts; - } - - @Override - public DiameterConfiguration getDiameterConfiguration() { - return new DiameterConfiguration(stack); - } - - @Override - public boolean _LocalPeer_isActive() { - return this.stack.isActive(); - } - - @Override - public boolean _Network_Peers_isPeerConnected(String name) { - try { - MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); - PeerImpl p = ((PeerImpl) n.getPeer(name)); - return p != null ? p.getContext().isConnected() : false; - } - catch (Exception e) { - throw new RuntimeException("Failed to get connection availability for peer with name '" + "'.", e); - } - } - -} diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java new file mode 100644 index 000000000..702e918b8 --- /dev/null +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java @@ -0,0 +1,290 @@ +/* + * TeleStax, Open Source Cloud Communications + * + * Copyright 2011-2015, Telestax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack; + +import java.net.InetAddress; +import java.util.Set; + +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.Stack; +import org.mobicents.diameter.api.DiameterMessageFactory; +import org.mobicents.diameter.api.DiameterProvider; +import org.mobicents.diameter.stack.management.DiameterConfiguration; + +/** + * + * @author Alexandre Mendonca + */ + +public interface DiameterStackMultiplexerAS7MBean { + + String MBEAN_NAME_PREFIX = "diameter:Service=DiameterStackMultiplexer,Name="; + + void registerListener(DiameterListener listener, ApplicationId[] appIds) throws IllegalStateException; + + void unregisterListener(DiameterListener listener); + + //For sake of simplicity in the pre Gamma :) + Stack getStack(); + + DiameterProvider getProvider(); + + DiameterMessageFactory getMessageFactory(); + + DiameterStackMultiplexerAS7MBean getMultiplexerMBean(); + + // MANAGEMENT OPERATIONS + + // Get a Serializable Configuration + + DiameterConfiguration getDiameterConfiguration(); + + // Local Peer ---------------------------------------------------------- + + /** + * Changes the URI of the Local Peer. + * + * @param uri the new URI to be used by the Local Peer + */ + void _LocalPeer_setURI(String uri); + + /** + * Adds an IP Address to the Local Peer. + * @param ipAddress the IP Address to be added, if not present + */ + void _LocalPeer_addIPAddress(String ipAddress); + + /** + * Removes an IP Address from the Local Peer. + * + * @param ipAddress the IP Address to be removed, if present + */ + void _LocalPeer_removeIPAddress(String ipAddress); + + /** + * Changes the Realm of the Local Peer. + * + * @param realm the new Realm to be used by the Local Peer + */ + void _LocalPeer_setRealm(String realm); + + /** + * Sets the Local Peer Vendor-Id. + * + * @param vendorId the new Vendor-Id for the Peer + */ + void _LocalPeer_setVendorId(long vendorId); + + // Parameters ---------------------------------------------------------- + + /** + * Sets whether the stack will accept connections from unknown peers or not (default: true) + * + * @param acceptUndefinedPeer indicates if the stack will accept unknown connections + */ + void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer); + + /** + * Sets whether the stack will use URI (aaa://IP_ADDRESS:PORT) as FQDN. Some Peers require it. + * + * @param useUriAsFqdn indicates if the stack will use URI as FQDN + */ + void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn); + + /** + * Sets the value to consider a message as a duplicate, in ms. (default: 240000, 4 minutes). + * + * @param duplicateTimer the amount of time, in ms. + */ + void _Parameters_setDuplicateTimer(long duplicateTimer); + + // Parameters : Timeouts ----------------------------------------------- + + /** + * Sets the timeout for general Diameter messages, in ms. (default: 60000, 1 minute). + * + * @param messageTimeout the amount of time, in ms. + */ + void _Parameters_setMessageTimeout(long messageTimeout); + + /** + * Sets the timeout for stopping the stack. (default: 10000, 10 seconds). + * + * @param stopTimeout the amount of time, in ms. + */ + void _Parameters_setStopTimeout(long stopTimeout); + + /** + * Sets the timeout for CEA messages. (default: 10000, 10 seconds). + * + * @param ceaTimeout the amount of time, in ms. + */ + void _Parameters_setCeaTimeout(long ceaTimeout); + + /** + * Sets the timeout for inactiveness. (default: 20000, 20 seconds). + * + * @param iacTimeout the amount of time, in ms. + */ + void _Parameters_setIacTimeout(long iacTimeout); + + /** + * Sets the timeout for DWA messages. (default: 10000, 10 seconds). + * + * @param dwaTimeout the amount of time, in ms. + */ + void _Parameters_setDwaTimeout(long dwaTimeout); + + /** + * Sets the timeout for DPA messages. (default: 5000, 5 seconds). + * + * @param dpaTimeout the amount of time, in ms. + */ + void _Parameters_setDpaTimeout(long dpaTimeout); + + /** + * Sets the timeout for reconnecting. (default: 10000, 10 seconds). + * + * @param recTimeout the amount of time, in ms. + */ + void _Parameters_setRecTimeout(long recTimeout); + + void _Parameters_setConcurrentEntity(String name, String desc, Integer size); + + void _Parameters_setStatisticLoggerDelay(long delay); + + void _Parameters_setStatisticLoggerPause(long pause); + + // Network : Peers ----------------------------------------------------- + + /** + * Adds a peer definition to the stack. Same as element in XML Configuration. + * + * @param name the name/uri of the peer + * @param attemptConnect indicates if the stack should try to connect to this peer or wait for incoming connection + * @param rating the peer rating for decision on message routing + */ + void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating); + + /** + * Removes a peer definition from stack. + * + * @param name the name/uri of the peer + */ + void _Network_Peers_removePeer(String name); + + // Network : Realms ---------------------------------------------------- + + /** + * Adds a new Realm to the stack. Same as element in XML Configuration. + * + * @param name the name of the Realm + * @param peers the Realm peer hosts, separated by comma + * @param appVendorId the vendor-id of the application supported by this realm + * @param appAcctId the accounting-id of the application supported by this realm + * @param appAuthId the authorization-id of the application supported by this realm + */ + void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId); + + void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, String agentConfiguration, + boolean isDynamic, int expTime); + + /** + * Removes a Realm from the stack. + * + * @param name the name of the Realm + */ + void _Network_Realms_removeRealm(String name); + + /** + * Adds a new Peer host to the Realm + * + * @param realmName the name of the Realm + * @param peerName the name/host of the Peer to be added + * @param attemptConnecting either try or not to connect the peer (client/server) + */ + void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnecting); + + /** + * Removes a Peer host from the Realm + * + * @param realmName the name of the Realm + * @param peerName the name/host of the Peer to be removed + */ + void _Network_Realms_removePeerFromRealm(String realmName, String peerName); + + // Stack Operation ----------------------------------------------------- + + /** + * Operation to stop the stack. + * + */ + void stopStack(int disconnectCause); + + /** + * Operation to start the stack. + * + */ + void startStack(); + + // Validation ---------------------------------------------------------- + + /** + * Sets whether validation on Diameter messages/AVPs should be performed or not. + * + * @param enableValidation flag indicating if validation should be performed + */ + void _Validation_setEnabled(boolean enableValidation); + + // Configuration Dump -------------------------------------------------- + + /** + * Dumps full stack configuration. + * + * @return a String with stack configuration + */ + String dumpStackConfiguration(); + + // Information dump methods -------------------------------------------- + + String _LocalPeer_getProductName(); + + Long _LocalPeer_getVendorId(); + + Long _LocalPeer_getFirmware(); + + String _LocalPeer_getURI(); + + String _LocalPeer_getRealmName(); + + InetAddress[] _LocalPeer_getIPAddresses(); + + Set _LocalPeer_getCommonApplicationIds(); + + String[] _Network_Realms_getRealms(); + + String[] _Network_Realms_getRealmPeers(String realmName); + + boolean _LocalPeer_isActive(); + + boolean _Network_Peers_isPeerConnected(String name); + +} diff --git a/core/mux/jar/src/main/resources/META-INF/jboss-deployment-structure.xml b/core/mux/jar/src/main/resources/META-INF/jboss-deployment-structure.xml deleted file mode 100644 index eddbf29e4..000000000 --- a/core/mux/jar/src/main/resources/META-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/core/mux/pom.xml b/core/mux/pom.xml index 242066793..71a854c29 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -60,6 +60,14 @@ false + + org.apache.maven.plugins + maven-checkstyle-plugin + 2.17 + + true + + @@ -67,28 +75,14 @@ maven-release - sar-jboss-4 sar-jboss-7 - sar-jboss-5 - jboss4 - - sar-jboss-4 - - - - jboss5 + jboss7 true - - sar-jboss-5 - - - - jboss7 sar-jboss-7 diff --git a/core/mux/sar-jboss-7/src/main/resources/META-INF/jboss-deployment-structure.xml b/core/mux/sar-jboss-7/src/main/resources/META-INF/jboss-deployment-structure.xml deleted file mode 100644 index d24511440..000000000 --- a/core/mux/sar-jboss-7/src/main/resources/META-INF/jboss-deployment-structure.xml +++ /dev/null @@ -1,10 +0,0 @@ - -   true - -    -      -        -      -    - - \ No newline at end of file From 2ceae7eebeddabf29db0c651bf63f754e4c82471 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 20 Jan 2017 16:01:03 +0200 Subject: [PATCH 05/75] Created WildFly Extension for Diameter Mux. Fixed modules structure creating: org.mobicents.diameter, org.mobicents.diameter.mux, org.mobicents.diameter.extension. (cherry picked from commit 49cba3c52c1405c3577fe19f6b62bd2eb4223895) --- core/mux/jar/src/main/module/module.xml | 13 ++ core/mux/sar-jboss-7/pom.xml | 144 +++++++++++++++--- .../src/main/assemble/descriptor.xml | 22 +++ .../extension/DiameterMuxExtension.java | 108 +++++++++++++ .../extension/DiameterMuxService.java | 73 +++++++++ .../diameter/extension/SubsystemAdd.java | 58 +++++++ .../extension/SubsystemDefinition.java | 31 ++++ .../diameter/extension/SubsystemRemove.java | 32 ++++ .../sar-jboss-7/src/main/module/module.xml | 24 +++ .../org.jboss.as.controller.Extension | 1 + .../extension/LocalDescriptions.properties | 3 + .../resources/schema/DiameterMuxExtension.xsd | 13 ++ 12 files changed, 504 insertions(+), 18 deletions(-) create mode 100644 core/mux/jar/src/main/module/module.xml create mode 100755 core/mux/sar-jboss-7/src/main/assemble/descriptor.xml create mode 100644 core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java create mode 100644 core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java create mode 100644 core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java create mode 100644 core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java create mode 100644 core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java create mode 100644 core/mux/sar-jboss-7/src/main/module/module.xml create mode 100644 core/mux/sar-jboss-7/src/main/resources/META-INF/services/org.jboss.as.controller.Extension create mode 100644 core/mux/sar-jboss-7/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties create mode 100644 core/mux/sar-jboss-7/src/main/resources/schema/DiameterMuxExtension.xsd diff --git a/core/mux/jar/src/main/module/module.xml b/core/mux/jar/src/main/module/module.xml new file mode 100644 index 000000000..f5849c651 --- /dev/null +++ b/core/mux/jar/src/main/module/module.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/core/mux/sar-jboss-7/pom.xml b/core/mux/sar-jboss-7/pom.xml index 3a1c2a541..db3f4a3d9 100644 --- a/core/mux/sar-jboss-7/pom.xml +++ b/core/mux/sar-jboss-7/pom.xml @@ -15,12 +15,42 @@ jboss-sar + + 2.2.0.Final + + org.mobicents.diameter.extension + org/mobicents/diameter/extension + + + + + + org.wildfly.core + wildfly-controller + ${version.wildfly.core} + provided + + + org.wildfly.core + wildfly-jmx + ${version.wildfly.core} + provided + + + org.wildfly.core + wildfly-server + ${version.wildfly.core} + provided + + + + ${project.groupId} restcomm-diameter-mux-jar ${project.version} - runtime + @@ -33,6 +63,22 @@ slf4j-log4j12 ${slf4j.version} + + + org.wildfly.core + wildfly-controller + provided + + + org.wildfly.core + wildfly-jmx + provided + + + org.wildfly.core + wildfly-server + provided + @@ -128,9 +174,12 @@ - + + + - + @@ -139,30 +188,64 @@ - + - - - - + + + + - + - + + + + + + + + + + + + + + - - - - + + + + - - + + + + + + + + + + + + + - + + + + + @@ -174,12 +257,37 @@ - + + + + diff --git a/core/mux/sar-jboss-7/src/main/assemble/descriptor.xml b/core/mux/sar-jboss-7/src/main/assemble/descriptor.xml new file mode 100755 index 000000000..15896ebcc --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/assemble/descriptor.xml @@ -0,0 +1,22 @@ + + diameter-mux-bean + + dir + + main + + + + src/main/module + / + true + + + + + + / + true + + + diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java new file mode 100644 index 000000000..339045f18 --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java @@ -0,0 +1,108 @@ +package org.mobicents.diameter.extension; + +import org.jboss.as.controller.*; +import org.jboss.as.controller.descriptions.StandardResourceDescriptionResolver; +import org.jboss.as.controller.operations.common.GenericSubsystemDescribeHandler; +import org.jboss.as.controller.parsing.ExtensionParsingContext; +import org.jboss.as.controller.parsing.ParseUtils; +import org.jboss.as.controller.persistence.SubsystemMarshallingContext; +import org.jboss.as.controller.registry.ManagementResourceRegistration; +import org.jboss.as.controller.registry.OperationEntry; +import org.jboss.dmr.ModelNode; +import org.jboss.staxmapper.XMLElementReader; +import org.jboss.staxmapper.XMLElementWriter; +import org.jboss.staxmapper.XMLExtendedStreamReader; +import org.jboss.staxmapper.XMLExtendedStreamWriter; + +import javax.xml.stream.XMLStreamConstants; +import javax.xml.stream.XMLStreamException; +import java.util.List; + +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.ADD; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.DESCRIBE; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.OP_ADDR; +import static org.jboss.as.controller.descriptions.ModelDescriptionConstants.SUBSYSTEM; + + +/** + * @author Kabir Khan + */ +public class DiameterMuxExtension implements Extension { + + /** + * The name space used for the {@code substystem} element + */ + public static final String NAMESPACE = "urn:mobicents:diameter-mux:1.0"; + + /** + * The name of our subsystem within the model. + */ + public static final String SUBSYSTEM_NAME = "diameter-mux"; + + /** + * The parser used for parsing our subsystem + */ + private final SubsystemParser parser = new SubsystemParser(); + + protected static final PathElement SUBSYSTEM_PATH = PathElement.pathElement(SUBSYSTEM, SUBSYSTEM_NAME); + private static final String RESOURCE_NAME = DiameterMuxExtension.class.getPackage().getName() + ".LocalDescriptions"; + + static StandardResourceDescriptionResolver getResourceDescriptionResolver(final String keyPrefix) { + String prefix = SUBSYSTEM_NAME + (keyPrefix == null ? "" : "." + keyPrefix); + return new StandardResourceDescriptionResolver(prefix, RESOURCE_NAME, DiameterMuxExtension.class.getClassLoader(), true, false); + } + + @Override + public void initializeParsers(ExtensionParsingContext context) { + context.setSubsystemXmlMapping(SUBSYSTEM_NAME, NAMESPACE, parser); + } + + + @Override + public void initialize(ExtensionContext context) { + final SubsystemRegistration subsystem = context.registerSubsystem(SUBSYSTEM_NAME, 1, 0); + final ManagementResourceRegistration registration = subsystem.registerSubsystemModel(SubsystemDefinition.INSTANCE); + + final OperationDefinition describeOp = new SimpleOperationDefinitionBuilder(DESCRIBE, + getResourceDescriptionResolver(null)) + .setEntryType(OperationEntry.EntryType.PRIVATE) + .build(); + registration.registerOperationHandler(describeOp, GenericSubsystemDescribeHandler.INSTANCE, false); + + subsystem.registerXMLElementWriter(parser); + } + + private static ModelNode createAddSubsystemOperation() { + final ModelNode subsystem = new ModelNode(); + subsystem.get(OP).set(ADD); + subsystem.get(OP_ADDR).add(SUBSYSTEM, SUBSYSTEM_NAME); + return subsystem; + } + + /** + * The subsystem parser, which uses stax to read and write to and from xml + */ + private static class SubsystemParser implements XMLStreamConstants, XMLElementReader>, XMLElementWriter { + + /** + * {@inheritDoc} + */ + @Override + public void writeContent(XMLExtendedStreamWriter writer, SubsystemMarshallingContext context) throws XMLStreamException { + context.startSubsystemElement(DiameterMuxExtension.NAMESPACE, false); + writer.writeEndElement(); + } + + /** + * {@inheritDoc} + */ + @Override + public void readElement(XMLExtendedStreamReader reader, List list) throws XMLStreamException { + // Require no content + ParseUtils.requireNoContent(reader); + list.add(createAddSubsystemOperation()); + } + } + +} diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java new file mode 100644 index 000000000..9aa19a626 --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java @@ -0,0 +1,73 @@ +package org.mobicents.diameter.extension; + +import org.jboss.logging.Logger; +import org.jboss.msc.service.*; +import org.jboss.msc.value.InjectedValue; +import org.mobicents.diameter.stack.DiameterStackMultiplexerAS7; +import org.mobicents.diameter.stack.DiameterStackMultiplexerAS7MBean; + +import javax.management.MBeanServer; +import javax.management.NotCompliantMBeanException; +import javax.management.ObjectName; +import javax.management.StandardMBean; + +public class DiameterMuxService implements Service { + + private final Logger log = Logger.getLogger(DiameterMuxService.class); + + public static ServiceName getServiceName() { + return ServiceName.of("mobicents","diameter-mux"); + } + + private final InjectedValue mbeanServer = new InjectedValue(); + public InjectedValue getMbeanServer() { + return mbeanServer; + } + + private DiameterStackMultiplexerAS7 diameterMuxBean; + + @Override + public DiameterMuxService getValue() throws IllegalStateException, IllegalArgumentException { + return this; + } + + @Override + public void start(StartContext context) throws StartException { + log.info("Starting DiameterMuxService"); + + diameterMuxBean = new DiameterStackMultiplexerAS7(); + //try { + //StandardMBean standardMBean = + // new StandardMBean(diameterMuxBean, DiameterStackMultiplexerAS7MBean.class); + registerMBean(diameterMuxBean, DiameterStackMultiplexerAS7.OBJECT_NAME); + //} catch (NotCompliantMBeanException e) { + // e.printStackTrace(); + //} finally { + diameterMuxBean.startService(); + //} + } + + @Override + public void stop(StopContext context) { + log.info("Stopping DiameterMuxService"); + + diameterMuxBean.stopService(); + unregisterMBean(DiameterStackMultiplexerAS7.OBJECT_NAME); + } + + private void registerMBean(Object mBean, String name) throws StartException { + try { + getMbeanServer().getValue().registerMBean(mBean, new ObjectName(name)); + } catch (Throwable e) { + throw new StartException(e); + } + } + + private void unregisterMBean(String name) { + try { + getMbeanServer().getValue().unregisterMBean(new ObjectName(name)); + } catch (Throwable e) { + log.error("failed to unregister mbean", e); + } + } +} diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java new file mode 100644 index 000000000..498c14e0b --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java @@ -0,0 +1,58 @@ +package org.mobicents.diameter.extension; + +import java.util.List; + +import org.jboss.as.controller.AbstractBoottimeAddStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.as.controller.OperationFailedException; +import org.jboss.as.controller.ServiceVerificationHandler; +import org.jboss.as.jmx.MBeanServerService; +import org.jboss.dmr.ModelNode; +import org.jboss.logging.Logger; +import org.jboss.msc.service.ServiceController; + +import org.jboss.msc.service.ServiceName; + +import javax.management.MBeanServer; + +/** + * Handler responsible for adding the subsystem resource to the model + * + * @author Kabir Khan + */ +class SubsystemAdd extends AbstractBoottimeAddStepHandler { + + static final SubsystemAdd INSTANCE = new SubsystemAdd(); + + private final Logger log = Logger.getLogger(SubsystemAdd.class); + + private SubsystemAdd() { + } + + /** {@inheritDoc} */ + @Override + protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException { + log.info("Populating the model"); + model.setEmptyObject(); + } + + /** {@inheritDoc} */ + @Override + public void performBoottime(OperationContext context, ModelNode operation, ModelNode model, + ServiceVerificationHandler verificationHandler, List> newControllers) + throws OperationFailedException { + + // Install service with MBean SleeConnectionTest + + DiameterMuxService service = new DiameterMuxService(); + ServiceName name = DiameterMuxService.getServiceName(); + ServiceController controller = context.getServiceTarget() + .addService(name, service) + .addDependency(MBeanServerService.SERVICE_NAME, MBeanServer.class, service.getMbeanServer()) + .addListener(verificationHandler) + .setInitialMode(ServiceController.Mode.ACTIVE) + .install(); + newControllers.add(controller); + + } +} diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java new file mode 100644 index 000000000..fbb2ec813 --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java @@ -0,0 +1,31 @@ +package org.mobicents.diameter.extension; + +import org.jboss.as.controller.SimpleResourceDefinition; +import org.jboss.as.controller.registry.ManagementResourceRegistration; + +/** + * @author Tomaz Cerar + */ +public class SubsystemDefinition extends SimpleResourceDefinition { + public static final SubsystemDefinition INSTANCE = new SubsystemDefinition(); + + private SubsystemDefinition() { + super(DiameterMuxExtension.SUBSYSTEM_PATH, + DiameterMuxExtension.getResourceDescriptionResolver(null), + //We always need to add an 'add' operation + SubsystemAdd.INSTANCE, + //Every resource that is added, normally needs a remove operation + SubsystemRemove.INSTANCE); + } + + @Override + public void registerOperations(ManagementResourceRegistration resourceRegistration) { + super.registerOperations(resourceRegistration); + //you can register aditional operations here + } + + @Override + public void registerAttributes(ManagementResourceRegistration resourceRegistration) { + //you can register attributes here + } +} diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java new file mode 100644 index 000000000..5df6509c5 --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java @@ -0,0 +1,32 @@ +package org.mobicents.diameter.extension; + +import org.jboss.as.controller.AbstractRemoveStepHandler; +import org.jboss.as.controller.OperationContext; +import org.jboss.as.controller.OperationFailedException; +import org.jboss.dmr.ModelNode; +import org.jboss.logging.Logger; +import org.jboss.msc.service.ServiceName; + +/** + * Handler responsible for removing the subsystem resource from the model + * + * @author Kabir Khan + */ +class SubsystemRemove extends AbstractRemoveStepHandler { + + static final SubsystemRemove INSTANCE = new SubsystemRemove(); + + private final Logger log = Logger.getLogger(SubsystemRemove.class); + + private SubsystemRemove() { + } + + @Override + protected void performRuntime(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { + //Remove any services installed by the corresponding add handler here + ServiceName name = DiameterMuxService.getServiceName(); + context.removeService(name); + } + + +} diff --git a/core/mux/sar-jboss-7/src/main/module/module.xml b/core/mux/sar-jboss-7/src/main/module/module.xml new file mode 100644 index 000000000..1c440fa84 --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/module/module.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/core/mux/sar-jboss-7/src/main/resources/META-INF/services/org.jboss.as.controller.Extension b/core/mux/sar-jboss-7/src/main/resources/META-INF/services/org.jboss.as.controller.Extension new file mode 100644 index 000000000..1a026c432 --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/resources/META-INF/services/org.jboss.as.controller.Extension @@ -0,0 +1 @@ +org.mobicents.diameter.extension.DiameterMuxExtension diff --git a/core/mux/sar-jboss-7/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties b/core/mux/sar-jboss-7/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties new file mode 100644 index 000000000..ecbb03559 --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties @@ -0,0 +1,3 @@ +DiameterMuxExtension=My subsystem +DiameterMuxExtension.add=Operation Adds subsystem +DiameterMuxExtension.remove=Operation Removes subsystem diff --git a/core/mux/sar-jboss-7/src/main/resources/schema/DiameterMuxExtension.xsd b/core/mux/sar-jboss-7/src/main/resources/schema/DiameterMuxExtension.xsd new file mode 100644 index 000000000..edcc09efe --- /dev/null +++ b/core/mux/sar-jboss-7/src/main/resources/schema/DiameterMuxExtension.xsd @@ -0,0 +1,13 @@ + + + + + + + + From b258cf3849d5e4955790c39394fcaf5046e9111e Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 20 Jan 2017 17:19:04 +0200 Subject: [PATCH 06/75] Moving to RestComm Cluster 3. (cherry picked from commit cc0e968d76b98fbffc5b95d4a250abf8c54db883) --- core/jdiameter-ha/api/pom.xml | 15 +++++++++++-- core/jdiameter-ha/impl/pom.xml | 16 ++++++++++++-- .../ClientAccSessionDataReplicatedImpl.java | 6 ++--- .../ClientAuthSessionDataReplicatedImpl.java | 6 ++--- .../ClientCCASessionDataReplicatedImpl.java | 6 ++--- .../ClientCxDxSessionDataReplicatedImpl.java | 6 ++--- .../gx/ClientGxSessionDataReplicatedImpl.java | 6 ++--- .../rf/ClientRfSessionDataReplicatedImpl.java | 6 ++--- .../ro/ClientRoSessionDataReplicatedImpl.java | 6 ++--- .../rx/ClientRxSessionDataReplicatedImpl.java | 6 ++--- .../ClientS13SessionDataReplicatedImpl.java | 6 ++--- .../sh/ShClientSessionDataReplicatedImpl.java | 6 ++--- .../common/AppSessionDataReplicatedImpl.java | 12 +++++----- .../acc/AccReplicatedSessionDataFactory.java | 2 +- .../AuthReplicatedSessionDataFactory.java | 2 +- .../cca/CCAReplicatedSessionDataFactory.java | 2 +- .../CxDxReplicatedSessionDataFactory.java | 2 +- .../cxdx/CxDxSessionDataReplicatedImpl.java | 6 ++--- .../gx/GxReplicatedSessionDataFactory.java | 2 +- .../rf/RfReplicatedSessionDataFactory.java | 2 +- .../ro/RoReplicatedSessionDataFactory.java | 2 +- .../rx/RxReplicatedSessionDataFactory.java | 2 +- .../s13/S13ReplicatedSessionDataFactory.java | 2 +- .../s13/S13SessionDataReplicatedImpl.java | 6 ++--- .../sh/ShReplicatedSessionDataFactory.java | 2 +- .../ha/data/ReplicatedSessionDatasource.java | 22 ++++++++++--------- .../ServerAccSessionDataReplicatedImpl.java | 6 ++--- .../ServerAuthSessionDataReplicatedImpl.java | 6 ++--- .../ServerCCASessionDataReplicatedImpl.java | 6 ++--- .../ServerCxDxSessionDataReplicatedImpl.java | 6 ++--- .../gx/ServerGxSessionDataReplicatedImpl.java | 6 ++--- .../rf/ServerRfSessionDataReplicatedImpl.java | 6 ++--- .../ro/ServerRoSessionDataReplicatedImpl.java | 6 ++--- .../rx/ServerRxSessionDataReplicatedImpl.java | 6 ++--- .../ServerS13SessionDataReplicatedImpl.java | 6 ++--- .../sh/ShServerSessionDataReplicatedImpl.java | 6 ++--- .../impl/ha/timer/DiameterTimerTaskData.java | 4 ++-- .../ha/timer/ReplicatedTimerFacilityImpl.java | 10 ++++----- core/jdiameter-ha/pom.xml | 22 +++++++++++++++---- 39 files changed, 146 insertions(+), 107 deletions(-) diff --git a/core/jdiameter-ha/api/pom.xml b/core/jdiameter-ha/api/pom.xml index 7aa824511..aa74c7ce7 100644 --- a/core/jdiameter-ha/api/pom.xml +++ b/core/jdiameter-ha/api/pom.xml @@ -20,19 +20,30 @@ + + + org.infinispan + infinispan-core + provided + + + org.infinispan + infinispan-tree + provided + - org.mobicents.cluster + org.restcomm.cluster timers diff --git a/core/jdiameter-ha/impl/pom.xml b/core/jdiameter-ha/impl/pom.xml index a15b5fe82..2b2a66291 100644 --- a/core/jdiameter-ha/impl/pom.xml +++ b/core/jdiameter-ha/impl/pom.xml @@ -33,18 +33,30 @@ + + + org.infinispan + infinispan-core + provided + + + org.infinispan + infinispan-tree + provided + - org.mobicents.cluster + org.restcomm.cluster cache - org.mobicents.cluster + org.restcomm.cluster timers diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java index 0b2b71df6..17ea70d27 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.acc.ClientAccSession; @@ -55,7 +55,7 @@ import org.jdiameter.client.api.parser.ParseException; import org.jdiameter.client.impl.app.acc.IClientAccSessionData; import org.jdiameter.common.api.app.acc.ClientAccSessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.slf4j.Logger; @@ -83,7 +83,7 @@ public class ClientAccSessionDataReplicatedImpl extends AppSessionDataReplicated * @param mobicentsCluster * @param iface */ - public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java index 67dce12ae..def90f47d 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java @@ -44,11 +44,11 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.auth.ClientAuthSession; import org.jdiameter.client.impl.app.auth.IClientAuthSessionData; import org.jdiameter.common.api.app.auth.ClientAuthSessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -70,7 +70,7 @@ public class ClientAuthSessionDataReplicatedImpl extends AppSessionDataReplicate * @param mobicentsCluster * @param iface */ - public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java index f0bb81db0..429a37979 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.cca.ClientCCASession; @@ -55,7 +55,7 @@ import org.jdiameter.client.api.parser.ParseException; import org.jdiameter.client.impl.app.cca.IClientCCASessionData; import org.jdiameter.common.api.app.cca.ClientCCASessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.slf4j.Logger; @@ -87,7 +87,7 @@ public class ClientCCASessionDataReplicatedImpl extends AppSessionDataReplicated * @param mobicentsCluster * @param iface */ - public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java index 2ce7d8f29..1dc099d2c 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java @@ -42,12 +42,12 @@ package org.mobicents.diameter.impl.ha.client.cxdx; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.cxdx.ClientCxDxSession; import org.jdiameter.client.api.IContainer; import org.jdiameter.client.impl.app.cxdx.IClientCxDxSessionData; import org.jdiameter.common.api.app.cxdx.CxDxSessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -63,7 +63,7 @@ public class ClientCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicat * @param mobicentsCluster * @param iface */ - public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster, container); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java index bb9761e41..162498e6b 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.gx.ClientGxSession; @@ -55,7 +55,7 @@ import org.jdiameter.client.api.parser.ParseException; import org.jdiameter.client.impl.app.gx.IClientGxSessionData; import org.jdiameter.common.api.app.gx.ClientGxSessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.slf4j.Logger; @@ -87,7 +87,7 @@ public class ClientGxSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java index ab9a92c68..a64773d30 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.rf.ClientRfSession; @@ -55,7 +55,7 @@ import org.jdiameter.client.api.parser.ParseException; import org.jdiameter.client.impl.app.rf.IClientRfSessionData; import org.jdiameter.common.api.app.rf.ClientRfSessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.slf4j.Logger; @@ -83,7 +83,7 @@ public class ClientRfSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java index f1a150ac0..5118b4931 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.ro.ClientRoSession; @@ -55,7 +55,7 @@ import org.jdiameter.client.api.parser.ParseException; import org.jdiameter.client.impl.app.ro.IClientRoSessionData; import org.jdiameter.common.api.app.ro.ClientRoSessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.slf4j.Logger; @@ -87,7 +87,7 @@ public class ClientRoSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java index 74ca87c46..58f574133 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java @@ -42,12 +42,12 @@ package org.mobicents.diameter.impl.ha.client.rx; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.rx.ClientRxSession; import org.jdiameter.client.api.IContainer; import org.jdiameter.client.impl.app.rx.IClientRxSessionData; import org.jdiameter.common.api.app.rx.ClientRxSessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -67,7 +67,7 @@ public class ClientRxSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java index 52a7d935e..e12d80d81 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java @@ -19,12 +19,12 @@ package org.mobicents.diameter.impl.ha.client.s13; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.s13.ClientS13Session; import org.jdiameter.client.api.IContainer; import org.jdiameter.client.impl.app.s13.IClientS13SessionData; import org.jdiameter.common.api.app.s13.S13SessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -40,7 +40,7 @@ public class ClientS13SessionDataReplicatedImpl extends S13SessionDataReplicated * @param mobicentsCluster * @param iface */ - public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster, container); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java index 8172f55cd..f2edc2f54 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java @@ -42,10 +42,10 @@ package org.mobicents.diameter.impl.ha.client.sh; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.sh.ClientShSession; import org.jdiameter.client.impl.app.sh.IShClientSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -61,7 +61,7 @@ public class ShClientSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java index 56ba70d3d..7574322d2 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java @@ -42,14 +42,14 @@ package org.mobicents.diameter.impl.ha.common; -import org.jboss.cache.Fqn; -import org.jboss.cache.Node; +import org.infinispan.tree.Fqn; +import org.infinispan.tree.Node; import org.jdiameter.api.ApplicationId; import org.jdiameter.api.app.AppSession; import org.jdiameter.common.api.app.IAppSessionData; -import org.mobicents.cache.MobicentsCache; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.cluster.cache.ClusteredCacheData; +import org.restcomm.cache.MobicentsCache; +import org.restcomm.cluster.MobicentsCluster; +import org.restcomm.cluster.cache.ClusteredCacheData; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; /** @@ -67,7 +67,7 @@ public class AppSessionDataReplicatedImpl extends ClusteredCacheData implements * @param nodeFqn * @param mobicentsCluster */ - public AppSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public AppSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java index 6efc94304..c051a2d83 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.acc.IAccSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.acc.ClientAccSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.acc.ServerAccSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java index 9f5e73296..583c4139e 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.auth.IAuthSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.auth.ClientAuthSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.auth.ServerAuthSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java index b603fe779..893620001 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.cca.ICCASessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.cca.ClientCCASessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.cca.ServerCCASessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java index 62ea766ca..bfbda64ae 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.cxdx.ClientCxDxSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.cxdx.ServerCxDxSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java index 6a167ab19..a42a38562 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.client.api.IContainer; @@ -54,7 +54,7 @@ import org.jdiameter.client.api.parser.ParseException; import org.jdiameter.common.api.app.cxdx.CxDxSessionState; import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -79,7 +79,7 @@ public abstract class CxDxSessionDataReplicatedImpl extends AppSessionDataReplic * @param mobicentsCluster * @param iface */ - public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java index 7729b240e..1a66a51cf 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.gx.IGxSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.gx.ClientGxSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.gx.ServerGxSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java index a4b96f384..951908d0a 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.rf.IRfSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.rf.ClientRfSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.rf.ServerRfSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java index d9ccb6bad..a3f4f4e64 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.ro.IRoSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.ro.ClientRoSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.ro.ServerRoSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java index 726a12a73..d7704e58b 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.rx.IRxSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.rx.ClientRxSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.rx.ServerRxSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java index 8fb1cda2e..3c0291153 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java @@ -25,7 +25,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.s13.IS13SessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.s13.ClientS13SessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.s13.ServerS13SessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java index e75ad3194..d868756e4 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java @@ -22,7 +22,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.client.api.IContainer; @@ -31,7 +31,7 @@ import org.jdiameter.client.api.parser.ParseException; import org.jdiameter.common.api.app.s13.IS13SessionData; import org.jdiameter.common.api.app.s13.S13SessionState; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -56,7 +56,7 @@ public abstract class S13SessionDataReplicatedImpl extends AppSessionDataReplica * @param mobicentsCluster * @param iface */ - public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster); this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java index c01890200..bab353670 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java @@ -48,7 +48,7 @@ import org.jdiameter.common.api.app.IAppSessionDataFactory; import org.jdiameter.common.api.app.sh.IShSessionData; import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.client.sh.ShClientSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; import org.mobicents.diameter.impl.ha.server.sh.ShServerSessionDataReplicatedImpl; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java index 6958f457d..39387aa16 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java @@ -46,7 +46,7 @@ import javax.transaction.TransactionManager; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.BaseSession; import org.jdiameter.api.IllegalDiameterStateException; import org.jdiameter.api.NetworkReqListener; @@ -68,11 +68,11 @@ import org.jdiameter.common.api.app.sh.IShSessionData; import org.jdiameter.common.api.data.ISessionDatasource; import org.jdiameter.common.impl.data.LocalDataSource; -import org.mobicents.cache.MobicentsCache; -import org.mobicents.cluster.DataRemovalListener; -import org.mobicents.cluster.DefaultMobicentsCluster; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.cluster.election.DefaultClusterElector; +import org.restcomm.cache.MobicentsCache; +import org.restcomm.cluster.DataRemovalListener; +import org.restcomm.cluster.DefaultMobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; +import org.restcomm.cluster.election.DefaultClusterElector; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.common.acc.AccReplicatedSessionDataFactory; import org.mobicents.diameter.impl.ha.common.auth.AuthReplicatedSessionDataFactory; @@ -121,12 +121,14 @@ public ReplicatedSessionDatasource(IContainer container, ISessionDatasource loca super(); this.localDataSource = localDataSource; - MobicentsCache mcCache = new MobicentsCache(cacheConfigFilename); + MobicentsCache mcCache = null; TransactionManager txMgr = null; try { - Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); - Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); - txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); + mcCache = new MobicentsCache(cacheConfigFilename); + //Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); + //Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); + //txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); + txMgr = mcCache.getJBossCache().getCache().getAdvancedCache().getTransactionManager(); } catch (Exception e) { logger.debug("Could not fetch TxMgr. Not using one.", e); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java index 0a20e90fe..f17f4c111 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java @@ -44,11 +44,11 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.acc.ServerAccSession; import org.jdiameter.common.api.app.acc.ServerAccSessionState; import org.jdiameter.server.impl.app.acc.IServerAccSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -69,7 +69,7 @@ public class ServerAccSessionDataReplicatedImpl extends AppSessionDataReplicated * @param mobicentsCluster * @param iface */ - public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java index b49d2bc8c..15c81a2ea 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java @@ -44,11 +44,11 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.auth.ServerAuthSession; import org.jdiameter.common.api.app.auth.ServerAuthSessionState; import org.jdiameter.server.impl.app.auth.IServerAuthSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -69,7 +69,7 @@ public class ServerAuthSessionDataReplicatedImpl extends AppSessionDataReplicate * @param mobicentsCluster * @param iface */ - public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java index d6c691fb3..69331ccbb 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java @@ -44,11 +44,11 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.cca.ServerCCASession; import org.jdiameter.common.api.app.cca.ServerCCASessionState; import org.jdiameter.server.impl.app.cca.IServerCCASessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -68,7 +68,7 @@ public class ServerCCASessionDataReplicatedImpl extends AppSessionDataReplicated * @param mobicentsCluster * @param iface */ - public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java index 370d1b26b..2c04bab24 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java @@ -42,12 +42,12 @@ package org.mobicents.diameter.impl.ha.server.cxdx; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.cxdx.ServerCxDxSession; import org.jdiameter.client.api.IContainer; import org.jdiameter.common.api.app.cxdx.CxDxSessionState; import org.jdiameter.server.impl.app.cxdx.IServerCxDxSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -63,7 +63,7 @@ public class ServerCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicat * @param mobicentsCluster * @param iface */ - public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster, container); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java index 7405e4060..98a65a3b5 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java @@ -44,11 +44,11 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.gx.ServerGxSession; import org.jdiameter.common.api.app.gx.ServerGxSessionState; import org.jdiameter.server.impl.app.gx.IServerGxSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -68,7 +68,7 @@ public class ServerGxSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java index 18ff9f6f4..a69033545 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java @@ -44,11 +44,11 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.rf.ServerRfSession; import org.jdiameter.common.api.app.rf.ServerRfSessionState; import org.jdiameter.server.impl.app.rf.IServerRfSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -69,7 +69,7 @@ public class ServerRfSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java index 20217710f..035b584fe 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java @@ -44,11 +44,11 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.ro.ServerRoSession; import org.jdiameter.common.api.app.ro.ServerRoSessionState; import org.jdiameter.server.impl.app.ro.IServerRoSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -68,7 +68,7 @@ public class ServerRoSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java index 5a2f1460d..91cc69b3b 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java @@ -42,11 +42,11 @@ package org.mobicents.diameter.impl.ha.server.rx; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.rx.ServerRxSession; import org.jdiameter.common.api.app.rx.ServerRxSessionState; import org.jdiameter.server.impl.app.rx.IServerRxSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -65,7 +65,7 @@ public class ServerRxSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java index ce344e407..a588334c7 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java @@ -19,12 +19,12 @@ package org.mobicents.diameter.impl.ha.server.s13; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.s13.ServerS13Session; import org.jdiameter.client.api.IContainer; import org.jdiameter.common.api.app.s13.S13SessionState; import org.jdiameter.server.impl.app.s13.IServerS13SessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -40,7 +40,7 @@ public class ServerS13SessionDataReplicatedImpl extends S13SessionDataReplicated * @param mobicentsCluster * @param iface */ - public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { super(nodeFqn, mobicentsCluster, container); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java index b41789c99..648932a38 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java @@ -42,10 +42,10 @@ package org.mobicents.diameter.impl.ha.server.sh; -import org.jboss.cache.Fqn; +import org.infinispan.tree.Fqn; import org.jdiameter.api.sh.ServerShSession; import org.jdiameter.server.impl.app.sh.IShServerSessionData; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; @@ -61,7 +61,7 @@ public class ShServerSessionDataReplicatedImpl extends AppSessionDataReplicatedI * @param mobicentsCluster * @param iface */ - public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { super(nodeFqn, mobicentsCluster); if (super.create()) { diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java index 919d748b0..a8e9db7bf 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java @@ -44,8 +44,8 @@ import java.io.Serializable; -import org.mobicents.timers.PeriodicScheduleStrategy; -import org.mobicents.timers.TimerTaskData; +import org.restcomm.timers.PeriodicScheduleStrategy; +import org.restcomm.timers.TimerTaskData; /** * Diameter timer task data holder. diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java index 9f4a92242..3b06ac1f9 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java @@ -49,11 +49,11 @@ import org.jdiameter.common.api.data.ISessionDatasource; import org.jdiameter.common.api.timer.ITimerFacility; import org.jdiameter.common.impl.app.AppSessionImpl; -import org.mobicents.cluster.MobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.timers.FaultTolerantScheduler; -import org.mobicents.timers.TimerTask; -import org.mobicents.timers.TimerTaskData; +import org.restcomm.timers.FaultTolerantScheduler; +import org.restcomm.timers.TimerTask; +import org.restcomm.timers.TimerTaskData; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -110,7 +110,7 @@ public Serializable schedule(String sessionId, String timerName, long milisecond return id; } - private final class TimerTaskFactory implements org.mobicents.timers.TimerTaskFactory { + private final class TimerTaskFactory implements org.restcomm.timers.TimerTaskFactory { @Override public TimerTask newTimerTask(TimerTaskData data) { diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index 93c9d2b4f..ccd4d422c 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -22,7 +22,8 @@ 1.5.9.0-build538-SNAPSHOT - 1.15.11 + 3.0.0-SNAPSHOT + 8.2.4.Final @@ -37,18 +38,31 @@ jdiameter-impl ${project.version} + + + org.infinispan + infinispan-core + ${version.infinispan} + provided + + + org.infinispan + infinispan-tree + ${version.infinispan} + provided + - org.mobicents.cluster + org.restcomm.cluster core ${restcomm.cluster.version} - org.mobicents.cluster + org.restcomm.cluster cache ${restcomm.cluster.version} - org.mobicents.cluster + org.restcomm.cluster timers ${restcomm.cluster.version} From e24167f12b018381f78e32f1e9e6a5ad840ebbba Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 23 Jan 2017 12:57:00 +0200 Subject: [PATCH 07/75] Fixed Cluster version and Cache configuration. (cherry picked from commit 85c47a263a34d50e710e2735c781b2b7aea9c7e8) --- core/jdiameter-ha/pom.xml | 2 +- core/mux/common/config/jdiameter-jbc.xml | 20 +++++++++++++++++++ .../src/test/resources/jdiameter-jbc.xml | 20 ++++++++++++++++++- 3 files changed, 40 insertions(+), 2 deletions(-) diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index ccd4d422c..003bbf7d4 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -22,7 +22,7 @@ 1.5.9.0-build538-SNAPSHOT - 3.0.0-SNAPSHOT + 3.0.0.8 8.2.4.Final diff --git a/core/mux/common/config/jdiameter-jbc.xml b/core/mux/common/config/jdiameter-jbc.xml index ba2cb2b2e..ddbe35fda 100644 --- a/core/mux/common/config/jdiameter-jbc.xml +++ b/core/mux/common/config/jdiameter-jbc.xml @@ -1,5 +1,6 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/tests/src/test/resources/jdiameter-jbc.xml b/testsuite/tests/src/test/resources/jdiameter-jbc.xml index 0d2f3e044..101ee3b74 100644 --- a/testsuite/tests/src/test/resources/jdiameter-jbc.xml +++ b/testsuite/tests/src/test/resources/jdiameter-jbc.xml @@ -1,5 +1,6 @@ + + + + + + + + + + + + + + \ No newline at end of file From a136c95853f1720d105c8e831ee037edb8de6fd1 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 23 Jan 2017 16:32:12 +0200 Subject: [PATCH 08/75] Fixed Release script. (cherry picked from commit 63365ce9da35a4dd01aa34090f9968d9a7346fed) --- release/build.xml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/release/build.xml b/release/build.xml index 3c110890e..548007c76 100644 --- a/release/build.xml +++ b/release/build.xml @@ -102,9 +102,12 @@ - - - + + + + + + @@ -205,6 +208,7 @@ + + + @@ -423,7 +431,7 @@ - + From 818629caf4517ba6315fa26ee092a1d8da5ac28e Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 23 Jan 2017 16:57:07 +0200 Subject: [PATCH 09/75] Fixed Release script. (cherry picked from commit dc627d0c6cfc38779e85c15f51dc1a58a0005b69) --- release/build.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/release/build.xml b/release/build.xml index 548007c76..8a8ceb476 100644 --- a/release/build.xml +++ b/release/build.xml @@ -106,9 +106,10 @@ - - + + + From 16f52ab28088d943765b47ae5a5f5ab4168f8e0d Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Thu, 26 Jan 2017 15:09:34 +0200 Subject: [PATCH 10/75] Removed all dependencies on JBoss 5 and AOP. Added dependencies on Infinispan to TestSuite. (cherry picked from commit d08a21699cc82a49bb5fbfada1359204a4866445) --- core/jdiameter-ha/impl/pom.xml | 14 +------ core/jdiameter-ha/pom.xml | 10 ++++- core/mux/jar/pom.xml | 6 --- core/mux/sar-jboss-7/pom.xml | 1 + pom.xml | 2 +- testsuite/pom.xml | 70 ++++++++-------------------------- testsuite/tests/pom.xml | 10 +++++ 7 files changed, 37 insertions(+), 76 deletions(-) diff --git a/core/jdiameter-ha/impl/pom.xml b/core/jdiameter-ha/impl/pom.xml index 2b2a66291..ca330555d 100644 --- a/core/jdiameter-ha/impl/pom.xml +++ b/core/jdiameter-ha/impl/pom.xml @@ -25,29 +25,19 @@ jdiameter-impl - + org.jboss.logging - jboss-logging-log4j - provided + jboss-logging - - org.infinispan infinispan-core - provided org.infinispan infinispan-tree - provided diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index 003bbf7d4..a86020e58 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -24,6 +24,7 @@ 1.5.9.0-build538-SNAPSHOT 3.0.0.8 8.2.4.Final + 3.3.0.Final @@ -39,18 +40,23 @@ ${project.version} + + org.jboss.logging + jboss-logging + ${version.jboss.logging} + + org.infinispan infinispan-core ${version.infinispan} - provided org.infinispan infinispan-tree ${version.infinispan} - provided + org.restcomm.cluster core diff --git a/core/mux/jar/pom.xml b/core/mux/jar/pom.xml index 7de2f9edd..ad78266ff 100644 --- a/core/mux/jar/pom.xml +++ b/core/mux/jar/pom.xml @@ -16,12 +16,6 @@ jar - - org.jboss.jbossas - jboss-as-system-jmx - ${jboss.version} - - org.jboss.spec jboss-javaee-6.0 diff --git a/core/mux/sar-jboss-7/pom.xml b/core/mux/sar-jboss-7/pom.xml index db3f4a3d9..f6d80b890 100644 --- a/core/mux/sar-jboss-7/pom.xml +++ b/core/mux/sar-jboss-7/pom.xml @@ -124,6 +124,7 @@ org.jboss.jbossas:jboss-as-j2se oswego-concurrent:concurrent org.jboss.bootstrap:jboss-bootstrap + org.jboss.logging:jboss-logging org.jboss.jbossas:jboss-as-system org.jboss.jbossas:jboss-as-system-jmx org.jboss.aop:jboss-aop diff --git a/pom.xml b/pom.xml index 70144a803..8d41a34c2 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ true true 6.18 - 1.7 + 1.8 diff --git a/testsuite/pom.xml b/testsuite/pom.xml index 602ed2b3a..29783bbd4 100644 --- a/testsuite/pom.xml +++ b/testsuite/pom.xml @@ -19,16 +19,12 @@ 1.0.9 2.13.5 - 1.5.8 + 1.7.2 4.11 - 2.2.0.M2 - 2.1.8.GA - 2.1.8.GA - 2.1.8.GA - 2.1.8.GA - 2.0.1-BETA - 5.0.4.GA 2.19 + + 8.2.4.Final + 3.3.0.Final @@ -85,59 +81,23 @@ slf4j-log4j12 ${slf4j.version} + - org.jboss.microcontainer - jboss-kernel - ${version.jboss.microcontainer} - - - - org.jboss.microcontainer - jboss-dependency - ${version.jboss.microcontainer} - - - - org.jboss.microcontainer - jboss-aop-mc-int - ${version.jboss.microcontainer} - - - - org.jboss.aop - jboss-aop - ${version.jboss.aop} - - - - org.jboss.aop - jboss-aop-asintegration-mc - ${version.aop.asintegration.mc} - - - - org.jboss.aop - jboss-aop-asintegration-core - ${version.aop.asintegration.core} - - - - org.jboss.aop - jboss-aop-asintegration-jmx - ${version.aop.asintegration.jmx} - + org.infinispan + infinispan-core + ${version.infinispan} - jboss - jbosssx-client - ${version.jboss.sx.client} - + org.infinispan + infinispan-commons + ${version.infinispan} - org.jboss.naming - jnp-client - ${version.jboss.naming.jnp-client} + org.infinispan + infinispan-tree + ${version.infinispan} + diff --git a/testsuite/tests/pom.xml b/testsuite/tests/pom.xml index 8f19173ff..e0e972dac 100644 --- a/testsuite/tests/pom.xml +++ b/testsuite/tests/pom.xml @@ -44,6 +44,16 @@ urbanophile java-getopt + + + org.infinispan + infinispan-core + + + org.infinispan + infinispan-tree + + From 3b7eed5915f39ffba19a0eb22ea11b3157b54f35 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Thu, 26 Jan 2017 15:13:47 +0200 Subject: [PATCH 11/75] Updated Infinispan configuration: added JMX duplicate-domains and transaction mode. (cherry picked from commit 1d2390aca3ce18bf1b0f676e4237e890d788be24) --- core/mux/common/config/jdiameter-jbc.xml | 2 ++ testsuite/tests/src/test/resources/jdiameter-jbc.xml | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/core/mux/common/config/jdiameter-jbc.xml b/core/mux/common/config/jdiameter-jbc.xml index ddbe35fda..08c37e49f 100644 --- a/core/mux/common/config/jdiameter-jbc.xml +++ b/core/mux/common/config/jdiameter-jbc.xml @@ -28,8 +28,10 @@ + + diff --git a/testsuite/tests/src/test/resources/jdiameter-jbc.xml b/testsuite/tests/src/test/resources/jdiameter-jbc.xml index 101ee3b74..45f3835e7 100644 --- a/testsuite/tests/src/test/resources/jdiameter-jbc.xml +++ b/testsuite/tests/src/test/resources/jdiameter-jbc.xml @@ -20,9 +20,13 @@ - + - + + + + + \ No newline at end of file From 2bb518e71e331f2e8d6c85f8983da2fd73ccba80 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Wed, 1 Feb 2017 14:35:00 +0200 Subject: [PATCH 12/75] Modified sar-jboss-7 module to sar-wildfly module. --- core/mux/pom.xml | 6 +++--- core/mux/{sar-jboss-7 => sar-wildfly}/pom.xml | 2 +- .../src/main/assemble/descriptor.xml | 0 .../mobicents/diameter/extension/DiameterMuxExtension.java | 0 .../mobicents/diameter/extension/DiameterMuxService.java | 0 .../java/org/mobicents/diameter/extension/SubsystemAdd.java | 0 .../mobicents/diameter/extension/SubsystemDefinition.java | 0 .../org/mobicents/diameter/extension/SubsystemRemove.java | 0 .../{sar-jboss-7 => sar-wildfly}/src/main/module/module.xml | 0 .../src/main/resources/META-INF/jboss-service.xml | 0 .../src/main/resources/META-INF/module.xml | 0 .../META-INF/services/org.jboss.as.controller.Extension | 0 .../diameter/extension/LocalDescriptions.properties | 0 .../src/main/resources/schema/DiameterMuxExtension.xsd | 0 14 files changed, 4 insertions(+), 4 deletions(-) rename core/mux/{sar-jboss-7 => sar-wildfly}/pom.xml (99%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/assemble/descriptor.xml (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/module/module.xml (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/resources/META-INF/jboss-service.xml (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/resources/META-INF/module.xml (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/resources/META-INF/services/org.jboss.as.controller.Extension (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties (100%) rename core/mux/{sar-jboss-7 => sar-wildfly}/src/main/resources/schema/DiameterMuxExtension.xsd (100%) diff --git a/core/mux/pom.xml b/core/mux/pom.xml index 71a854c29..c78c0f4c1 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -75,16 +75,16 @@ maven-release - sar-jboss-7 + sar-wildfly - jboss7 + wildfly true - sar-jboss-7 + sar-wildfly diff --git a/core/mux/sar-jboss-7/pom.xml b/core/mux/sar-wildfly/pom.xml similarity index 99% rename from core/mux/sar-jboss-7/pom.xml rename to core/mux/sar-wildfly/pom.xml index f6d80b890..7a19cf506 100644 --- a/core/mux/sar-jboss-7/pom.xml +++ b/core/mux/sar-wildfly/pom.xml @@ -9,7 +9,7 @@ ../pom.xml - restcomm-diameter-mux-sar-jboss-7 + restcomm-diameter-mux-sar-wildfly Restcomm :: Diameter Multiplexer :: ${project.artifactId} diff --git a/core/mux/sar-jboss-7/src/main/assemble/descriptor.xml b/core/mux/sar-wildfly/src/main/assemble/descriptor.xml similarity index 100% rename from core/mux/sar-jboss-7/src/main/assemble/descriptor.xml rename to core/mux/sar-wildfly/src/main/assemble/descriptor.xml diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java similarity index 100% rename from core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java rename to core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java similarity index 100% rename from core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java rename to core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java similarity index 100% rename from core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java rename to core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java similarity index 100% rename from core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java rename to core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemDefinition.java diff --git a/core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java similarity index 100% rename from core/mux/sar-jboss-7/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java rename to core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java diff --git a/core/mux/sar-jboss-7/src/main/module/module.xml b/core/mux/sar-wildfly/src/main/module/module.xml similarity index 100% rename from core/mux/sar-jboss-7/src/main/module/module.xml rename to core/mux/sar-wildfly/src/main/module/module.xml diff --git a/core/mux/sar-jboss-7/src/main/resources/META-INF/jboss-service.xml b/core/mux/sar-wildfly/src/main/resources/META-INF/jboss-service.xml similarity index 100% rename from core/mux/sar-jboss-7/src/main/resources/META-INF/jboss-service.xml rename to core/mux/sar-wildfly/src/main/resources/META-INF/jboss-service.xml diff --git a/core/mux/sar-jboss-7/src/main/resources/META-INF/module.xml b/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml similarity index 100% rename from core/mux/sar-jboss-7/src/main/resources/META-INF/module.xml rename to core/mux/sar-wildfly/src/main/resources/META-INF/module.xml diff --git a/core/mux/sar-jboss-7/src/main/resources/META-INF/services/org.jboss.as.controller.Extension b/core/mux/sar-wildfly/src/main/resources/META-INF/services/org.jboss.as.controller.Extension similarity index 100% rename from core/mux/sar-jboss-7/src/main/resources/META-INF/services/org.jboss.as.controller.Extension rename to core/mux/sar-wildfly/src/main/resources/META-INF/services/org.jboss.as.controller.Extension diff --git a/core/mux/sar-jboss-7/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties b/core/mux/sar-wildfly/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties similarity index 100% rename from core/mux/sar-jboss-7/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties rename to core/mux/sar-wildfly/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties diff --git a/core/mux/sar-jboss-7/src/main/resources/schema/DiameterMuxExtension.xsd b/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd similarity index 100% rename from core/mux/sar-jboss-7/src/main/resources/schema/DiameterMuxExtension.xsd rename to core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd From 5cc57c92fc9e794b4abfa0235a4e23860aa9e4e4 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Wed, 8 Feb 2017 17:10:45 +0200 Subject: [PATCH 13/75] Updated restcomm-parent version: maven-javadoc-plugin config fixing. --- pom.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8d41a34c2..14995da39 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ org.mobicents restcomm-parent - 2.27.32 + 2.27.47 org.mobicents.diameter @@ -73,6 +73,13 @@ + + org.apache.maven.plugins + maven-javadoc-plugin + + -Xdoclint:none + + org.apache.maven.plugins From 240917e60abf5d7c45b599e246e4c0e45aa199db Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Thu, 9 Feb 2017 10:47:10 +0200 Subject: [PATCH 14/75] Changed compiler version to JDK 7. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 14995da39..c59eb755a 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ true true 6.18 - 1.8 + 1.7 From 96048c60ff370563130e16dbceba187a2f7e8421 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Thu, 9 Feb 2017 12:59:21 +0200 Subject: [PATCH 15/75] Fixed jboss-7 on wildfly for Release script. --- release/build.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/release/build.xml b/release/build.xml index 8a8ceb476..0a6488d19 100644 --- a/release/build.xml +++ b/release/build.xml @@ -64,7 +64,7 @@ - + @@ -80,7 +80,7 @@ - + @@ -483,7 +483,7 @@ - + @@ -497,7 +497,7 @@ - + From bf12b317b817afe4bde2470f9e5371e37a7c6181 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Thu, 9 Feb 2017 14:09:45 +0200 Subject: [PATCH 16/75] Fixing JDK to version 8 and nexus-staging-maven-plugin to version 1.6.7. --- pom.xml | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index c59eb755a..8fc0041db 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ true true 6.18 - 1.7 + 1.8 @@ -80,6 +80,28 @@ -Xdoclint:none + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + restcomm-releases-repository + https://oss.sonatype.org/ + + + + deploy-to-sonatype + deploy + + deploy + + release + + + + + org.apache.maven.plugins From 216b03762f99c09c0aa567c89ba58b33071ff566 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 15:26:57 +0200 Subject: [PATCH 17/75] Returned jDiameter HA for JBoss 5. --- core/jdiameter-ha/impl-jboss5/pom.xml | 52 +++ .../ClientAccSessionDataReplicatedImpl.java | 260 +++++++++++++ .../ClientAuthSessionDataReplicatedImpl.java | 243 ++++++++++++ .../ClientCCASessionDataReplicatedImpl.java | 327 ++++++++++++++++ .../ClientCxDxSessionDataReplicatedImpl.java | 84 +++++ .../gx/ClientGxSessionDataReplicatedImpl.java | 329 ++++++++++++++++ .../rf/ClientRfSessionDataReplicatedImpl.java | 249 ++++++++++++ .../ro/ClientRoSessionDataReplicatedImpl.java | 326 ++++++++++++++++ .../rx/ClientRxSessionDataReplicatedImpl.java | 141 +++++++ .../ClientS13SessionDataReplicatedImpl.java | 61 +++ .../sh/ShClientSessionDataReplicatedImpl.java | 81 ++++ .../common/AppSessionDataReplicatedImpl.java | 127 +++++++ .../acc/AccReplicatedSessionDataFactory.java | 94 +++++ .../AuthReplicatedSessionDataFactory.java | 92 +++++ .../cca/CCAReplicatedSessionDataFactory.java | 94 +++++ .../CxDxReplicatedSessionDataFactory.java | 95 +++++ .../cxdx/CxDxSessionDataReplicatedImpl.java | 179 +++++++++ .../gx/GxReplicatedSessionDataFactory.java | 94 +++++ .../rf/RfReplicatedSessionDataFactory.java | 94 +++++ .../ro/RoReplicatedSessionDataFactory.java | 94 +++++ .../rx/RxReplicatedSessionDataFactory.java | 94 +++++ .../s13/S13ReplicatedSessionDataFactory.java | 72 ++++ .../s13/S13SessionDataReplicatedImpl.java | 156 ++++++++ .../sh/ShReplicatedSessionDataFactory.java | 93 +++++ .../ha/data/ReplicatedSessionDatasource.java | 354 ++++++++++++++++++ .../ServerAccSessionDataReplicatedImpl.java | 191 ++++++++++ .../ServerAuthSessionDataReplicatedImpl.java | 191 ++++++++++ .../ServerCCASessionDataReplicatedImpl.java | 180 +++++++++ .../ServerCxDxSessionDataReplicatedImpl.java | 84 +++++ .../gx/ServerGxSessionDataReplicatedImpl.java | 182 +++++++++ .../rf/ServerRfSessionDataReplicatedImpl.java | 211 +++++++++++ .../ro/ServerRoSessionDataReplicatedImpl.java | 180 +++++++++ .../rx/ServerRxSessionDataReplicatedImpl.java | 144 +++++++ .../ServerS13SessionDataReplicatedImpl.java | 61 +++ .../sh/ShServerSessionDataReplicatedImpl.java | 81 ++++ .../impl/ha/timer/DiameterTimerTaskData.java | 77 ++++ .../ha/timer/ReplicatedTimerFacilityImpl.java | 147 ++++++++ 37 files changed, 5614 insertions(+) create mode 100644 core/jdiameter-ha/impl-jboss5/pom.xml create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java create mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java diff --git a/core/jdiameter-ha/impl-jboss5/pom.xml b/core/jdiameter-ha/impl-jboss5/pom.xml new file mode 100644 index 000000000..da451f5e7 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + + org.mobicents.diameter + jdiameter-ha-parent + 1.7.0-SNAPSHOT + ../pom.xml + + + jdiameter-ha-impl-jboss5 + + Restcomm :: Diameter Stack HA :: ${project.artifactId} + + + + ${project.groupId} + jdiameter-ha-api + ${project.version} + + + + org.mobicents.diameter + jdiameter-impl + + + + + org.jboss.logging + jboss-logging-log4j + provided + + + + + org.jboss.cluster + jboss-ha-server-cache-jbc + + + + org.mobicents.cluster + cache + + + + org.mobicents.cluster + timers + + + + diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java new file mode 100644 index 000000000..0b2b71df6 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java @@ -0,0 +1,260 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.acc; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.acc.ClientAccSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.acc.IClientAccSessionData; +import org.jdiameter.common.api.app.acc.ClientAccSessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAccSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientAccSessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String INTERIM_TIMERID = "INTERIM_TIMERID"; + private static final String DEST_HOST = "DEST_HOST"; + private static final String DEST_REALM = "DEST_REALM"; + private static final String BUFFER = "BUFFER"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientAccSession.class); + setClientAccSessionState(ClientAccSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setClientAccSessionState + * (org.jdiameter.common.api.app.acc.ClientAccSessionState) + */ + @Override + public void setClientAccSessionState(ClientAccSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getClientAccSessionState() + */ + @Override + public ClientAccSessionState getClientAccSessionState() { + if (exists()) { + return (ClientAccSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setInterimTimerId(java.io.Serializable) + */ + @Override + public void setInterimTimerId(Serializable tid) { + if (exists()) { + getNode().put(INTERIM_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getInterimTimerId() + */ + @Override + public Serializable getInterimTimerId() { + if (exists()) { + return (Serializable) getNode().get(INTERIM_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationHost(java.lang.String) + */ + @Override + public void setDestinationHost(String destHost) { + if (exists()) { + getNode().put(DEST_HOST, destHost); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationHost() + */ + @Override + public String getDestinationHost() { + if (exists()) { + return (String) getNode().get(DEST_HOST); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationRealm(java.lang.String) + */ + @Override + public void setDestinationRealm(String destRealm) { + if (exists()) { + getNode().put(DEST_REALM, destRealm); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationRealm() + */ + @Override + public String getDestinationRealm() { + if (exists()) { + return (String) getNode().get(DEST_REALM); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java new file mode 100644 index 000000000..67dce12ae --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java @@ -0,0 +1,243 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.auth; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.auth.ClientAuthSession; +import org.jdiameter.client.impl.app.auth.IClientAuthSessionData; +import org.jdiameter.common.api.app.auth.ClientAuthSessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAuthSessionData { + + private static final String STATE = "STATE"; + private static final String DESTINATION_HOST = "DESTINATION_HOST"; + private static final String DESTINATION_REALM = "DESTINATION_REALM"; + private static final String STATELESS = "STATELESS"; + private static final String TS_TIMERID = "TS_TIMERID"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientAuthSession.class); + setClientAuthSessionState(ClientAuthSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setClientAuthSessionState(org.jdiameter.common.api.app.auth. + * ClientAuthSessionState) + */ + @Override + public void setClientAuthSessionState(ClientAuthSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getClientAuthSessionState() + */ + @Override + public ClientAuthSessionState getClientAuthSessionState() { + if (exists()) { + return (ClientAuthSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setStateless(boolean) + */ + @Override + public void setStateless(boolean b) { + if (exists()) { + getNode().put(STATELESS, b); + } + else { + throw new IllegalStateException(); + } + + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationHost() + */ + @Override + public String getDestinationHost() { + if (exists()) { + return (String) getNode().get(DESTINATION_HOST); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationHost(java.lang.String) + */ + @Override + public void setDestinationHost(String host) { + if (exists()) { + getNode().put(DESTINATION_HOST, host); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationRealm() + */ + @Override + public String getDestinationRealm() { + if (exists()) { + return (String) getNode().get(DESTINATION_REALM); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationRealm(java.lang.String) + */ + @Override + public void setDestinationRealm(String realm) { + if (exists()) { + getNode().put(DESTINATION_REALM, realm); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java new file mode 100644 index 000000000..f0bb81db0 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java @@ -0,0 +1,327 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.cca; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.cca.ClientCCASession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.cca.IClientCCASessionData; +import org.jdiameter.common.api.app.cca.ClientCCASessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientCCASessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientCCASessionDataReplicatedImpl.class); + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + private static final String TXTIMER_ID = "TXTIMER_ID"; + private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; + private static final String BUFFER = "BUFFER"; + private static final String GRA = "GRA"; + private static final String GDDFH = "GDDFH"; + private static final String GCCFH = "GCCFH"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientCCASession.class); + setClientCCASessionState(ClientCCASessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ClientCCASessionState getClientCCASessionState() { + if (exists()) { + return (ClientCCASessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientCCASessionState(ClientCCASessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTxTimerId() { + if (exists()) { + return (Serializable) getNode().get(TXTIMER_ID); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerId(Serializable txTimerId) { + if (exists()) { + getNode().put(TXTIMER_ID, txTimerId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getTxTimerRequest() { + if (exists()) { + + byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate Tx Timer Request from buffer."); + return null; + } + } + else { + return null; + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerRequest(Request txTimerRequest) { + if (exists()) { + if (txTimerRequest != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); + getNode().put(TXTIMER_REQUEST, data); + } + catch (ParseException e) { + logger.error("Unable to encode Tx Timer Request to buffer."); + } + } + else { + getNode().remove(TXTIMER_REQUEST); + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + @Override + public int getGatheredRequestedAction() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GRA)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredRequestedAction(int gatheredRequestedAction) { + if (exists()) { + getNode().put(GRA, gatheredRequestedAction); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredCCFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GCCFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredCCFH(int gatheredCCFH) { + if (exists()) { + getNode().put(GCCFH, gatheredCCFH); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredDDFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GDDFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredDDFH(int gatheredDDFH) { + if (exists()) { + getNode().put(GDDFH, gatheredDDFH); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..2ce7d8f29 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java @@ -0,0 +1,84 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.cxdx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.cxdx.ClientCxDxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.app.cxdx.IClientCxDxSessionData; +import org.jdiameter.common.api.app.cxdx.CxDxSessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IClientCxDxSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ClientCxDxSession.class); + setCxDxSessionState(CxDxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..bb9761e41 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java @@ -0,0 +1,329 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.gx; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.gx.ClientGxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.gx.IClientGxSessionData; +import org.jdiameter.common.api.app.gx.ClientGxSessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientGxSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientGxSessionDataReplicatedImpl.class); + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + private static final String TXTIMER_ID = "TXTIMER_ID"; + private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; + private static final String BUFFER = "BUFFER"; + private static final String GRA = "GRA"; + private static final String GDDFH = "GDDFH"; + private static final String GCCFH = "GCCFH"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientGxSession.class); + setClientGxSessionState(ClientGxSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ClientGxSessionState getClientGxSessionState() { + if (exists()) { + return (ClientGxSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientGxSessionState(ClientGxSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTxTimerId() { + if (exists()) { + return (Serializable) getNode().get(TXTIMER_ID); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerId(Serializable txTimerId) { + if (exists()) { + getNode().put(TXTIMER_ID, txTimerId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getTxTimerRequest() { + if (exists()) { + + byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate Tx Timer Request from buffer."); + return null; + } + } + else { + return null; + } + + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerRequest(Request txTimerRequest) { + if (exists()) { + if (txTimerRequest != null) { + + try { + byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); + getNode().put(TXTIMER_REQUEST, data); + } + catch (ParseException e) { + logger.error("Unable to encode Tx Timer Request to buffer."); + } + } + else { + getNode().remove(TXTIMER_REQUEST); + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + @Override + public int getGatheredRequestedAction() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GRA)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredRequestedAction(int gatheredRequestedAction) { + if (exists()) { + getNode().put(GRA, gatheredRequestedAction); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredCCFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GCCFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredCCFH(int gatheredCCFH) { + if (exists()) { + getNode().put(GCCFH, gatheredCCFH); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredDDFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GDDFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredDDFH(int gatheredDDFH) { + if (exists()) { + getNode().put(GDDFH, gatheredDDFH); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java new file mode 100644 index 000000000..ab9a92c68 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java @@ -0,0 +1,249 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.rf; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.rf.ClientRfSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.rf.IClientRfSessionData; +import org.jdiameter.common.api.app.rf.ClientRfSessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRfSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientRfSessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String BUFFER = "BUFFER"; + private static final String TS_TIMERID = "TS_TIMERID"; + private static final String DESTINATION_HOST = "DESTINATION_HOST"; + private static final String DESTINATION_REALM = "DESTINATION_REALM"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientRfSession.class); + setClientRfSessionState(ClientRfSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public ClientRfSessionState getClientRfSessionState() { + if (exists()) { + return (ClientRfSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientRfSessionState(ClientRfSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationHost() + */ + @Override + public String getDestinationHost() { + if (exists()) { + return (String) getNode().get(DESTINATION_HOST); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationHost(java.lang.String) + */ + @Override + public void setDestinationHost(String destinationHost) { + if (exists()) { + getNode().put(DESTINATION_HOST, destinationHost); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationRealm() + */ + @Override + public String getDestinationRealm() { + if (exists()) { + return (String) getNode().get(DESTINATION_REALM); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationRealm(java.lang.String) + */ + @Override + public void setDestinationRealm(String destinationRealm) { + if (exists()) { + getNode().put(DESTINATION_REALM, destinationRealm); + } + else { + throw new IllegalStateException(); + } + } +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java new file mode 100644 index 000000000..f1a150ac0 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java @@ -0,0 +1,326 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.ro; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.ro.ClientRoSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.ro.IClientRoSessionData; +import org.jdiameter.common.api.app.ro.ClientRoSessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRoSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientRoSessionDataReplicatedImpl.class); + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + private static final String TXTIMER_ID = "TXTIMER_ID"; + private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; + private static final String BUFFER = "BUFFER"; + private static final String GRA = "GRA"; + private static final String GDDFH = "GDDFH"; + private static final String GCCFH = "GCCFH"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientRoSession.class); + setClientRoSessionState(ClientRoSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ClientRoSessionState getClientRoSessionState() { + if (exists()) { + return (ClientRoSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientRoSessionState(ClientRoSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTxTimerId() { + if (exists()) { + return (Serializable) getNode().get(TXTIMER_ID); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerId(Serializable txTimerId) { + if (exists()) { + getNode().put(TXTIMER_ID, txTimerId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getTxTimerRequest() { + if (exists()) { + byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate Tx Timer Request from buffer."); + return null; + } + } + else { + return null; + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerRequest(Request txTimerRequest) { + if (exists()) { + if (txTimerRequest != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); + getNode().put(TXTIMER_REQUEST, data); + } + catch (ParseException e) { + logger.error("Unable to encode Tx Timer Request to buffer."); + } + } + else { + getNode().remove(TXTIMER_REQUEST); + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + @Override + public int getGatheredRequestedAction() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GRA)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredRequestedAction(int gatheredRequestedAction) { + if (exists()) { + getNode().put(GRA, gatheredRequestedAction); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredCCFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GCCFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredCCFH(int gatheredCCFH) { + if (exists()) { + getNode().put(GCCFH, gatheredCCFH); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredDDFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GDDFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredDDFH(int gatheredDDFH) { + if (exists()) { + getNode().put(GDDFH, gatheredDDFH); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..74ca87c46 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java @@ -0,0 +1,141 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.rx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.rx.ClientRxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.app.rx.IClientRxSessionData; +import org.jdiameter.common.api.app.rx.ClientRxSessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRxSessionData { + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientRxSession.class); + setClientRxSessionState(ClientRxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } else { + throw new IllegalStateException(); + } + } + + @Override + public ClientRxSessionState getClientRxSessionState() { + if (exists()) { + return (ClientRxSessionState) getNode().get(STATE); + } else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientRxSessionState(ClientRxSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } else { + throw new IllegalStateException(); + } + } +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java new file mode 100644 index 000000000..52a7d935e --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java @@ -0,0 +1,61 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.client.s13; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.s13.ClientS13Session; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.app.s13.IClientS13SessionData; +import org.jdiameter.common.api.app.s13.S13SessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IClientS13SessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ClientS13Session.class); + setS13SessionState(S13SessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java new file mode 100644 index 000000000..8172f55cd --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java @@ -0,0 +1,81 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.sh; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.sh.ClientShSession; +import org.jdiameter.client.impl.app.sh.IShClientSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ShClientSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShClientSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientShSession.class); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ShClientSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java new file mode 100644 index 000000000..56ba70d3d --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java @@ -0,0 +1,127 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common; + +import org.jboss.cache.Fqn; +import org.jboss.cache.Node; +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.common.api.app.IAppSessionData; +import org.mobicents.cache.MobicentsCache; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.cluster.cache.ClusteredCacheData; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class AppSessionDataReplicatedImpl extends ClusteredCacheData implements IAppSessionData { + + protected static final String SID = "SID"; + protected static final String APID = "APID"; + protected static final String SIFACE = "SIFACE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + */ + public AppSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + } + + public AppSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + public static void setAppSessionIface(ClusteredCacheData ccd, Class iface) { + Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); + n.put(SIFACE, iface); + } + + public static Class getAppSessionIface(MobicentsCache mcCache, String sessionId) { + Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); + return (Class) n.get(SIFACE); + } + + @Override + public String getSessionId() { + return (String) super.getNodeFqn().getLastElement(); + } + + @Override + public void setApplicationId(ApplicationId applicationId) { + if (exists()) { + getNode().put(APID, applicationId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ApplicationId getApplicationId() { + if (exists()) { + return (ApplicationId) getNode().get(APID); + } + else { + throw new IllegalStateException(); + } + } + + // Some util methods for handling primitives + + protected boolean toPrimitive(Boolean b, boolean _default) { + return b == null ? _default : b; + } + + protected int toPrimitive(Integer i) { + return i == null ? NON_INITIALIZED : i; + } + + protected long toPrimitive(Long l) { + return l == null ? NON_INITIALIZED : l; + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java new file mode 100644 index 000000000..6efc94304 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.acc; + +import org.jdiameter.api.acc.ClientAccSession; +import org.jdiameter.api.acc.ServerAccSession; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.acc.IAccSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.acc.ClientAccSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.acc.ServerAccSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class AccReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public AccReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IAccSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientAccSession.class)) { + ClientAccSessionDataReplicatedImpl data = + new ClientAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerAccSession.class)) { + ServerAccSessionDataReplicatedImpl data = new ServerAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java new file mode 100644 index 000000000..9f5e73296 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java @@ -0,0 +1,92 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.auth; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.auth.ClientAuthSession; +import org.jdiameter.api.auth.ServerAuthSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.auth.IAuthSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.auth.ClientAuthSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.auth.ServerAuthSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class AuthReplicatedSessionDataFactory implements IAppSessionDataFactory { + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public AuthReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IAuthSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientAuthSession.class)) { + ClientAuthSessionDataReplicatedImpl data = new ClientAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + else if (clazz.equals(ServerAuthSession.class)) { + ServerAuthSessionDataReplicatedImpl data = new ServerAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java new file mode 100644 index 000000000..b603fe779 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.cca; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.cca.ClientCCASession; +import org.jdiameter.api.cca.ServerCCASession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.cca.ICCASessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.cca.ClientCCASessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.cca.ServerCCASessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class CCAReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public CCAReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public ICCASessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientCCASession.class)) { + ClientCCASessionDataReplicatedImpl data = + new ClientCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerCCASession.class)) { + ServerCCASessionDataReplicatedImpl data = new ServerCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java new file mode 100644 index 000000000..62ea766ca --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java @@ -0,0 +1,95 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.cxdx; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.cxdx.ClientCxDxSession; +import org.jdiameter.api.cxdx.ServerCxDxSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.cxdx.ClientCxDxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.cxdx.ServerCxDxSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class CxDxReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public CxDxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public ICxDxSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientCxDxSession.class)) { + ClientCxDxSessionDataReplicatedImpl data = + new ClientCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerCxDxSession.class)) { + ServerCxDxSessionDataReplicatedImpl data = + new ServerCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..6a167ab19 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java @@ -0,0 +1,179 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.cxdx; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.common.api.app.cxdx.CxDxSessionState; +import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public abstract class CxDxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements ICxDxSessionData { + + private static final Logger logger = LoggerFactory.getLogger(CxDxSessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String BUFFER = "BUFFER"; + private static final String TS_TIMERID = "TS_TIMERID"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setCxDxSessionState(org.jdiameter.common.api.app.cxdx.CxDxSessionState) + */ + @Override + public void setCxDxSessionState(CxDxSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getCxDxSessionState() + */ + @Override + public CxDxSessionState getCxDxSessionState() { + if (exists()) { + return (CxDxSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java new file mode 100644 index 000000000..7729b240e --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.gx; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.gx.ClientGxSession; +import org.jdiameter.api.gx.ServerGxSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.gx.IGxSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.gx.ClientGxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.gx.ServerGxSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class GxReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public GxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IGxSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientGxSession.class)) { + ClientGxSessionDataReplicatedImpl data = + new ClientGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerGxSession.class)) { + ServerGxSessionDataReplicatedImpl data = new ServerGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java new file mode 100644 index 000000000..a4b96f384 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.rf; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.rf.ClientRfSession; +import org.jdiameter.api.rf.ServerRfSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.rf.IRfSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.rf.ClientRfSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.rf.ServerRfSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class RfReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public RfReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IRfSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientRfSession.class)) { + ClientRfSessionDataReplicatedImpl data = + new ClientRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerRfSession.class)) { + ServerRfSessionDataReplicatedImpl data = new ServerRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java new file mode 100644 index 000000000..d9ccb6bad --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.ro; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.ro.ClientRoSession; +import org.jdiameter.api.ro.ServerRoSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.ro.IRoSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.ro.ClientRoSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.ro.ServerRoSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class RoReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public RoReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IRoSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientRoSession.class)) { + ClientRoSessionDataReplicatedImpl data = + new ClientRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerRoSession.class)) { + ServerRoSessionDataReplicatedImpl data = new ServerRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java new file mode 100644 index 000000000..726a12a73 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.rx; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.rx.ClientRxSession; +import org.jdiameter.api.rx.ServerRxSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.rx.IRxSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.rx.ClientRxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.rx.ServerRxSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class RxReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public RxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IRxSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientRxSession.class)) { + ClientRxSessionDataReplicatedImpl data = + new ClientRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerRxSession.class)) { + ServerRxSessionDataReplicatedImpl data = new ServerRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java new file mode 100644 index 000000000..8fb1cda2e --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java @@ -0,0 +1,72 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.common.s13; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.s13.ClientS13Session; +import org.jdiameter.api.s13.ServerS13Session; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.s13.IS13SessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.s13.ClientS13SessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.s13.ServerS13SessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class S13ReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public S13ReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IS13SessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientS13Session.class)) { + ClientS13SessionDataReplicatedImpl data = + new ClientS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerS13Session.class)) { + ServerS13SessionDataReplicatedImpl data = + new ServerS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java new file mode 100644 index 000000000..e75ad3194 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java @@ -0,0 +1,156 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.common.s13; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.common.api.app.s13.IS13SessionData; +import org.jdiameter.common.api.app.s13.S13SessionState; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public abstract class S13SessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IS13SessionData { + + private static final Logger logger = LoggerFactory.getLogger(S13SessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String BUFFER = "BUFFER"; + private static final String TS_TIMERID = "TS_TIMERID"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#setS13SessionState(org.jdiameter.common.api.app.s13.S13SessionState) + */ + @Override + public void setS13SessionState(S13SessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#getS13SessionState() + */ + @Override + public S13SessionState getS13SessionState() { + if (exists()) { + return (S13SessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java new file mode 100644 index 000000000..c01890200 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java @@ -0,0 +1,93 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.sh; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.sh.ClientShSession; +import org.jdiameter.api.sh.ServerShSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.sh.IShSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.sh.ShClientSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.sh.ShServerSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ShReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public ShReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData (java.lang.Class, java.lang.String) + */ + @Override + public IShSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientShSession.class)) { + ShClientSessionDataReplicatedImpl data = new ShClientSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + else if (clazz.equals(ServerShSession.class)) { + ShServerSessionDataReplicatedImpl data = new ShServerSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java new file mode 100644 index 000000000..6958f457d --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java @@ -0,0 +1,354 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.data; + +import java.util.HashMap; + +import javax.transaction.TransactionManager; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.BaseSession; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.NetworkReqListener; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.ISessionFactory; +import org.jdiameter.common.api.app.IAppSessionData; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.IAppSessionFactory; +import org.jdiameter.common.api.app.acc.IAccSessionData; +import org.jdiameter.common.api.app.auth.IAuthSessionData; +import org.jdiameter.common.api.app.cca.ICCASessionData; +import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; +import org.jdiameter.common.api.app.gx.IGxSessionData; +import org.jdiameter.common.api.app.rf.IRfSessionData; +import org.jdiameter.common.api.app.ro.IRoSessionData; +import org.jdiameter.common.api.app.rx.IRxSessionData; +import org.jdiameter.common.api.app.s13.IS13SessionData; +import org.jdiameter.common.api.app.sh.IShSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.jdiameter.common.impl.data.LocalDataSource; +import org.mobicents.cache.MobicentsCache; +import org.mobicents.cluster.DataRemovalListener; +import org.mobicents.cluster.DefaultMobicentsCluster; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.cluster.election.DefaultClusterElector; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.common.acc.AccReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.auth.AuthReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.cca.CCAReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.cxdx.CxDxReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.gx.GxReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.rf.RfReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.ro.RoReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.rx.RxReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.s13.S13ReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.sh.ShReplicatedSessionDataFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Replicated datasource implementation for {@link ISessionDatasource} + * + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +public class ReplicatedSessionDatasource implements ISessionDatasource, DataRemovalListener { + + private static final Logger logger = LoggerFactory.getLogger(ReplicatedSessionDatasource.class); + public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-jbc.xml"; + private IContainer container; + private ISessionDatasource localDataSource; + + private DefaultMobicentsCluster mobicentsCluster; + private boolean localMode; + + // provided by impl, no way to change that, no conf! :) + protected HashMap, IAppSessionDataFactory> appSessionDataFactories = + new HashMap, IAppSessionDataFactory>(); + + // Constants + // ---------------------------------------------------------------- + public static final String SESSIONS = "/diameter/appsessions"; + public static final Fqn SESSIONS_FQN = Fqn.fromString(SESSIONS); + + public ReplicatedSessionDatasource(IContainer container) { + this(container, new LocalDataSource(), ReplicatedSessionDatasource.class.getClassLoader().getResource(CLUSTER_DS_DEFAULT_FILE) == null ? + "config/" + CLUSTER_DS_DEFAULT_FILE : CLUSTER_DS_DEFAULT_FILE); + } + + public ReplicatedSessionDatasource(IContainer container, ISessionDatasource localDataSource, String cacheConfigFilename) { + super(); + this.localDataSource = localDataSource; + + MobicentsCache mcCache = new MobicentsCache(cacheConfigFilename); + TransactionManager txMgr = null; + try { + Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); + Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); + txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); + } + catch (Exception e) { + logger.debug("Could not fetch TxMgr. Not using one.", e); + // let's not have Tx Manager than... + } + + this.mobicentsCluster = new DefaultMobicentsCluster(mcCache, txMgr, new DefaultClusterElector()); + this.mobicentsCluster.addDataRemovalListener(this); // register, so we know WHEN some other node removes session. + this.mobicentsCluster.startCluster(); + + this.container = container; + // this is coded, its tied to specific impl of SessionDatasource + appSessionDataFactories.put(IAuthSessionData.class, new AuthReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IAccSessionData.class, new AccReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(ICCASessionData.class, new CCAReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IRoSessionData.class, new RoReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IRfSessionData.class, new RfReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IShSessionData.class, new ShReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(ICxDxSessionData.class, new CxDxReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IGxSessionData.class, new GxReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IRxSessionData.class, new RxReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IS13SessionData.class, new S13ReplicatedSessionDataFactory(this)); + + } + + @Override + public boolean exists(String sessionId) { + return this.localDataSource.exists(sessionId) ? true : this.existReplicated(sessionId); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#addSession(org.jdiameter .api.BaseSession) + */ + @Override + public void addSession(BaseSession session) { + // Simple as is, if its replicated, it will be already there :) + this.localDataSource.addSession(session); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#getSession(java.lang.String ) + */ + @Override + public BaseSession getSession(String sessionId) { + if (this.localDataSource.exists(sessionId)) { + return this.localDataSource.getSession(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + this.makeLocal(sessionId); + return this.localDataSource.getSession(sessionId); + } + + return null; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#getSessionListener(java .lang.String) + */ + @Override + public NetworkReqListener getSessionListener(String sessionId) { + if (this.localDataSource.exists(sessionId)) { + return this.localDataSource.getSessionListener(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + this.makeLocal(sessionId); + return this.localDataSource.getSessionListener(sessionId); + } + + return null; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSession(java.lang .String) + */ + @Override + public void removeSession(String sessionId) { + logger.debug("removeSession({}) in Local DataSource", sessionId); + + if (this.localDataSource.exists(sessionId)) { + this.localDataSource.removeSession(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + // FIXME: remove node. + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSessionListener( java.lang.String) + */ + @Override + public NetworkReqListener removeSessionListener(String sessionId) { + if (this.localDataSource.exists(sessionId)) { + return this.localDataSource.removeSessionListener(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + // does not make much sense ;[ + this.makeLocal(sessionId); + return this.localDataSource.removeSessionListener(sessionId); + } + + return null; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#setSessionListener(java .lang.String, org.jdiameter.api.NetworkReqListener) + */ + @Override + public void setSessionListener(String sessionId, NetworkReqListener data) { + if (this.localDataSource.exists(sessionId)) { + this.localDataSource.setSessionListener(sessionId, data); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + // does not make much sense ;[ + this.makeLocal(sessionId); + this.localDataSource.setSessionListener(sessionId, data); + } + } + + @Override + public void start() { + mobicentsCluster.getMobicentsCache().startCache(); + localMode = mobicentsCluster.getMobicentsCache().isLocalMode(); + } + + @Override + public void stop() { + mobicentsCluster.getMobicentsCache().stopCache(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.data.ISessionDatasource#isClustered() + */ + @Override + public boolean isClustered() { + return !localMode; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.data.ISessionDatasource#getDataFactory(java. lang.Class) + */ + @Override + public IAppSessionDataFactory getDataFactory(Class x) { + return this.appSessionDataFactories.get(x); + } + + // remove lst; + + public MobicentsCluster getMobicentsCluster() { + return this.mobicentsCluster; + } + + @Override + public void dataRemoved(Fqn sessionFqn) { + String sessionId = (String) sessionFqn.getLastElement(); + this.localDataSource.removeSession(sessionId); + } + + @Override + public Fqn getBaseFqn() { + return SESSIONS_FQN; + } + + /** + * @param sessionId + * @return + */ + private boolean existReplicated(String sessionId) { + if (!this.localMode && this.mobicentsCluster.getMobicentsCache().getJBossCache().getNode(Fqn.fromRelativeElements(SESSIONS_FQN, sessionId)) != null) { + return true; + } + return false; + } + + /** + * @param sessionId + */ + private void makeLocal(String sessionId) { + try { + // this is APP session, always + Class appSessionInterfaceClass = + AppSessionDataReplicatedImpl.getAppSessionIface(this.mobicentsCluster.getMobicentsCache(), sessionId); + // get factory; + // FIXME: make it a field? + IAppSessionFactory fct = ((ISessionFactory) this.container.getSessionFactory()).getAppSessionFactory(appSessionInterfaceClass); + if (fct == null) { + logger.warn("Session with id:{}, is in replicated data source, but no Application Session Factory for:{}.", sessionId, appSessionInterfaceClass); + return; + } + else { + BaseSession session = fct.getSession(sessionId, appSessionInterfaceClass); + this.localDataSource.addSession(session); + // hmmm + this.localDataSource.setSessionListener(sessionId, (NetworkReqListener) session); + return; + } + } + catch (IllegalDiameterStateException e) { + if (logger.isErrorEnabled()) { + logger.error("Failed to obtain factory from stack..."); + } + } + } + + // ------- local getter + + public IContainer getContainer() { + return this.container; + } +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java new file mode 100644 index 000000000..0a20e90fe --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java @@ -0,0 +1,191 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.acc; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.acc.ServerAccSession; +import org.jdiameter.common.api.app.acc.ServerAccSessionState; +import org.jdiameter.server.impl.app.acc.IServerAccSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAccSessionData { + + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + private static final String TS_TIMEOUT = "TS_TIMEOUT"; + private static final String TS_TIMERID = "TS_TIMERID"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerAccSession.class); + setServerAccSessionState(ServerAccSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerAccSessionState getServerAccSessionState() { + if (exists()) { + return (ServerAccSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerAccSessionState(ServerAccSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimeout(long value) { + if (exists()) { + getNode().put(TS_TIMEOUT, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public long getTsTimeout() { + if (exists()) { + return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimerId(Serializable value) { + if (exists()) { + getNode().put(TS_TIMERID, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java new file mode 100644 index 000000000..b49d2bc8c --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java @@ -0,0 +1,191 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.auth; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.auth.ServerAuthSession; +import org.jdiameter.common.api.app.auth.ServerAuthSessionState; +import org.jdiameter.server.impl.app.auth.IServerAuthSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAuthSessionData { + + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + private static final String TS_TIMEOUT = "TS_TIMEOUT"; + private static final String TS_TIMERID = "TS_TIMERID"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerAuthSession.class); + setServerAuthSessionState(ServerAuthSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerAuthSessionState getServerAuthSessionState() { + if (exists()) { + return (ServerAuthSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerAuthSessionState(ServerAuthSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimeout(long value) { + if (exists()) { + getNode().put(TS_TIMEOUT, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public long getTsTimeout() { + if (exists()) { + return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimerId(Serializable value) { + if (exists()) { + getNode().put(TS_TIMERID, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java new file mode 100644 index 000000000..d6c691fb3 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java @@ -0,0 +1,180 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.cca; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.cca.ServerCCASession; +import org.jdiameter.common.api.app.cca.ServerCCASessionState; +import org.jdiameter.server.impl.app.cca.IServerCCASessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerCCASessionData { + + private static final String TCCID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerCCASession.class); + setServerCCASessionState(ServerCCASessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerCCASessionState getServerCCASessionState() { + if (exists()) { + return (ServerCCASessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerCCASessionState(ServerCCASessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTccTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TCCID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTccTimerId() { + if (exists()) { + return (Serializable) getNode().get(TCCID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..370d1b26b --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java @@ -0,0 +1,84 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.cxdx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.cxdx.ServerCxDxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.common.api.app.cxdx.CxDxSessionState; +import org.jdiameter.server.impl.app.cxdx.IServerCxDxSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IServerCxDxSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ServerCxDxSession.class); + setCxDxSessionState(CxDxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..7405e4060 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java @@ -0,0 +1,182 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.gx; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.gx.ServerGxSession; +import org.jdiameter.common.api.app.gx.ServerGxSessionState; +import org.jdiameter.server.impl.app.gx.IServerGxSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerGxSessionData { + + private static final String TCCID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerGxSession.class); + setServerGxSessionState(ServerGxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerGxSessionState getServerGxSessionState() { + if (exists()) { + return (ServerGxSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerGxSessionState(ServerGxSessionState state) { + + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTccTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TCCID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTccTimerId() { + if (exists()) { + return (Serializable) getNode().get(TCCID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java new file mode 100644 index 000000000..18ff9f6f4 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java @@ -0,0 +1,211 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.rf; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.rf.ServerRfSession; +import org.jdiameter.common.api.app.rf.ServerRfSessionState; +import org.jdiameter.server.impl.app.rf.IServerRfSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRfSessionData { + + private static final String TS_TIMERID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + private static final String TS_TIMEOUT = "TS_TIMEOUT"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerRfSession.class); + setServerRfSessionState(ServerRfSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerRfSessionState getServerRfSessionState() { + if (exists()) { + return (ServerRfSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerRfSessionState(ServerRfSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TS_TIMERID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#getTsTimeout() + */ + @Override + public long getTsTimeout() { + if (exists()) { + return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#setTsTimeout(long) + */ + @Override + public void setTsTimeout(long l) { + if (exists()) { + getNode().put(TS_TIMEOUT, l); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java new file mode 100644 index 000000000..20217710f --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java @@ -0,0 +1,180 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.ro; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.ro.ServerRoSession; +import org.jdiameter.common.api.app.ro.ServerRoSessionState; +import org.jdiameter.server.impl.app.ro.IServerRoSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRoSessionData { + + private static final String TCCID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerRoSession.class); + setServerRoSessionState(ServerRoSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerRoSessionState getServerRoSessionState() { + if (exists()) { + return (ServerRoSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerRoSessionState(ServerRoSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTccTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TCCID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTccTimerId() { + if (exists()) { + return (Serializable) getNode().get(TCCID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..5a2f1460d --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java @@ -0,0 +1,144 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.rx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.rx.ServerRxSession; +import org.jdiameter.common.api.app.rx.ServerRxSessionState; +import org.jdiameter.server.impl.app.rx.IServerRxSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRxSessionData { + + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerRxSession.class); + setServerRxSessionState(ServerRxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerRxSessionState getServerRxSessionState() { + if (exists()) { + return (ServerRxSessionState) getNode().get(STATE); + } else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerRxSessionState(ServerRxSessionState state) { + + if (exists()) { + getNode().put(STATE, state); + } else { + throw new IllegalStateException(); + } + + } +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java new file mode 100644 index 000000000..ce344e407 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java @@ -0,0 +1,61 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.server.s13; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.s13.ServerS13Session; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.common.api.app.s13.S13SessionState; +import org.jdiameter.server.impl.app.s13.IServerS13SessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IServerS13SessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ServerS13Session.class); + setS13SessionState(S13SessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java new file mode 100644 index 000000000..b41789c99 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java @@ -0,0 +1,81 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.sh; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.sh.ServerShSession; +import org.jdiameter.server.impl.app.sh.IShServerSessionData; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ShServerSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShServerSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerShSession.class); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ShServerSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java new file mode 100644 index 000000000..919d748b0 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java @@ -0,0 +1,77 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.timer; + +import java.io.Serializable; + +import org.mobicents.timers.PeriodicScheduleStrategy; +import org.mobicents.timers.TimerTaskData; + +/** + * Diameter timer task data holder. + * + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +final class DiameterTimerTaskData extends TimerTaskData { + + private static final long serialVersionUID = 8774218122384404225L; + + // data we need to recreate timer task + private String sessionId; + private String timerName; + + DiameterTimerTaskData(Serializable id, long delay, String sessionId, String timerName) { + super(id, System.currentTimeMillis() + delay, -1, PeriodicScheduleStrategy.withFixedDelay); + this.sessionId = sessionId; + this.timerName = timerName; + } + + public String getSessionId() { + return sessionId; + } + + public String getTimerName() { + return timerName; + } +} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java new file mode 100644 index 000000000..9f4a92242 --- /dev/null +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java @@ -0,0 +1,147 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.timer; + +import java.io.Serializable; + +import org.jdiameter.api.BaseSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.jdiameter.common.api.timer.ITimerFacility; +import org.jdiameter.common.impl.app.AppSessionImpl; +import org.mobicents.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.timers.FaultTolerantScheduler; +import org.mobicents.timers.TimerTask; +import org.mobicents.timers.TimerTaskData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Replicated implementation of {@link ITimerFacility} + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ReplicatedTimerFacilityImpl implements ITimerFacility { + + private static final Logger logger = LoggerFactory.getLogger(ReplicatedTimerFacilityImpl.class); + + private ISessionDatasource sessionDataSource; + private TimerTaskFactory taskFactory; + private FaultTolerantScheduler ftScheduler; + + public ReplicatedTimerFacilityImpl(IContainer container) { + super(); + this.sessionDataSource = container.getAssemblerFacility().getComponentInstance(ISessionDatasource.class); + this.taskFactory = new TimerTaskFactory(); + MobicentsCluster cluster = ((ReplicatedSessionDatasource) this.sessionDataSource).getMobicentsCluster(); + this.ftScheduler = new FaultTolerantScheduler("DiameterTimer", 5, cluster, (byte) 12, null, this.taskFactory); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.timer.ITimerFacility#cancel(java.io.Serializable) + */ + @Override + public void cancel(Serializable id) { + logger.debug("Cancelling timer with id {}", id); + this.ftScheduler.cancel(id); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.timer.ITimerFacility#schedule(java.lang.String, java.lang.String, long) + */ + @Override + public Serializable schedule(String sessionId, String timerName, long miliseconds) throws IllegalArgumentException { + String id = sessionId + "/" + timerName; + logger.debug("Scheduling timer with id {}", id); + + if (this.ftScheduler.getTimerTaskData(id) != null) { + throw new IllegalArgumentException("Timer already running: " + id); + } + + DiameterTimerTaskData data = new DiameterTimerTaskData(id, miliseconds, sessionId, timerName); + TimerTask tt = this.taskFactory.newTimerTask(data); + ftScheduler.schedule(tt); + return id; + } + + private final class TimerTaskFactory implements org.mobicents.timers.TimerTaskFactory { + + @Override + public TimerTask newTimerTask(TimerTaskData data) { + return new DiameterTimerTask(data); + } + } + + private final class DiameterTimerTask extends TimerTask { + + DiameterTimerTask(TimerTaskData data) { + super(data); + } + + @Override + public void runTask() { + try { + DiameterTimerTaskData data = (DiameterTimerTaskData) getData(); + BaseSession bSession = sessionDataSource.getSession(data.getSessionId()); + if (bSession == null || !bSession.isAppSession()) { + // FIXME: error ? + return; + } + else { + AppSessionImpl impl = (AppSessionImpl) bSession; + impl.onTimer(data.getTimerName()); + } + } + catch (Exception e) { + logger.error("Failure executing timer task", e); + } + } + } + +} From 340cfccb67bc9b741554559548336a2cee9f87fb Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 15:28:16 +0200 Subject: [PATCH 18/75] Rename jDiameter HA impl module for WildFly from impl to impl-wildfly. --- .../{impl => impl-wildfly}/pom.xml | 2 +- .../ClientAccSessionDataReplicatedImpl.java | 0 .../ClientAuthSessionDataReplicatedImpl.java | 0 .../ClientCCASessionDataReplicatedImpl.java | 0 .../ClientCxDxSessionDataReplicatedImpl.java | 0 .../gx/ClientGxSessionDataReplicatedImpl.java | 0 .../rf/ClientRfSessionDataReplicatedImpl.java | 0 .../ro/ClientRoSessionDataReplicatedImpl.java | 0 .../rx/ClientRxSessionDataReplicatedImpl.java | 0 .../ClientS13SessionDataReplicatedImpl.java | 0 .../sh/ShClientSessionDataReplicatedImpl.java | 0 .../common/AppSessionDataReplicatedImpl.java | 0 .../acc/AccReplicatedSessionDataFactory.java | 0 .../AuthReplicatedSessionDataFactory.java | 0 .../cca/CCAReplicatedSessionDataFactory.java | 0 .../CxDxReplicatedSessionDataFactory.java | 0 .../cxdx/CxDxSessionDataReplicatedImpl.java | 0 .../gx/GxReplicatedSessionDataFactory.java | 0 .../rf/RfReplicatedSessionDataFactory.java | 0 .../ro/RoReplicatedSessionDataFactory.java | 0 .../rx/RxReplicatedSessionDataFactory.java | 0 .../s13/S13ReplicatedSessionDataFactory.java | 0 .../s13/S13SessionDataReplicatedImpl.java | 0 .../sh/ShReplicatedSessionDataFactory.java | 0 .../ha/data/ReplicatedSessionDatasource.java | 2 +- .../ServerAccSessionDataReplicatedImpl.java | 0 .../ServerAuthSessionDataReplicatedImpl.java | 0 .../ServerCCASessionDataReplicatedImpl.java | 0 .../ServerCxDxSessionDataReplicatedImpl.java | 0 .../gx/ServerGxSessionDataReplicatedImpl.java | 0 .../rf/ServerRfSessionDataReplicatedImpl.java | 0 .../ro/ServerRoSessionDataReplicatedImpl.java | 0 .../rx/ServerRxSessionDataReplicatedImpl.java | 0 .../ServerS13SessionDataReplicatedImpl.java | 0 .../sh/ShServerSessionDataReplicatedImpl.java | 0 .../impl/ha/timer/DiameterTimerTaskData.java | 0 .../ha/timer/ReplicatedTimerFacilityImpl.java | 0 .../common/config/jdiameter-infinispan.xml | 38 +++++++++++++++++++ .../test/resources/jdiameter-infinispan.xml | 32 ++++++++++++++++ 39 files changed, 72 insertions(+), 2 deletions(-) rename core/jdiameter-ha/{impl => impl-wildfly}/pom.xml (96%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java (97%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java (100%) rename core/jdiameter-ha/{impl => impl-wildfly}/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java (100%) create mode 100644 core/mux/common/config/jdiameter-infinispan.xml create mode 100644 testsuite/tests/src/test/resources/jdiameter-infinispan.xml diff --git a/core/jdiameter-ha/impl/pom.xml b/core/jdiameter-ha/impl-wildfly/pom.xml similarity index 96% rename from core/jdiameter-ha/impl/pom.xml rename to core/jdiameter-ha/impl-wildfly/pom.xml index ca330555d..74a55d071 100644 --- a/core/jdiameter-ha/impl/pom.xml +++ b/core/jdiameter-ha/impl-wildfly/pom.xml @@ -9,7 +9,7 @@ ../pom.xml - jdiameter-ha-impl + jdiameter-ha-impl-wildfly Restcomm :: Diameter Stack HA :: ${project.artifactId} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java similarity index 97% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java index 39387aa16..fa52ea2a9 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java +++ b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java @@ -96,7 +96,7 @@ public class ReplicatedSessionDatasource implements ISessionDatasource, DataRemovalListener { private static final Logger logger = LoggerFactory.getLogger(ReplicatedSessionDatasource.class); - public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-jbc.xml"; + public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-infinispan.xml"; private IContainer container; private ISessionDatasource localDataSource; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java similarity index 100% rename from core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java rename to core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java diff --git a/core/mux/common/config/jdiameter-infinispan.xml b/core/mux/common/config/jdiameter-infinispan.xml new file mode 100644 index 000000000..08c37e49f --- /dev/null +++ b/core/mux/common/config/jdiameter-infinispan.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/testsuite/tests/src/test/resources/jdiameter-infinispan.xml b/testsuite/tests/src/test/resources/jdiameter-infinispan.xml new file mode 100644 index 000000000..45f3835e7 --- /dev/null +++ b/testsuite/tests/src/test/resources/jdiameter-infinispan.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From b4853425403bcc35f55adf5a08261d9c7dc6bf6b Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 15:28:41 +0200 Subject: [PATCH 19/75] Fixed jDiameter HA pom files. --- core/jdiameter-ha/api/pom.xml | 11 +++++++++-- core/jdiameter-ha/pom.xml | 20 +++++++++++++++++++- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/jdiameter-ha/api/pom.xml b/core/jdiameter-ha/api/pom.xml index aa74c7ce7..b6bf52432 100644 --- a/core/jdiameter-ha/api/pom.xml +++ b/core/jdiameter-ha/api/pom.xml @@ -20,17 +20,24 @@ - org.jboss.cache jbosscache-core provided + org.jboss.cluster jboss-ha-server-cache-jbc - --> + + + org.mobicents.cluster + timers + + + org.infinispan infinispan-core diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index a86020e58..153440d14 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -17,11 +17,13 @@ api - impl + impl-jboss5 + impl-wildfly 1.5.9.0-build538-SNAPSHOT + 1.15.11 3.0.0.8 8.2.4.Final 3.3.0.Final @@ -40,6 +42,22 @@ ${project.version} + + org.mobicents.cluster + core + ${mobicents.cluster.version} + + + org.mobicents.cluster + cache + ${mobicents.cluster.version} + + + org.mobicents.cluster + timers + ${mobicents.cluster.version} + + org.jboss.logging jboss-logging From 41bb75b897cf3c09da8f6b549c339671b63c7f49 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 15:29:29 +0200 Subject: [PATCH 20/75] Returned Mux for JBoss 5. --- core/mux/jar/pom.xml | 8 +- .../stack/DiameterStackMultiplexer.java | 993 ++++++++++++++++++ .../stack/DiameterStackMultiplexerMBean.java | 340 ++++++ core/mux/pom.xml | 67 +- core/mux/sar-jboss-5/pom.xml | 174 +++ .../main/resources/META-INF/jboss-beans.xml | 10 + .../main/resources/META-INF/jboss-service.xml | 3 + .../resources/META-INF/jboss-structure.xml | 15 + core/mux/sar-wildfly/pom.xml | 33 +- 9 files changed, 1600 insertions(+), 43 deletions(-) create mode 100644 core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java create mode 100644 core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java create mode 100644 core/mux/sar-jboss-5/pom.xml create mode 100644 core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml create mode 100644 core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml create mode 100644 core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml diff --git a/core/mux/jar/pom.xml b/core/mux/jar/pom.xml index ad78266ff..c2f3fad47 100644 --- a/core/mux/jar/pom.xml +++ b/core/mux/jar/pom.xml @@ -16,6 +16,12 @@ jar + + org.jboss.jbossas + jboss-as-system-jmx + ${jboss.version} + + org.jboss.spec jboss-javaee-6.0 @@ -41,7 +47,7 @@ org.mobicents.diameter - jdiameter-ha-impl + jdiameter-ha-impl-${ha.impl} diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java new file mode 100644 index 000000000..d033edf2e --- /dev/null +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java @@ -0,0 +1,993 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.stack; + +import static org.jdiameter.client.impl.helpers.Parameters.CeaTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.Concurrent; +import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityDescription; +import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityName; +import static org.jdiameter.client.impl.helpers.Parameters.ConcurrentEntityPoolSize; +import static org.jdiameter.client.impl.helpers.Parameters.DpaTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.DwaTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.IacTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.MessageTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.OwnDiameterURI; +import static org.jdiameter.client.impl.helpers.Parameters.OwnIPAddress; +import static org.jdiameter.client.impl.helpers.Parameters.OwnRealm; +import static org.jdiameter.client.impl.helpers.Parameters.OwnVendorID; +import static org.jdiameter.client.impl.helpers.Parameters.RealmEntry; +import static org.jdiameter.client.impl.helpers.Parameters.RealmTable; +import static org.jdiameter.client.impl.helpers.Parameters.RecTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerDelay; +import static org.jdiameter.client.impl.helpers.Parameters.StatisticsLoggerPause; +import static org.jdiameter.client.impl.helpers.Parameters.StopTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.UseUriAsFqdn; +import static org.jdiameter.server.impl.helpers.Parameters.AcceptUndefinedPeer; +import static org.jdiameter.server.impl.helpers.Parameters.DuplicateTimer; +import static org.jdiameter.server.impl.helpers.Parameters.OwnIPAddresses; +import static org.jdiameter.server.impl.helpers.Parameters.RealmHosts; +import static org.jdiameter.server.impl.helpers.Parameters.RealmName; + +import java.io.InputStream; +import java.net.InetAddress; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Set; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.locks.ReentrantLock; +import java.util.regex.Pattern; + +import javax.management.MBeanException; + +import org.jboss.system.ServiceMBeanSupport; +import org.jdiameter.api.Answer; +import org.jdiameter.api.ApplicationAlreadyUseException; +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.Avp; +import org.jdiameter.api.Configuration; +import org.jdiameter.api.DisconnectCause; +import org.jdiameter.api.EventListener; +import org.jdiameter.api.InternalException; +import org.jdiameter.api.LocalAction; +import org.jdiameter.api.Message; +import org.jdiameter.api.MutableConfiguration; +import org.jdiameter.api.MutablePeerTable; +import org.jdiameter.api.Network; +import org.jdiameter.api.NetworkReqListener; +import org.jdiameter.api.PeerTable; +import org.jdiameter.api.Request; +import org.jdiameter.api.ResultCode; +import org.jdiameter.api.Session; +import org.jdiameter.api.Stack; +import org.jdiameter.client.api.controller.IRealm; +import org.jdiameter.client.api.controller.IRealmTable; +import org.jdiameter.client.impl.DictionarySingleton; +import org.jdiameter.client.impl.controller.PeerImpl; +import org.jdiameter.client.impl.helpers.AppConfiguration; +import org.jdiameter.common.impl.validation.DictionaryImpl; +import org.jdiameter.server.impl.NetworkImpl; +import org.jdiameter.server.impl.StackImpl; +import org.jdiameter.server.impl.helpers.XMLConfiguration; +import org.mobicents.diameter.api.DiameterMessageFactory; +import org.mobicents.diameter.api.DiameterProvider; +import org.mobicents.diameter.dictionary.AvpDictionary; +import org.mobicents.diameter.stack.management.DiameterConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +public class DiameterStackMultiplexer extends ServiceMBeanSupport implements DiameterStackMultiplexerMBean, DiameterProvider, NetworkReqListener, + EventListener, DiameterMessageFactory { + + private static final Logger logger = LoggerFactory.getLogger(DiameterStackMultiplexer.class); + + protected Stack stack = null; + + protected HashMap> listenerToAppId = + new HashMap>(3); + protected HashMap appIdToListener = new HashMap(3); + + // This is for synch + protected ReentrantLock lock = new ReentrantLock(); + + protected DiameterProvider provider; + + // ===== STACK MANAGEMENT ===== + + private void initStack() throws Exception { + initStack(this.getClass().getClassLoader().getResourceAsStream("config/jdiameter-config.xml")); + } + + private void initStack(InputStream is) throws Exception { + try { + // Create and configure stack + this.stack = new StackImpl(); + + // Load the configuration + Configuration config = new XMLConfiguration(is); + + this.stack.init(config); + + Network network = stack.unwrap(Network.class); + + Set appIds = stack.getMetaData().getLocalPeer().getCommonApplications(); + + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Supporting {} applications.", appIds.size()); + } + //network.addNetworkReqListener(this, ApplicationId.createByAccAppId(193, 19302)); + + for (org.jdiameter.api.ApplicationId appId : appIds) { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Adding Listener for [{}].", appId); + } + network.addNetworkReqListener(this, appId); + + if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAcctAppId(), null); + } + else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAuthAppId(), null); + } + } + + try { + if (logger.isInfoEnabled()) { + logger.info("Parsing AVP Dictionary file..."); + } + AvpDictionary.INSTANCE.parseDictionary(Thread.currentThread().getContextClassLoader().getResourceAsStream("dictionary.xml")); + if (logger.isInfoEnabled()) { + logger.info("AVP Dictionary file successfuly parsed!"); + } + } + catch (Exception e) { + logger.error("Error while parsing dictionary file.", e); + } + + this.stack.start(); + } + finally { + if (is != null) { + is.close(); + } + + is = null; + } + + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Successfully initialized stack."); + } + } + + private void doStopStack(int disconnectCause) throws Exception { + try { + if (logger.isInfoEnabled()) { + logger.info("Stopping Diameter Mux Stack..."); + } + + stack.stop(10, TimeUnit.SECONDS, disconnectCause); + + if (logger.isInfoEnabled()) { + logger.info("Diameter Mux Stack Stopped Successfully."); + } + } + catch (Exception e) { + logger.error("Failure while stopping stack", e); + } + + stack.destroy(); + } + + private DiameterListener findListener(Message message) { + List appIds = message.getApplicationIdAvps(); + + if (appIds.size() > 0) { + for (org.jdiameter.api.ApplicationId appId : appIds) { + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: AVP AppId [" + appId + "]"); + } + + DiameterListener listener; + + Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); + + if ((listener = this.appIdToListener.get(appIdValue)) != null) { + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); + } + + return listener; + } + } + } + else { + Long appId = message.getApplicationId(); + + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: Header AppId [" + appId + "]"); + } + + DiameterListener listener; + + if ((listener = this.appIdToListener.get(appId)) != null) { + if (logger.isDebugEnabled()) { + logger.debug("Diameter Stack Mux :: findListener :: Found Listener [" + listener + "]"); + } + + return listener; + } + } + + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: findListener :: No Listener Found."); + } + + return null; + } + + // ===== NetworkReqListener IMPLEMENTATION ===== + + @Override + public Answer processRequest(Request request) { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: processRequest :: Command-Code [" + request.getCommandCode() + "]"); + } + + DiameterListener listener = findListener(request); + + if (listener != null) { + return listener.processRequest(request); + } + else { + try { + Answer answer = request.createAnswer(ResultCode.APPLICATION_UNSUPPORTED); + //this.stack.getSessionFactory().getNewRawSession().send(answer); + return answer; + } + catch (Exception e) { + logger.error("Failed to create APPLICATION UNSUPPORTED answer.", e); + } + } + return null; + } + + // ===== EventListener IMPLEMENTATION ===== + + @Override + public void receivedSuccessMessage(Request request, Answer answer) { + DiameterListener listener = findListener(request); + + if (listener != null) { + listener.receivedSuccessMessage(request, answer); + } + } + + @Override + public void timeoutExpired(Request request) { + DiameterListener listener = findListener(request); + + if (listener != null) { + listener.timeoutExpired(request); + } + } + + // ===== SERVICE LIFECYCLE MANAGEMENT ===== + + @Override + protected void startService() throws Exception { + super.startService(); + initStack(); + } + + @Override + protected void stopService() throws Exception { + super.stopService(); + doStopStack(DisconnectCause.REBOOTING); + } + + @Override + public String sendMessage(Message message) { + try { + Avp sessionId = null; + Session session = null; + + if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { + session = stack.getSessionFactory().getNewSession(); + } + else { + session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); + } + + session.send(message); + + return session.getSessionId(); + } + catch (Exception e) { + logger.error("", e); + } + + return null; + } + + @Override + public Message sendMessageSync(Message message) { + try { + Avp sessionId = null; + Session session = null; + + if ((sessionId = message.getAvps().getAvp(Avp.SESSION_ID)) == null) { + session = stack.getSessionFactory().getNewSession(); + } + else { + session = stack.getSessionFactory().getNewSession(sessionId.getUTF8String()); + } + + Future answer = session.send(message); + + return answer.get(); + } + catch (Exception e) { + logger.error("", e); + } + + return null; + } + + @Override + public Message createMessage(boolean isRequest, int commandCode, long applicationId) { + try { + Message message = this.stack.getSessionFactory().getNewRawSession(). + createMessage(commandCode, org.jdiameter.api.ApplicationId.createByAccAppId(applicationId), new Avp[]{}); + message.setRequest(isRequest); + + return message; + } + catch (Exception e) { + logger.error("Failure while creating message.", e); + } + + return null; + } + + @Override + public Message createRequest(int commandCode, long applicationId) { + return createMessage(true, commandCode, applicationId); + } + + @Override + public Message createAnswer(int commandCode, long applicationId) { + return createMessage(false, commandCode, applicationId); + } + + // ===== MBEAN OPERATIONS ===== + + @Override + public DiameterStackMultiplexerMBean getMultiplexerMBean() { + return this; + } + + @Override + public DiameterMessageFactory getMessageFactory() { + return this; + } + + @Override + public DiameterProvider getProvider() { + return this; + } + + @Override + public Stack getStack() { + return new DiameterStackProxy(this.stack); + } + + @Override + public void registerListener(DiameterListener listener, org.jdiameter.api.ApplicationId[] appIds) throws IllegalStateException { + if (listener == null) { + logger.warn("Trying to register a null Listener. Give up..."); + return; + } + + int curAppIdIndex = 0; + + try { + lock.lock(); + + // Register the selected appIds in the stack + Network network = stack.unwrap(Network.class); + + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Registering " + appIds.length + " applications."); + } + + for (; curAppIdIndex < appIds.length; curAppIdIndex++) { + org.jdiameter.api.ApplicationId appId = appIds[curAppIdIndex]; + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: Adding Listener for [" + appId + "]."); + } + network.addNetworkReqListener(this, appId); + + if (appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAcctAppId(), listener); + } + else if (appId.getAuthAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE) { + this.appIdToListener.put(appId.getAuthAppId(), listener); + } + } + + // And add the listener and it's holder + Collection registeredAppIds = this.listenerToAppId.get(listener); + + // Merge the existing (if any) with new. + if (registeredAppIds != null) { + registeredAppIds.addAll(Arrays.asList(appIds)); + } + else { + this.listenerToAppId.put(listener, Arrays.asList(appIds)); + } + } + catch (ApplicationAlreadyUseException aaue) { + // Let's remove what we've done so far... + try { + Network network = stack.unwrap(Network.class); + + for (; curAppIdIndex >= 0; curAppIdIndex--) { + ApplicationId appId = appIds[curAppIdIndex]; + Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); + + // Remove the app id from map + this.appIdToListener.remove(appIdValue); + + // Unregister it from stack listener + network.removeNetworkReqListener(appId); + } + } + catch (Exception e) { + logger.error("", e); + } + } + catch (Exception e) { + logger.error("", e); + } + finally { + lock.unlock(); + } + } + + @Override + public void unregisterListener(DiameterListener listener) { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: unregisterListener :: Listener [" + listener + "]"); + } + + if (listener == null) { + logger.warn("Diameter Stack Mux :: unregisterListener :: Trying to unregister a null Listener. Give up..."); + return; + } + + try { + lock.lock(); + + Collection appIds = this.listenerToAppId.remove(listener); + + if (appIds == null) { + logger.warn("Diameter Stack Mux :: unregisterListener :: Listener has no App-Ids registered. Give up..."); + return; + } + + Network network = stack.unwrap(Network.class); + + for (org.jdiameter.api.ApplicationId appId : appIds) { + try { + if (logger.isInfoEnabled()) { + logger.info("Diameter Stack Mux :: unregisterListener :: Unregistering AppId [" + appId + "]"); + } + + Long appIdValue = appId.getAcctAppId() != org.jdiameter.api.ApplicationId.UNDEFINED_VALUE ? appId.getAcctAppId() : appId.getAuthAppId(); + + // Remove the appid from map + this.appIdToListener.remove(appIdValue); + + // and unregister the listener from stack + network.removeNetworkReqListener(appId); + } + catch (Exception e) { + logger.error("", e); + } + } + } + catch (InternalException ie) { + logger.error("", ie); + } + finally { + lock.unlock(); + } + } + + // management operations ---------------------------------------------- + + /* + * -- MutableConfiguration Parameters -- + * Levels Parameters name + * Runtime + * y DuplicateTimer + * y AcceptUndefinedPeer + * y MessageTimeOut + * y StopTimeOut + * y CeaTimeOut + * y IacTimeOut + * y DwaTimeOut + * y DpaTimeOut + * y RecTimeOut + * y PeerTable, Peer, PeerName, PeerRating, PeerAttemptConnection (by NetWork interface) + * y RealmTable, Realm, RealmEntry RealmName, RealmHosts, RealmLocalAction, RealmEntryIsDynamic, RealmEntryExpTime (by NetWork interface) + * Restart stack + * y OwnDiameterURI + * y OwnIPAddresses, OwnIPAddress + * y OwnRealm + * y OwnVendorID + * n OwnProductName + * n OwnFirmwareRevision + * n ApplicationId, VendorId, AuthApplId, AcctApplId + * Not changeable + * n OverloadMonitor, OverloadMonitorEntry, OverloadMonitorData, OverloadEntryIndex, OverloadEntryhighThreshold, OverloadEntrylowThreshold + * n DuplicateProtection + * n QueueSize + */ + + private final String DEFAULT_STRING = "default_string"; + + private MutableConfiguration getMutableConfiguration() throws MBeanException { + return (MutableConfiguration) stack.getMetaData().getConfiguration(); + } + + private AppConfiguration getClientConfiguration() { + return org.jdiameter.client.impl.helpers.EmptyConfiguration.getInstance(); + } + + final Pattern IP_PATTERN = Pattern.compile("\\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" + + "\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b"); + + @Override + public void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException { + // validate ip address + if (IP_PATTERN.matcher(ipAddress).matches()) { + Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); + + List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); + AppConfiguration newIPAddress = getClientConfiguration().add(OwnIPAddress, ipAddress); + newIPAddressesConfig.add(newIPAddress); + + getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); + + if (logger.isInfoEnabled()) { + logger.info("Local Peer IP Address successfully changed to " + ipAddress + ". Restart to Diameter stack is needed to apply changes."); + } + } + else { + throw new MBeanException(new IllegalArgumentException("Invalid IP address entered (" + ipAddress + ")")); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_removeIPAddress(java.lang.String) + */ + @Override + public void _LocalPeer_removeIPAddress(String ipAddress) throws MBeanException { + Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); + + Configuration ipAddressToRemove = null; + + List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); + for (Configuration curIPAddress : newIPAddressesConfig) { + if (curIPAddress.getStringValue(OwnIPAddress.ordinal(), DEFAULT_STRING).equals(ipAddress)) { + ipAddressToRemove = curIPAddress; + break; + } + } + + if (ipAddressToRemove != null) { + newIPAddressesConfig.remove(ipAddressToRemove); + + getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); + + if (logger.isInfoEnabled()) { + logger.info("Local Peer IP Address " + ipAddress + " successfully added. Restart to Diameter stack is needed to apply changes."); + } + } + else { + if (logger.isInfoEnabled()) { + logger.info("Local Peer IP Address " + ipAddress + " not found. No changes were made."); + } + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setRealm(java.lang.String) + */ + @Override + public void _LocalPeer_setRealm(String realm) throws MBeanException { + getMutableConfiguration().setStringValue(OwnRealm.ordinal(), realm); + + if (logger.isInfoEnabled()) { + logger.info("Local Peer Realm successfully changed to '" + realm + "'. Restart to Diameter stack is needed to apply changes."); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setURI(java.lang.String) + */ + @Override + public void _LocalPeer_setURI(String uri) throws MBeanException { + // validate uri + try { + new URI(uri); + + getMutableConfiguration().setStringValue(OwnDiameterURI.ordinal(), uri); + + if (logger.isInfoEnabled()) { + logger.info("Local Peer URI successfully changed to '" + uri + "'. Restart to Diameter stack is needed to apply changes."); + } + } + catch (URISyntaxException use) { + throw new MBeanException(use); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_setVendorId(java.lang.String) + */ + @Override + public void _LocalPeer_setVendorId(long vendorId) throws MBeanException { + // validate vendor-id + try { + getMutableConfiguration().setLongValue(OwnVendorID.ordinal(), vendorId); + if (logger.isInfoEnabled()) { + logger.info("Local Peer Vendor-Id successfully changed to '" + vendorId + "'. Restart to Diameter stack is needed to apply changes."); + } + } + catch (NumberFormatException nfe) { + throw new MBeanException(nfe); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int) + */ + @Override + public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) throws MBeanException { + try { + NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); + /*Peer p =*/ n.addPeer(name, "", attemptConnect); // FIXME: This requires realm... + } + catch (IllegalArgumentException e) { + logger.warn(e.getMessage()); + } + catch (InternalException e) { + throw new MBeanException(e, "Failed to add peer with name '" + name + "'"); + } + } + + /* + * (non-Javadoc) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_removePeer(java.lang.String) + */ + @Override + public void _Network_Peers_removePeer(String name) throws MBeanException { + try { + MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); + n.removePeer(name); + } + catch (InternalException e) { + throw new MBeanException(e, "Failed to remove peer with name '" + name + "'"); + } + } + + @Override + public void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnect) throws MBeanException { + try { + NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); + /*Peer p =*/ n.addPeer(peerName, realmName, attemptConnect); + } + catch (IllegalArgumentException e) { + logger.warn(e.getMessage()); + } + catch (InternalException e) { + throw new MBeanException(e, "Failed to add peer with name '" + peerName + "' to realm '" + realmName + "'"); + } + } + + @Override + public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, + String agentConfiguration, boolean isDynamic, int expTime) throws MBeanException { + try { + org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); + ApplicationId appId = appAcctId == 0 ? org.jdiameter.api.ApplicationId.createByAuthAppId(appVendorId, appAuthId) : + org.jdiameter.api.ApplicationId.createByAccAppId(appVendorId, appAcctId); + org.jdiameter.api.Realm r = n.addRealm(name, appId, LocalAction.valueOf(localAction), agentConfiguration, isDynamic, expTime); + for (String peer : peers.split(",")) { + ((IRealm) r).addPeerName(peer); + } + } + catch (InternalException e) { + throw new MBeanException(e, "Failed to add realm with name '" + name + "'."); + } + } + + @Override + public void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId) throws MBeanException { + _Network_Realms_addRealm(name, peers, appVendorId, appAcctId, appAuthId, "LOCAL", null, false, 1); + } + + @Override + public void _Network_Realms_removePeerFromRealm(String realmName, String peerName) throws MBeanException { + try { + IRealmTable rt = stack.unwrap(IRealmTable.class); + for (org.jdiameter.api.Realm r : rt.getRealms()) { + if (r.getName().equals(realmName)) { + ((IRealm) r).removePeerName(peerName); + } + } + } + catch (InternalException e) { + throw new MBeanException(e, "Failed to add peer '" + peerName + "' from realm with '" + realmName + "'."); + } + } + + @Override + public void _Network_Realms_removeRealm(String name) throws MBeanException { + try { + org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); + n.remRealm(name); + } + catch (InternalException e) { + throw new MBeanException(e, "Failed to remove realm '" + name + "'."); + } + } + + @Override + public void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer) throws MBeanException { + getMutableConfiguration().setBooleanValue(AcceptUndefinedPeer.ordinal(), acceptUndefinedPeer); + } + + @Override + public void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn) throws MBeanException { + getMutableConfiguration().setBooleanValue(UseUriAsFqdn.ordinal(), useUriAsFqdn); + } + + @Override + public void _Parameters_setDuplicateTimer(long duplicateTimer) throws MBeanException { + getMutableConfiguration().setLongValue(DuplicateTimer.ordinal(), duplicateTimer); + } + + @Override + public void _Parameters_setMessageTimeout(long messageTimeout) throws MBeanException { + getMutableConfiguration().setLongValue(MessageTimeOut.ordinal(), messageTimeout); + } + + @Override + public void _Parameters_setStopTimeout(long stopTimeout) throws MBeanException { + getMutableConfiguration().setLongValue(StopTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setCeaTimeout(long stopTimeout) throws MBeanException { + getMutableConfiguration().setLongValue(CeaTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setIacTimeout(long stopTimeout) throws MBeanException { + getMutableConfiguration().setLongValue(IacTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setDwaTimeout(long stopTimeout) throws MBeanException { + getMutableConfiguration().setLongValue(DwaTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setDpaTimeout(long stopTimeout) throws MBeanException { + getMutableConfiguration().setLongValue(DpaTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setRecTimeout(long stopTimeout) throws MBeanException { + getMutableConfiguration().setLongValue(RecTimeOut.ordinal(), stopTimeout); + } + + @Override + public void _Parameters_setConcurrentEntity(String name, String desc, Integer size) throws MBeanException { + for (Configuration c : getMutableConfiguration().getChildren(Concurrent.ordinal())) { + if (name.equals(c.getStringValue(ConcurrentEntityName.ordinal(), null))) { + ((AppConfiguration) c).add(ConcurrentEntityPoolSize, size); + if (desc != null) { + ((AppConfiguration) c).add(ConcurrentEntityDescription, desc); + } + } + } + } + @Override + public void _Parameters_setStatisticLoggerDelay(long delay) throws MBeanException { + getMutableConfiguration().setLongValue(StatisticsLoggerDelay.ordinal(), delay); + } + + @Override + public void _Parameters_setStatisticLoggerPause(long pause) throws MBeanException { + getMutableConfiguration().setLongValue(StatisticsLoggerPause.ordinal(), pause); + } + + @Override + public void _Validation_setEnabled(boolean enableValidation) throws MBeanException { + ((DictionaryImpl) DictionarySingleton.getDictionary()).setEnabled(enableValidation) ; + } + + @Override + public String dumpStackConfiguration() throws MBeanException { + return getMutableConfiguration().toString(); + } + + @Override + public void startStack() throws MBeanException { + try { + this.stack.start(); + } + catch (Exception e) { + throw new MBeanException(e); + } + } + + @Override + public void stopStack(int disconnectCause) throws MBeanException { + try { + this.stack.stop(getMutableConfiguration().getLongValue(StopTimeOut.ordinal(), 10000L), TimeUnit.MILLISECONDS, disconnectCause); + } + catch (Exception e) { + throw new MBeanException(e); + } + } + + // Getters ------------------------------------------------------------- // + + @Override + public String _LocalPeer_getProductName() throws MBeanException { + return this.stack.getMetaData().getLocalPeer().getProductName(); + } + + @Override + public Long _LocalPeer_getVendorId() throws MBeanException { + return this.stack.getMetaData().getLocalPeer().getVendorId(); + } + + @Override + public Long _LocalPeer_getFirmware() throws MBeanException { + return this.stack.getMetaData().getLocalPeer().getFirmware(); + } + + @Override + public String _LocalPeer_getURI() throws MBeanException { + return this.stack.getMetaData().getLocalPeer().getUri().toString(); + } + + @Override + public String _LocalPeer_getRealmName() throws MBeanException { + return this.stack.getMetaData().getLocalPeer().getRealmName(); + } + + @Override + public InetAddress[] _LocalPeer_getIPAddresses() throws MBeanException { + return this.stack.getMetaData().getLocalPeer().getIPAddresses(); + } + + @Override + public Set _LocalPeer_getCommonApplicationIds() throws MBeanException { + return this.stack.getMetaData().getLocalPeer().getCommonApplications(); + } + + @Override + public String[] _Network_Realms_getRealms() throws MBeanException { + Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); + String[] realmNames = new String[realmEntries.length]; + + for (int i = 0; i < realmEntries.length; i++) { + realmNames[i] = realmEntries[i].getStringValue(RealmName.ordinal(), DEFAULT_STRING); + } + + return realmNames; + } + + @Override + public String[] _Network_Realms_getRealmPeers(String realmName) throws MBeanException { + Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); + String[] realmHosts = new String[realmEntries.length]; + + for (Configuration realmEntry : realmEntries) { + if (realmEntry.getStringValue(RealmName.ordinal(), DEFAULT_STRING).equals(realmName)) { + + String realmHostsString = realmEntry.getStringValue(RealmHosts.ordinal(), DEFAULT_STRING); + if (!realmHostsString.equals(DEFAULT_STRING)) { + realmHosts = realmHostsString.replaceAll(" ", "").split(","); + } + } + } + + return realmHosts; + } + + @Override + public DiameterConfiguration getDiameterConfiguration() throws MBeanException { + return new DiameterConfiguration(stack); + } + + @Override + public boolean _LocalPeer_isActive() throws MBeanException { + return this.stack.isActive(); + } + + @Override + public boolean _Network_Peers_isPeerConnected(String name) throws MBeanException { + try { + MutablePeerTable n = (MutablePeerTable) stack.unwrap(PeerTable.class); + PeerImpl p = ((PeerImpl) n.getPeer(name)); + return p != null ? p.getContext().isConnected() : false; + } + catch (Exception e) { + throw new MBeanException(e, "Failed to get connection availability for peer with name '" + "'."); + } + } + + +} diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java new file mode 100644 index 000000000..8599ac34f --- /dev/null +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java @@ -0,0 +1,340 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.stack; + +import java.net.InetAddress; +import java.util.Set; + +import javax.management.MBeanException; + +import org.jboss.system.ServiceMBean; +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.Stack; +import org.mobicents.diameter.api.DiameterMessageFactory; +import org.mobicents.diameter.api.DiameterProvider; +import org.mobicents.diameter.stack.management.DiameterConfiguration; + +/** + * + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +public interface DiameterStackMultiplexerMBean extends ServiceMBean { + + String MBEAN_NAME_PREFIX = "diameter:Service=DiameterStackMultiplexer,Name="; + + void registerListener(DiameterListener listener, ApplicationId[] appIds) throws IllegalStateException; + + void unregisterListener(DiameterListener listener); + + //For sake of simplicity in the pre Gamma :) + Stack getStack(); + + DiameterProvider getProvider(); + + DiameterMessageFactory getMessageFactory(); + + DiameterStackMultiplexerMBean getMultiplexerMBean(); + + // MANAGEMENT OPERATIONS + + // Get a Serializable Configuration + + DiameterConfiguration getDiameterConfiguration() throws MBeanException; + + // Local Peer ---------------------------------------------------------- + + /** + * Changes the URI of the Local Peer. + * + * @param uri the new URI to be used by the Local Peer + * @throws MBeanException if the operation is unable to perform correctly + */ + void _LocalPeer_setURI(String uri) throws MBeanException; + + /** + * Adds an IP Address to the Local Peer. + * @param ipAddress the IP Address to be added, if not present + * @throws MBeanException if the operation is unable to perform correctly + */ + void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException; + + /** + * Removes an IP Address from the Local Peer. + * + * @param ipAddress the IP Address to be removed, if present + * @throws MBeanException if the operation is unable to perform correctly + */ + void _LocalPeer_removeIPAddress(String ipAddress) throws MBeanException; + + /** + * Changes the Realm of the Local Peer. + * + * @param realm the new Realm to be used by the Local Peer + * @throws MBeanException if the operation is unable to perform correctly + */ + void _LocalPeer_setRealm(String realm) throws MBeanException; + + /** + * Sets the Local Peer Vendor-Id. + * + * @param vendorId the new Vendor-Id for the Peer + * @throws MBeanException if the operation is unable to perform correctly + */ + void _LocalPeer_setVendorId(long vendorId) throws MBeanException; + + // Parameters ---------------------------------------------------------- + + /** + * Sets whether the stack will accept connections from unknown peers or not (default: true) + * + * @param acceptUndefinedPeer indicates if the stack will accept unknown connections + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setAcceptUndefinedPeer(boolean acceptUndefinedPeer) throws MBeanException; + + /** + * Sets whether the stack will use URI (aaa://IP_ADDRESS:PORT) as FQDN. Some Peers require it. + * + * @param useUriAsFqdn indicates if the stack will use URI as FQDN + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setUseUriAsFqdn(boolean useUriAsFqdn) throws MBeanException; + + /** + * Sets the value to consider a message as a duplicate, in ms. (default: 240000, 4 minutes). + * + * @param duplicateTimer the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setDuplicateTimer(long duplicateTimer) throws MBeanException; + + // Parameters : Timeouts ----------------------------------------------- + + /** + * Sets the timeout for general Diameter messages, in ms. (default: 60000, 1 minute). + * + * @param messageTimeout the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setMessageTimeout(long messageTimeout) throws MBeanException; + + /** + * Sets the timeout for stopping the stack. (default: 10000, 10 seconds). + * + * @param stopTimeout the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setStopTimeout(long stopTimeout) throws MBeanException; + + /** + * Sets the timeout for CEA messages. (default: 10000, 10 seconds). + * + * @param ceaTimeout the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setCeaTimeout(long ceaTimeout) throws MBeanException; + + /** + * Sets the timeout for inactiveness. (default: 20000, 20 seconds). + * + * @param iacTimeout the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setIacTimeout(long iacTimeout) throws MBeanException; + + /** + * Sets the timeout for DWA messages. (default: 10000, 10 seconds). + * + * @param dwaTimeout the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setDwaTimeout(long dwaTimeout) throws MBeanException; + + /** + * Sets the timeout for DPA messages. (default: 5000, 5 seconds). + * + * @param dpaTimeout the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setDpaTimeout(long dpaTimeout) throws MBeanException; + + /** + * Sets the timeout for reconnecting. (default: 10000, 10 seconds). + * + * @param recTimeout the amount of time, in ms. + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Parameters_setRecTimeout(long recTimeout) throws MBeanException; + + void _Parameters_setConcurrentEntity(String name, String desc, Integer size) throws MBeanException; + + void _Parameters_setStatisticLoggerDelay(long delay) throws MBeanException; + + void _Parameters_setStatisticLoggerPause(long pause) throws MBeanException; + + // Network : Peers ----------------------------------------------------- + + /** + * Adds a peer definition to the stack. Same as element in XML Configuration. + * + * @param name the name/uri of the peer + * @param attemptConnect indicates if the stack should try to connect to this peer or wait for incoming connection + * @param rating the peer rating for decision on message routing + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) throws MBeanException; + + /** + * Removes a peer definition from stack. + * + * @param name the name/uri of the peer + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Network_Peers_removePeer(String name) throws MBeanException; + + // Network : Realms ---------------------------------------------------- + + /** + * Adds a new Realm to the stack. Same as element in XML Configuration. + * + * @param name the name of the Realm + * @param peers the Realm peer hosts, separated by comma + * @param appVendorId the vendor-id of the application supported by this realm + * @param appAcctId the accounting-id of the application supported by this realm + * @param appAuthId the authorization-id of the application supported by this realm + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId) throws MBeanException; + + void _Network_Realms_addRealm(String name, String peers, long appVendorId, long appAcctId, long appAuthId, String localAction, String agentConfiguration, + boolean isDynamic, int expTime) throws MBeanException; + + /** + * Removes a Realm from the stack. + * + * @param name the name of the Realm + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Network_Realms_removeRealm(String name) throws MBeanException; + + /** + * Adds a new Peer host to the Realm + * + * @param realmName the name of the Realm + * @param peerName the name/host of the Peer to be added + * @param attemptConnecting either try or not to connect the peer (client/server) + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Network_Realms_addPeerToRealm(String realmName, String peerName, boolean attemptConnecting) throws MBeanException; + + /** + * Removes a Peer host from the Realm + * + * @param realmName the name of the Realm + * @param peerName the name/host of the Peer to be removed + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Network_Realms_removePeerFromRealm(String realmName, String peerName) throws MBeanException; + + // Stack Operation ----------------------------------------------------- + + /** + * Operation to stop the stack. + * + * @throws MBeanException + */ + void stopStack(int disconnectCause) throws MBeanException; + + /** + * Operation to start the stack. + * + * @throws MBeanException + */ + void startStack() throws MBeanException; + + // Validation ---------------------------------------------------------- + + /** + * Sets whether validation on Diameter messages/AVPs should be performed or not. + * + * @param enableValidation flag indicating if validation should be performed + * @throws MBeanException if the operation is unable to perform correctly + */ + void _Validation_setEnabled(boolean enableValidation) throws MBeanException; + + // Configuration Dump -------------------------------------------------- + + /** + * Dumps full stack configuration. + * + * @return a String with stack configuration + * @throws MBeanException if the operation is unable to perform correctly + */ + String dumpStackConfiguration() throws MBeanException; + + // Information dump methods -------------------------------------------- + + String _LocalPeer_getProductName() throws MBeanException; + + Long _LocalPeer_getVendorId() throws MBeanException; + + Long _LocalPeer_getFirmware() throws MBeanException; + + String _LocalPeer_getURI() throws MBeanException; + + String _LocalPeer_getRealmName() throws MBeanException; + + InetAddress[] _LocalPeer_getIPAddresses() throws MBeanException; + + Set _LocalPeer_getCommonApplicationIds() throws MBeanException; + + String[] _Network_Realms_getRealms() throws MBeanException; + + String[] _Network_Realms_getRealmPeers(String realmName) throws MBeanException; + + boolean _LocalPeer_isActive() throws MBeanException; + + boolean _Network_Peers_isPeerConnected(String name) throws MBeanException; + +} diff --git a/core/mux/pom.xml b/core/mux/pom.xml index c78c0f4c1..f830b66b9 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -17,6 +17,7 @@ 1.5.9.0-build538-SNAPSHOT 1.1.0-SNAPSHOT + pom @@ -25,6 +26,52 @@ jar + + + maven-release + + sar-jboss-5 + sar-wildfly + + + + jboss5 + + + + ha.impl + jboss5 + + + + + sar-jboss-5 + + + + wildfly + + + + ha.impl + wildfly + + + + + sar-wildfly + + + + @@ -44,7 +91,7 @@ ${project.groupId} - jdiameter-ha-impl + jdiameter-ha-impl-${ha.impl} ${project.version} @@ -71,22 +118,4 @@ - - - maven-release - - sar-wildfly - - - - wildfly - - true - - - sar-wildfly - - - - diff --git a/core/mux/sar-jboss-5/pom.xml b/core/mux/sar-jboss-5/pom.xml new file mode 100644 index 000000000..03bab9ea9 --- /dev/null +++ b/core/mux/sar-jboss-5/pom.xml @@ -0,0 +1,174 @@ + + + 4.0.0 + + + org.mobicents.diameter + restcomm-diameter-mux-parent + 1.7.0-SNAPSHOT + ../pom.xml + + + restcomm-diameter-mux-sar-jboss-5 + + Restcomm :: Diameter Multiplexer :: ${project.artifactId} + + jboss-sar + + + + ${project.groupId} + restcomm-diameter-mux-jar + ${project.version} + runtime + + + + + restcomm-diameter-mux-${project.version} + + + + maven-resources-plugin + 2.7 + + + copy-resources + validate + + copy-resources + + + true + ${basedir}/target/classes/config + + + ../common/config + jdiameter-infinispan.xml + + + + + + + + + + org.codehaus.mojo + jboss-packaging-maven-plugin + 2.2 + true + + + apache-xerces:xml-apis + org.jboss.logging:jboss-logging-spi + org.jboss:jboss-common-core + org.jboss:jboss-vfs + org.jboss:jbossxb + org.jboss:jboss-reflect + wutka-dtdparser:dtdparser121 + javax.activation:activation + sun-jaxb:jaxb-api + org.jboss.deployers:jboss-deployers-core-spi + org.jboss.deployers:jboss-deployers-impl + org.jboss.deployers:jboss-deployers-spi + org.jboss.deployers:jboss-deployers-structure-spi + org.jboss.deployers:jboss-deployers-client-spi + org.jboss.man:jboss-managed + org.jboss.man:jboss-metatype + org.jboss:jboss-mdr + org.jboss.integration:jboss-classloading-spi + org.jboss.cl:jboss-classloading + org.jboss.cl:jboss-classloader + org.jboss.microcontainer:jboss-kernel + org.jboss.microcontainer:jboss-dependency + javassist:javassist + org.jboss.deployers:jboss-deployers-vfs + org.jboss.deployers:jboss-deployers-vfs-spi + stax:stax-api + org.jboss.cl:jboss-classloading-vfs + org.jboss.deployers:jboss-deployers-core + org.jboss.deployers:jboss-deployers-client + org.jboss.jbossas:jboss-as-j2se + oswego-concurrent:concurrent + org.jboss.bootstrap:jboss-bootstrap + org.jboss.jbossas:jboss-as-system + org.jboss.jbossas:jboss-as-system-jmx + org.jboss.aop:jboss-aop + org.apache.ant:ant + org.apache.ant:ant-launcher + qdox:qdox + trove:trove + log4j:log4j + org.jboss.logging:jboss-logging-log4j + org.jboss.integration:jboss-profileservice-spi + org.jboss.microcontainer:jboss-aop-mc-int + org.jboss.jbossas:jboss-as-jmx + org.jboss.jbossas:jboss-as-j2se + org.jboss.jbossas:jboss-as-mbeans + dom4j:dom4j + bcel:bcel + org.jboss.test:jboss-test + org.apache.ant:ant-junit + junit:junit + jboss.profiler.jvmti:jboss-profiler-jvmti + org.jboss.jbossas:jboss-server-manager + org.jboss.naming:jnp-client + org.jboss.security:jbosssx-client + org.jboss.security:jboss-security-spi + + xml-apis:xml-apis + + + + + + + + maven-antrun-plugin + + + deploy + install + + run + + + + + + + + + + + + + + + + + + + + + undeploy + clean + + run + + + + + + + + + + + + + diff --git a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml new file mode 100644 index 000000000..11694d23d --- /dev/null +++ b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-beans.xml @@ -0,0 +1,10 @@ + + + + + + @org.jboss.aop.microcontainer.aspects.jmx.JMX(name="diameter.mobicents:service=DiameterStackMultiplexer", exposedInterface=org.mobicents.diameter.stack.DiameterStackMultiplexerMBean.class, registerDirectly=true) + TransactionManager + + + diff --git a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml new file mode 100644 index 000000000..6439b1f28 --- /dev/null +++ b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-service.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml new file mode 100644 index 000000000..4a2d38d38 --- /dev/null +++ b/core/mux/sar-jboss-5/src/main/resources/META-INF/jboss-structure.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/core/mux/sar-wildfly/pom.xml b/core/mux/sar-wildfly/pom.xml index 7a19cf506..36b2d9703 100644 --- a/core/mux/sar-wildfly/pom.xml +++ b/core/mux/sar-wildfly/pom.xml @@ -201,13 +201,22 @@ + + + + + + @@ -243,6 +252,7 @@ + @@ -266,29 +276,6 @@ - From ff14a16b7226ee8169c892ed8096efce2e030b19 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 15:30:07 +0200 Subject: [PATCH 21/75] Fixed configurations for JBoss 5 Cache and WildFly Infinispan Cache. --- .../common/config/jdiameter-infinispan.xml | 17 ------------- core/mux/common/config/jdiameter-jbc.xml | 24 +------------------ .../test/resources/jdiameter-infinispan.xml | 11 --------- .../src/test/resources/jdiameter-jbc.xml | 24 +------------------ 4 files changed, 2 insertions(+), 74 deletions(-) diff --git a/core/mux/common/config/jdiameter-infinispan.xml b/core/mux/common/config/jdiameter-infinispan.xml index 08c37e49f..0d2eed397 100644 --- a/core/mux/common/config/jdiameter-infinispan.xml +++ b/core/mux/common/config/jdiameter-infinispan.xml @@ -1,22 +1,5 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/testsuite/tests/src/test/resources/jdiameter-infinispan.xml b/testsuite/tests/src/test/resources/jdiameter-infinispan.xml index 45f3835e7..97d19677e 100644 --- a/testsuite/tests/src/test/resources/jdiameter-infinispan.xml +++ b/testsuite/tests/src/test/resources/jdiameter-infinispan.xml @@ -1,16 +1,5 @@ - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file From 6e34fd326305266667f710a1031b6df312bf5fad Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 15:30:25 +0200 Subject: [PATCH 22/75] Fixed TestSuite pom files. --- testsuite/pom.xml | 23 ++--------------------- testsuite/tests/pom.xml | 12 +----------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/testsuite/pom.xml b/testsuite/pom.xml index 29783bbd4..6b2e7b4f6 100644 --- a/testsuite/pom.xml +++ b/testsuite/pom.xml @@ -22,9 +22,7 @@ 1.7.2 4.11 2.19 - - 8.2.4.Final - 3.3.0.Final + wildfly @@ -47,7 +45,7 @@ org.mobicents.diameter - jdiameter-ha-impl + jdiameter-ha-impl-${ha.impl} ${project.version} @@ -81,23 +79,6 @@ slf4j-log4j12 ${slf4j.version} - - - org.infinispan - infinispan-core - ${version.infinispan} - - - org.infinispan - infinispan-commons - ${version.infinispan} - - - org.infinispan - infinispan-tree - ${version.infinispan} - - diff --git a/testsuite/tests/pom.xml b/testsuite/tests/pom.xml index e0e972dac..c5f66b01c 100644 --- a/testsuite/tests/pom.xml +++ b/testsuite/tests/pom.xml @@ -29,7 +29,7 @@ org.mobicents.diameter - jdiameter-ha-impl + jdiameter-ha-impl-${ha.impl} runtime @@ -44,16 +44,6 @@ urbanophile java-getopt - - - org.infinispan - infinispan-core - - - org.infinispan - infinispan-tree - - From 706f85c600a8e3e9ecd574d1261959ff36a1c657 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 17:14:48 +0200 Subject: [PATCH 23/75] Prepared release script and for building. --- core/jdiameter-ha/pom.xml | 36 ++++++++++- core/mux/pom.xml | 10 --- .../src/main/resources/META-INF/module.xml | 2 +- release/build.xml | 64 +++++++++++-------- 4 files changed, 73 insertions(+), 39 deletions(-) diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index 153440d14..4d867c747 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -17,10 +17,39 @@ api - impl-jboss5 - impl-wildfly + + + + + jboss5 + + + + ha.impl + jboss5 + + + + impl-jboss5 + + + + wildfly + + + + ha.impl + wildfly + + + + impl-wildfly + + + + 1.5.9.0-build538-SNAPSHOT 1.15.11 @@ -79,16 +108,19 @@ org.restcomm.cluster core ${restcomm.cluster.version} + provided org.restcomm.cluster cache ${restcomm.cluster.version} + provided org.restcomm.cluster timers ${restcomm.cluster.version} + provided diff --git a/core/mux/pom.xml b/core/mux/pom.xml index f830b66b9..dac1e8c1f 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -43,11 +43,6 @@ jboss5 - sar-jboss-5 @@ -61,11 +56,6 @@ wildfly - sar-wildfly diff --git a/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml b/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml index d18a5047a..12e41ae2b 100644 --- a/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml +++ b/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml @@ -34,7 +34,7 @@ - + diff --git a/release/build.xml b/release/build.xml index 0a6488d19..fe54e04d7 100644 --- a/release/build.xml +++ b/release/build.xml @@ -38,8 +38,8 @@ + - @@ -51,7 +51,6 @@ - @@ -59,17 +58,16 @@ - - - - - + + + + @@ -79,8 +77,8 @@ - - + + @@ -97,10 +95,12 @@ - + + --> @@ -150,11 +150,21 @@ - + - + + + @@ -203,13 +213,15 @@ - + + + + - + - @@ -432,7 +442,7 @@ - + @@ -440,7 +450,8 @@ - + + @@ -454,7 +465,7 @@ - + @@ -483,7 +494,8 @@ - + + @@ -497,7 +509,7 @@ - + From 3267db64bab2b213086d6e8e981903de384724f9 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 10 Feb 2017 18:42:28 +0200 Subject: [PATCH 24/75] Fixing Release script. --- release/build.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/release/build.xml b/release/build.xml index fe54e04d7..3c17b6bcb 100644 --- a/release/build.xml +++ b/release/build.xml @@ -203,7 +203,7 @@ - + @@ -213,12 +213,12 @@ - + From dbdf471c7f8444d8cdad03134bdb025bdd4dea95 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Wed, 22 Feb 2017 14:12:15 +0200 Subject: [PATCH 25/75] Fixing Release script. --- core/mux/sar-wildfly/pom.xml | 24 +++--- .../resources/schema/DiameterMuxExtension.xsd | 4 +- release/build.xml | 13 +++- release/release-build-wildfly.xml | 78 +++++++++++++++++++ 4 files changed, 102 insertions(+), 17 deletions(-) create mode 100644 release/release-build-wildfly.xml diff --git a/core/mux/sar-wildfly/pom.xml b/core/mux/sar-wildfly/pom.xml index 36b2d9703..af3119386 100644 --- a/core/mux/sar-wildfly/pom.xml +++ b/core/mux/sar-wildfly/pom.xml @@ -177,7 +177,7 @@ - @@ -189,7 +189,7 @@ - @@ -198,7 +198,7 @@ - + @@ -208,16 +208,16 @@ - - + + - + - @@ -236,8 +236,8 @@ - + @@ -252,7 +252,7 @@ - + diff --git a/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd b/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd index edcc09efe..dfc3c3e88 100644 --- a/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd +++ b/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd @@ -1,6 +1,6 @@ diff --git a/release/build.xml b/release/build.xml index 3c17b6bcb..957731204 100644 --- a/release/build.xml +++ b/release/build.xml @@ -443,7 +443,7 @@ - + @@ -492,7 +492,7 @@ - + @@ -500,6 +500,8 @@ + + - + + + + diff --git a/release/release-build-wildfly.xml b/release/release-build-wildfly.xml new file mode 100644 index 000000000..e821778de --- /dev/null +++ b/release/release-build-wildfly.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + ]]> + + + + + ]]> + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 7ba707e5499ed4c19375ec617ff238c43367097b Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Wed, 22 Feb 2017 20:38:23 +0200 Subject: [PATCH 26/75] Fixing Release build. --- release/release-build-wildfly.xml | 38 +++++++------------------------ 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/release/release-build-wildfly.xml b/release/release-build-wildfly.xml index e821778de..99d2ce87a 100644 --- a/release/release-build-wildfly.xml +++ b/release/release-build-wildfly.xml @@ -9,7 +9,7 @@ - + @@ -23,52 +23,30 @@ - - - - - - + + + - + ]]> ]]> - - + ]]> - ]]> - - - - - - - - - - - - - - - - - - - + From 05cb095c3a02e5bebf79afe2dc199cb6291d4066 Mon Sep 17 00:00:00 2001 From: Sergey Povarnin Date: Thu, 23 Feb 2017 23:59:27 +0200 Subject: [PATCH 27/75] Rebranding. Fixing release build. --- core/mux/jar/src/main/module/module.xml | 4 ++-- core/mux/sar-wildfly/pom.xml | 16 +++++++-------- .../extension/DiameterMuxExtension.java | 2 +- .../extension/DiameterMuxService.java | 2 +- .../sar-wildfly/src/main/module/module.xml | 6 +++--- .../src/main/resources/META-INF/module.xml | 2 +- .../resources/schema/DiameterMuxExtension.xsd | 4 ++-- release/release-build-wildfly.xml | 20 ++++++++++++------- 8 files changed, 31 insertions(+), 25 deletions(-) diff --git a/core/mux/jar/src/main/module/module.xml b/core/mux/jar/src/main/module/module.xml index f5849c651..6afe8e4aa 100644 --- a/core/mux/jar/src/main/module/module.xml +++ b/core/mux/jar/src/main/module/module.xml @@ -1,5 +1,5 @@ - + @@ -7,7 +7,7 @@ - + diff --git a/core/mux/sar-wildfly/pom.xml b/core/mux/sar-wildfly/pom.xml index af3119386..785da74b1 100644 --- a/core/mux/sar-wildfly/pom.xml +++ b/core/mux/sar-wildfly/pom.xml @@ -18,8 +18,8 @@ 2.2.0.Final - org.mobicents.diameter.extension - org/mobicents/diameter/extension + org.restcomm.diameter.extension + org/restcomm/diameter/extension @@ -175,8 +175,8 @@ - - + + @@ -205,8 +205,8 @@ - - + + @@ -227,8 +227,8 @@ - - + + diff --git a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java index 339045f18..cd069ca66 100644 --- a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java +++ b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java @@ -33,7 +33,7 @@ public class DiameterMuxExtension implements Extension { /** * The name space used for the {@code substystem} element */ - public static final String NAMESPACE = "urn:mobicents:diameter-mux:1.0"; + public static final String NAMESPACE = "urn:restcomm:diameter-mux:1.0"; /** * The name of our subsystem within the model. diff --git a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java index 9aa19a626..6551acbce 100644 --- a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java +++ b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java @@ -16,7 +16,7 @@ public class DiameterMuxService implements Service { private final Logger log = Logger.getLogger(DiameterMuxService.class); public static ServiceName getServiceName() { - return ServiceName.of("mobicents","diameter-mux"); + return ServiceName.of("restcomm","diameter-mux"); } private final InjectedValue mbeanServer = new InjectedValue(); diff --git a/core/mux/sar-wildfly/src/main/module/module.xml b/core/mux/sar-wildfly/src/main/module/module.xml index 1c440fa84..b440c3839 100644 --- a/core/mux/sar-wildfly/src/main/module/module.xml +++ b/core/mux/sar-wildfly/src/main/module/module.xml @@ -1,5 +1,5 @@ - + @@ -17,8 +17,8 @@ - - + + diff --git a/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml b/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml index 12e41ae2b..c3a05c062 100644 --- a/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml +++ b/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml @@ -20,7 +20,7 @@ ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. --> - + diff --git a/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd b/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd index dfc3c3e88..55e9e2fe2 100644 --- a/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd +++ b/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd @@ -1,6 +1,6 @@ diff --git a/release/release-build-wildfly.xml b/release/release-build-wildfly.xml index 99d2ce87a..b438f703b 100644 --- a/release/release-build-wildfly.xml +++ b/release/release-build-wildfly.xml @@ -9,7 +9,7 @@ - + @@ -33,13 +33,13 @@ ]]> - + ]]> ]]> - + ]]> @@ -47,10 +47,16 @@ - - - - + + + ]]> + + + + + ]]> + + From a719ece98961fbe2df246d126ffeea6eae1d8c6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Wed, 15 Mar 2017 16:21:47 +0000 Subject: [PATCH 28/75] Add Idle Session Timeout check This allows to configure a new parameter, "SessionTimeOut" where it defines how long a session can be idle before being forcefully terminated. This can be configured by adding an optional `` parameter to jdiameter-config.xml, after parameter. Default value is `0` meaning there won't be a timeout for the sessions. A test for this feature is included, RoSessionBasicFlowIdleTest. Fixes #85 --- .../java/org/jdiameter/api/BaseSession.java | 2 + .../client/impl/BaseSessionImpl.java | 41 ++- .../jdiameter/client/impl/RawSessionImpl.java | 6 +- .../jdiameter/client/impl/SessionImpl.java | 6 +- .../impl/app/acc/ClientAccSessionImpl.java | 7 +- .../impl/app/auth/ClientAuthSessionImpl.java | 8 +- .../impl/app/cca/ClientCCASessionImpl.java | 8 +- .../impl/app/cxdx/CxDxClientSessionImpl.java | 8 +- .../impl/app/gq/GqClientSessionImpl.java | 8 +- .../impl/app/gx/ClientGxSessionImpl.java | 8 +- .../impl/app/rf/ClientRfSessionImpl.java | 8 +- .../impl/app/ro/ClientRoSessionImpl.java | 8 +- .../impl/app/rx/ClientRxSessionImpl.java | 6 + .../impl/app/s13/S13ClientSessionImpl.java | 8 +- .../impl/app/s6a/S6aClientSessionImpl.java | 8 +- .../impl/app/sh/ShClientSessionImpl.java | 7 +- .../client/impl/helpers/Parameters.java | 4 + .../common/impl/app/AppSessionImpl.java | 25 +- .../impl/timer/LocalTimerFacilityImpl.java | 16 +- .../impl/app/acc/ServerAccSessionImpl.java | 7 +- .../impl/app/auth/ServerAuthSessionImpl.java | 8 +- .../impl/app/cca/ServerCCASessionImpl.java | 8 +- .../impl/app/cxdx/CxDxServerSessionImpl.java | 8 +- .../impl/app/gq/GqServerSessionImpl.java | 8 +- .../impl/app/gx/ServerGxSessionImpl.java | 8 +- .../impl/app/rf/ServerRfSessionImpl.java | 8 +- .../impl/app/ro/ServerRoSessionImpl.java | 8 +- .../impl/app/rx/ServerRxSessionImpl.java | 6 + .../impl/app/s13/S13ServerSessionImpl.java | 8 +- .../impl/app/s6a/S6aServerSessionImpl.java | 8 +- .../impl/app/sh/ShServerSessionImpl.java | 7 +- .../server/impl/helpers/XMLConfiguration.java | 4 + .../resources/META-INF/jdiameter-client.xsd | 8 + .../resources/META-INF/jdiameter-server.xsd | 8 + .../ro/base/RoSessionBasicFlowIdleTest.java | 238 ++++++++++++++++++ .../config-server-node1-session-idle.xml | 58 +++++ 36 files changed, 558 insertions(+), 42 deletions(-) create mode 100644 testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/base/RoSessionBasicFlowIdleTest.java create mode 100644 testsuite/tests/src/test/resources/configurations/functional-ro/config-server-node1-session-idle.xml diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/BaseSession.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/BaseSession.java index e724e7b07..572222746 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/BaseSession.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/BaseSession.java @@ -104,4 +104,6 @@ public interface BaseSession { * @return session-id as String (Session-Id AVP) */ String getSessionId(); + + String IDLE_SESSION_TIMER_NAME = "IDLE_SESSION_TIMER"; } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java index cf81b8fb3..24e6e7464 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java @@ -43,7 +43,9 @@ package org.jdiameter.client.impl; import static org.jdiameter.client.impl.helpers.Parameters.MessageTimeOut; +import static org.jdiameter.client.impl.helpers.Parameters.SessionTimeOut; +import java.io.Serializable; import java.util.concurrent.CountDownLatch; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; @@ -65,10 +67,14 @@ import org.jdiameter.api.OverloadException; import org.jdiameter.api.Request; import org.jdiameter.api.RouteException; +import org.jdiameter.client.api.IAssembler; import org.jdiameter.client.api.IContainer; import org.jdiameter.client.api.IEventListener; import org.jdiameter.client.api.IMessage; import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.common.api.timer.ITimerFacility; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Implementation for {@link BaseSession}. @@ -79,15 +85,21 @@ */ public abstract class BaseSessionImpl implements BaseSession { + private static final Logger logger = LoggerFactory.getLogger(BaseSessionImpl.class); + protected final long creationTime = System.currentTimeMillis(); protected long lastAccessedTime = creationTime; protected boolean isValid = true; protected String sessionId; + protected long maxIdleTime = 0; + protected transient IContainer container; protected transient IMessageParser parser; protected NetworkReqListener reqListener; + private Serializable istTimerId; + @Override public long getCreationTime() { return creationTime; @@ -98,6 +110,29 @@ public long getLastAccessedTime() { return lastAccessedTime; } + protected long setLastAccessTime() { + lastAccessedTime = System.currentTimeMillis(); + maxIdleTime = container.getConfiguration().getLongValue(SessionTimeOut.ordinal(), (Long) SessionTimeOut.defValue()); + if (maxIdleTime > 0) { + IAssembler assembler = container.getAssemblerFacility(); + ITimerFacility timerFacility = assembler.getComponentInstance(ITimerFacility.class); + if (istTimerId != null) { + timerFacility.cancel(istTimerId); + } + istTimerId = timerFacility.schedule(this.getSessionId(), IDLE_SESSION_TIMER_NAME, maxIdleTime); + } + return lastAccessedTime; + } + + public void onTimer(String timerName) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + if (!isValid() || (maxIdleTime > 0 && System.currentTimeMillis() - getLastAccessedTime() > maxIdleTime)) { + logger.debug("Terminating idle/invalid application session [{}] with SID[{}]", this, getSessionId()); + this.release(); + } + } + } + @Override public boolean isValid() { return isValid; @@ -138,7 +173,7 @@ protected void genericSend(Message message, EventListener listener) protected void genericSend(Message aMessage, EventListener listener, long timeout, TimeUnit timeUnit) throws InternalException, IllegalDiameterStateException, RouteException, OverloadException { if (isValid) { - lastAccessedTime = System.currentTimeMillis(); + setLastAccessTime(); IMessage message = (IMessage) aMessage; IEventListener localListener = createListenerWrapper(listener); @@ -402,7 +437,7 @@ public boolean isValid() { @SuppressWarnings("unchecked") public void receivedSuccessMessage(Request request, Answer answer) { if (isValid) { - session.lastAccessedTime = System.currentTimeMillis(); + session.setLastAccessTime(); listener.receivedSuccessMessage(request, answer); } } @@ -411,7 +446,7 @@ public void receivedSuccessMessage(Request request, Answer answer) { @SuppressWarnings("unchecked") public void timeoutExpired(Request message) { if (isValid) { - session.lastAccessedTime = System.currentTimeMillis(); + session.setLastAccessTime(); listener.timeoutExpired(message); } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/RawSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/RawSessionImpl.java index 6c0c272c2..1b9d34cf9 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/RawSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/RawSessionImpl.java @@ -75,7 +75,7 @@ public class RawSessionImpl extends BaseSessionImpl implements RawSession { @Override public Message createMessage(int commandCode, ApplicationId appId, Avp... avps) { if ( isValid ) { - lastAccessedTime = System.currentTimeMillis(); + setLastAccessTime(); IMessage m = parser.createEmptyMessage(commandCode, getAppId(appId)); m.getAvps().addAvp(avps); appendAppId(appId, m); @@ -88,7 +88,7 @@ public Message createMessage(int commandCode, ApplicationId appId, Avp... avps) @Override public Message createMessage(int commandCode, ApplicationId appId, long hopByHopIdentifier, long endToEndIdentifier, Avp... avps) { if ( isValid ) { - lastAccessedTime = System.currentTimeMillis(); + setLastAccessTime(); IMessage m = parser.createEmptyMessage(commandCode, getAppId(appId)); if (hopByHopIdentifier >= 0) { m.setHopByHopIdentifier(-hopByHopIdentifier); @@ -107,7 +107,7 @@ public Message createMessage(int commandCode, ApplicationId appId, long hopByHop @Override public Message createMessage(Message message, boolean copyAvps) { if ( isValid ) { - lastAccessedTime = System.currentTimeMillis(); + setLastAccessTime(); IMessage newMessage = null; IMessage inner = (IMessage) message; if (copyAvps) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java index 4d6dcbae0..a985a712e 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java @@ -115,7 +115,7 @@ public NetworkReqListener getReqListener() { @Override public Request createRequest(int commandCode, ApplicationId appId, String destRealm) { if (isValid) { - lastAccessedTime = System.currentTimeMillis(); + setLastAccessTime(); IRequest m = parser.createEmptyMessage(IRequest.class, commandCode, getAppId(appId)); m.setNetworkRequest(false); m.setRequest(true); @@ -135,7 +135,7 @@ public Request createRequest(int commandCode, ApplicationId appId, String destRe @Override public Request createRequest(int commandCode, ApplicationId appId, String destRealm, String destHost) { if (isValid) { - lastAccessedTime = System.currentTimeMillis(); + setLastAccessTime(); IRequest m = parser.createEmptyMessage(IRequest.class, commandCode, getAppId(appId)); m.setNetworkRequest(false); m.setRequest(true); @@ -158,7 +158,7 @@ public Request createRequest(int commandCode, ApplicationId appId, String destRe @Override public Request createRequest(Request prevRequest) { if (isValid) { - lastAccessedTime = System.currentTimeMillis(); + setLastAccessTime(); IRequest request = parser.createEmptyMessage(Request.class, (IMessage) prevRequest); request.setRequest(true); request.setNetworkRequest(false); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/acc/ClientAccSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/acc/ClientAccSessionImpl.java index 19f1b9c7e..5708ce78a 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/acc/ClientAccSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/acc/ClientAccSessionImpl.java @@ -622,7 +622,10 @@ protected void processInterimIntervalAvp(StateEvent event) throws InternalExcept */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_INTERIM)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_INTERIM)) { if (context != null) { try { Request interimRecord = createInterimRecord(); @@ -641,7 +644,7 @@ public void onTimer(String timerName) { } } else { - //....? + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/auth/ClientAuthSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/auth/ClientAuthSessionImpl.java index 9c118bbc4..3564e753b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/auth/ClientAuthSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/auth/ClientAuthSessionImpl.java @@ -594,7 +594,10 @@ protected void cancelTsTimer() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_TS)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_TS)) { try { sendAndStateLock.lock(); sessionData.setTsTimerId(null); @@ -611,6 +614,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cca/ClientCCASessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cca/ClientCCASessionImpl.java index 955f0eeba..702b0fdb1 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cca/ClientCCASessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cca/ClientCCASessionImpl.java @@ -623,9 +623,15 @@ protected void stopTx() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TX_TIMER_NAME)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TX_TIMER_NAME)) { new TxTimerTask(this, this.sessionData.getTxTimerRequest()).run(); } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } protected void setState(ClientCCASessionState newState) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cxdx/CxDxClientSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cxdx/CxDxClientSessionImpl.java index b7226ee1f..a9b2ea28e 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cxdx/CxDxClientSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/cxdx/CxDxClientSessionImpl.java @@ -369,7 +369,10 @@ protected void setState(CxDxSessionState newState) { */ @Override public void onTimer(String timerName) { - if (timerName.equals(CxDxSession.TIMER_NAME_MSG_TIMEOUT)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(CxDxSession.TIMER_NAME_MSG_TIMEOUT)) { try { sendAndStateLock.lock(); try { @@ -385,6 +388,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gq/GqClientSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gq/GqClientSessionImpl.java index 02f365002..04443f1c3 100755 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gq/GqClientSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gq/GqClientSessionImpl.java @@ -562,7 +562,10 @@ protected void cancelTsTimer() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_TS)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_TS)) { try { sendAndStateLock.lock(); sessionData.setTsTimerId(null); @@ -579,6 +582,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } protected AbortSessionAnswer createAbortSessionAnswer(Answer answer) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gx/ClientGxSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gx/ClientGxSessionImpl.java index c492e970c..028a7fb38 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gx/ClientGxSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/gx/ClientGxSessionImpl.java @@ -611,9 +611,15 @@ protected void stopTx() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TX_TIMER_NAME)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TX_TIMER_NAME)) { new TxTimerTask(this, this.sessionData.getTxTimerRequest()).run(); } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } protected void setState(ClientGxSessionState newState) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rf/ClientRfSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rf/ClientRfSessionImpl.java index 04aec79b0..c156e8dd9 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rf/ClientRfSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rf/ClientRfSessionImpl.java @@ -608,7 +608,10 @@ protected void processInterimIntervalAvp(StateEvent event) throws InternalExcept */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_INTERIM)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_INTERIM)) { if (context != null) { try { Request interimRecord = createInterimRecord(); @@ -626,6 +629,9 @@ public void onTimer(String timerName) { } } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } private void startInterimTimer(long v) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/ro/ClientRoSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/ro/ClientRoSessionImpl.java index ca41deedb..ce9f46186 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/ro/ClientRoSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/ro/ClientRoSessionImpl.java @@ -639,9 +639,15 @@ protected void stopTx() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TX_TIMER_NAME)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TX_TIMER_NAME)) { new TxTimerTask(this, sessionData.getTxTimerRequest()).run(); } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } protected void setState(ClientRoSessionState newState) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rx/ClientRxSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rx/ClientRxSessionImpl.java index b8c4335ab..97df5be28 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rx/ClientRxSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/rx/ClientRxSessionImpl.java @@ -890,5 +890,11 @@ else if (!sessionData.getClientRxSessionState().equals(other.sessionData.getClie @Override public void onTimer(String timerName) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } } \ No newline at end of file diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s13/S13ClientSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s13/S13ClientSessionImpl.java index 5bbb6f85a..68a61a932 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s13/S13ClientSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s13/S13ClientSessionImpl.java @@ -209,7 +209,10 @@ protected void setState(S13SessionState newState) { @Override public void onTimer(String timerName) { - if (timerName.equals(S13Session.TIMER_NAME_MSG_TIMEOUT)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(S13Session.TIMER_NAME_MSG_TIMEOUT)) { try { sendAndStateLock.lock(); try { @@ -223,6 +226,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } @Override diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s6a/S6aClientSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s6a/S6aClientSessionImpl.java index 5e16dd246..a9aa8fc06 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s6a/S6aClientSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/s6a/S6aClientSessionImpl.java @@ -371,7 +371,10 @@ protected void setState(S6aSessionState newState) { */ @Override public void onTimer(String timerName) { - if (timerName.equals(S6aSession.TIMER_NAME_MSG_TIMEOUT)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(S6aSession.TIMER_NAME_MSG_TIMEOUT)) { try { sendAndStateLock.lock(); try { @@ -387,6 +390,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/sh/ShClientSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/sh/ShClientSessionImpl.java index aa7d00c37..ca275c166 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/sh/ShClientSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/app/sh/ShClientSessionImpl.java @@ -291,7 +291,12 @@ public boolean isReplicable() { @Override public void onTimer(String timerName) { - // TODO ... + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } private class RequestDelivery implements Runnable { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/Parameters.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/Parameters.java index cb568947d..2224a63c2 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/Parameters.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/helpers/Parameters.java @@ -123,6 +123,10 @@ public class Parameters extends Ordinal { * Reconnect time out property */ public static final Parameters RecTimeOut = new Parameters("RecTimeOut", Long.class, 10000L); + /** + * Idle session time out property + */ + public static final Parameters SessionTimeOut = new Parameters("SessionTimeOut", Long.class, 0L); /** * Peer FSM Thread Count property diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java index 6b094258a..40ee4554d 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java @@ -42,6 +42,8 @@ package org.jdiameter.common.impl.app; +import static org.jdiameter.client.impl.helpers.Parameters.SessionTimeOut; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -76,9 +78,11 @@ public abstract class AppSessionImpl implements AppSession { protected ISessionFactory sf = null; - protected ScheduledExecutorService scheduler = null; + protected static ScheduledExecutorService scheduler = null; + + protected static ITimerFacility timerFacility; - protected ITimerFacility timerFacility; + protected long maxIdleTime = 0; public AppSessionImpl(ISessionFactory sf, IAppSessionData appSessionData) { if (sf == null) { @@ -91,9 +95,12 @@ public AppSessionImpl(ISessionFactory sf, IAppSessionData appSessionData) { this.sf = sf; this.appSessionData = appSessionData; IAssembler assembler = ( this.sf).getContainer().getAssemblerFacility(); - this.scheduler = assembler.getComponentInstance(IConcurrentFactory.class). - getScheduledExecutorService(IConcurrentFactory.ScheduledExecServices.ApplicationSession.name()); - this.timerFacility = assembler.getComponentInstance(ITimerFacility.class); + if (scheduler == null) { + this.scheduler = assembler.getComponentInstance(IConcurrentFactory.class). + getScheduledExecutorService(IConcurrentFactory.ScheduledExecServices.ApplicationSession.name()); + } + this.timerFacility = timerFacility != null ? timerFacility : assembler.getComponentInstance(ITimerFacility.class); + this.maxIdleTime = this.sf.getContainer().getConfiguration().getLongValue(SessionTimeOut.ordinal(), (Long) SessionTimeOut.defValue()); this.session = this.sf.getNewSession(this.appSessionData.getSessionId()); //annoying ;[ ArrayList list = new ArrayList(); @@ -202,4 +209,12 @@ public boolean equals(Object obj) { public abstract void onTimer(String timerName); + protected void checkIdleAppSession() { + if (!isValid() || (maxIdleTime > 0 && System.currentTimeMillis() - getLastAccessedTime() > maxIdleTime)) { + logger.debug("Terminating idle/invalid application session [{}] with SID[{}]", this, getSessionId()); + release(); + } + } + + } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/timer/LocalTimerFacilityImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/timer/LocalTimerFacilityImpl.java index c2c2b2302..f08b3c700 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/timer/LocalTimerFacilityImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/timer/LocalTimerFacilityImpl.java @@ -55,6 +55,7 @@ import org.apache.commons.pool.impl.GenericObjectPool; import org.jdiameter.api.BaseSession; import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.BaseSessionImpl; import org.jdiameter.common.api.concurrent.IConcurrentFactory; import org.jdiameter.common.api.data.ISessionDatasource; import org.jdiameter.common.api.timer.ITimerFacility; @@ -96,6 +97,7 @@ public void cancel(Serializable f) { if (f != null && f instanceof TimerTaskHandle) { TimerTaskHandle timerTaskHandle = (TimerTaskHandle) f; if (timerTaskHandle.future != null) { + logger.debug("Cancelling timer with id [{}] and delay [{}]", timerTaskHandle.id, timerTaskHandle.future.getDelay(TimeUnit.MILLISECONDS)); if (executor.remove((Runnable) timerTaskHandle.future)) { timerTaskHandle.future.cancel(false); returnTimerTaskHandle(timerTaskHandle); @@ -167,18 +169,24 @@ private final class TimerTaskHandle implements Runnable, Externalizable { public void run() { try { BaseSession bSession = sessionDataSource.getSession(sessionId); - if (bSession == null || !bSession.isAppSession()) { + if (bSession == null) { // FIXME: error ? logger.error("Base Session is null for sessionId: {}", sessionId); return; } else { try { - AppSessionImpl impl = (AppSessionImpl) bSession; - impl.onTimer(timerName); + if (!bSession.isAppSession()) { + BaseSessionImpl impl = (BaseSessionImpl) bSession; + impl.onTimer(timerName); + } + else { + AppSessionImpl impl = (AppSessionImpl) bSession; + impl.onTimer(timerName); + } } catch (Exception e) { - logger.error("Caught exception from app session object!", e); + logger.error("Caught exception from session object!", e); } } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/acc/ServerAccSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/acc/ServerAccSessionImpl.java index 78a5d7bc1..278094528 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/acc/ServerAccSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/acc/ServerAccSessionImpl.java @@ -407,7 +407,10 @@ private void cancelTsTimer() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_TS)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_TS)) { if (context != null) { try { context.sessionTimeoutElapses(ServerAccSessionImpl.this); @@ -419,7 +422,7 @@ public void onTimer(String timerName) { setState(IDLE); } else { - // FIXME: ??? + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/auth/ServerAuthSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/auth/ServerAuthSessionImpl.java index 8f79a4461..030c8765f 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/auth/ServerAuthSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/auth/ServerAuthSessionImpl.java @@ -453,7 +453,10 @@ protected void cancelTsTimer() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_TS)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_TS)) { try { sendAndStateLock.lock(); sessionData.setTsTimerId(null); @@ -466,6 +469,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } @Override diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java index c3e2cf37e..9fb05777d 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java @@ -419,9 +419,15 @@ private void startTcc(Avp validityAvp) { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TCC_TIMER_NAME)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TCC_TIMER_NAME)) { new TccScheduledTask(this).run(); } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } private void stopTcc(boolean willRestart) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cxdx/CxDxServerSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cxdx/CxDxServerSessionImpl.java index d068a5141..033301563 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cxdx/CxDxServerSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cxdx/CxDxServerSessionImpl.java @@ -395,7 +395,10 @@ protected void setState(CxDxSessionState newState) { @Override public void onTimer(String timerName) { - if (timerName.equals(CxDxSession.TIMER_NAME_MSG_TIMEOUT)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(CxDxSession.TIMER_NAME_MSG_TIMEOUT)) { try { sendAndStateLock.lock(); try { @@ -411,6 +414,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } private class RequestDelivery implements Runnable { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gq/GqServerSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gq/GqServerSessionImpl.java index 786d2ce9f..fc1148d8e 100755 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gq/GqServerSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gq/GqServerSessionImpl.java @@ -479,7 +479,10 @@ protected void cancelTsTimer() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_TS)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_TS)) { try { sendAndStateLock.lock(); sessionData.setTsTimerId(null); @@ -492,6 +495,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } protected ReAuthAnswer createReAuthAnswer(Answer answer) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java index df57e0f93..af5bd3f98 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java @@ -410,9 +410,15 @@ private void startTcc(Avp validityAvp) { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TCC_TIMER_NAME)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TCC_TIMER_NAME)) { new TccScheduledTask(this).run(); } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } private void stopTcc(boolean willRestart) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rf/ServerRfSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rf/ServerRfSessionImpl.java index d5b01100d..6e86e99fe 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rf/ServerRfSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rf/ServerRfSessionImpl.java @@ -392,7 +392,10 @@ private void cancelTsTimer() { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TIMER_NAME_TS)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TIMER_NAME_TS)) { if (context != null) { try { context.sessionTimeoutElapses(ServerRfSessionImpl.this); @@ -403,6 +406,9 @@ public void onTimer(String timerName) { } setState(IDLE); } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } protected Answer createStopAnswer(Request request) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java index 241b4a89e..4c08c29b7 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java @@ -429,9 +429,15 @@ private void startTcc(Avp validityAvp) { */ @Override public void onTimer(String timerName) { - if (timerName.equals(TCC_TIMER_NAME)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(TCC_TIMER_NAME)) { new TccScheduledTask(this).run(); } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } private void stopTcc(boolean willRestart) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java index 314f05708..9ea4133d9 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java @@ -346,6 +346,12 @@ public void receivedSuccessMessage(Request request, Answer answer) { */ @Override public void onTimer(String timerName) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } @Override diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s13/S13ServerSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s13/S13ServerSessionImpl.java index 6ee368b75..93449f972 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s13/S13ServerSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s13/S13ServerSessionImpl.java @@ -212,7 +212,10 @@ protected void setState(S13SessionState newState) { @Override public void onTimer(String timerName) { - if (timerName.equals(S13Session.TIMER_NAME_MSG_TIMEOUT)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(S13Session.TIMER_NAME_MSG_TIMEOUT)) { try { sendAndStateLock.lock(); try { @@ -226,6 +229,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } @Override diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s6a/S6aServerSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s6a/S6aServerSessionImpl.java index fee538f10..f531f36ee 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s6a/S6aServerSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/s6a/S6aServerSessionImpl.java @@ -391,7 +391,10 @@ protected void setState(S6aSessionState newState) { @Override public void onTimer(String timerName) { - if (timerName.equals(S6aSession.TIMER_NAME_MSG_TIMEOUT)) { + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else if (timerName.equals(S6aSession.TIMER_NAME_MSG_TIMEOUT)) { try { sendAndStateLock.lock(); try { @@ -407,6 +410,9 @@ public void onTimer(String timerName) { sendAndStateLock.unlock(); } } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } @Override diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/sh/ShServerSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/sh/ShServerSessionImpl.java index ec2b55f85..0daa56690 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/sh/ShServerSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/sh/ShServerSessionImpl.java @@ -341,7 +341,12 @@ else if (!sessionData.equals(other.sessionData)) { @Override public void onTimer(String timerName) { - logger.trace("onTimer({})", timerName); + if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { + checkIdleAppSession(); + } + else { + logger.warn("Received an unknown timer '{}' for Session-ID '{}'", timerName, getSessionId()); + } } private class RequestDelivery implements Runnable { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/helpers/XMLConfiguration.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/helpers/XMLConfiguration.java index 0760eb62c..7a69f3d8c 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/helpers/XMLConfiguration.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/helpers/XMLConfiguration.java @@ -109,6 +109,7 @@ import static org.jdiameter.client.impl.helpers.Parameters.SDUseClientMode; import static org.jdiameter.client.impl.helpers.Parameters.Security; import static org.jdiameter.client.impl.helpers.Parameters.SecurityRef; +import static org.jdiameter.client.impl.helpers.Parameters.SessionTimeOut; import static org.jdiameter.client.impl.helpers.Parameters.Statistics; import static org.jdiameter.client.impl.helpers.Parameters.StatisticsActiveList; import static org.jdiameter.client.impl.helpers.Parameters.StatisticsEnabled; @@ -364,6 +365,9 @@ else if (nodeName.equals("DpaTimeOut")) { else if (nodeName.equals("RecTimeOut")) { add(RecTimeOut, getLongValue(c.item(i))); } + else if (nodeName.equals("SessionTimeOut")) { + add(SessionTimeOut, getLongValue(c.item(i))); + } else if (nodeName.equals("BindDelay")) { add(BindDelay, getLongValue(c.item(i))); } diff --git a/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-client.xsd b/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-client.xsd index d283ced65..1a4eca615 100644 --- a/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-client.xsd +++ b/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-client.xsd @@ -167,6 +167,14 @@ + + + Session idle time out in milliseconds. + + + + + Default stop time out in milliseconds. diff --git a/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-server.xsd b/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-server.xsd index b30936af1..80fdcd87d 100644 --- a/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-server.xsd +++ b/core/jdiameter/impl/src/main/resources/META-INF/jdiameter-server.xsd @@ -232,6 +232,14 @@ + + + Session idle time out in milliseconds. + + + + + Default stop time out in milliseconds. diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/base/RoSessionBasicFlowIdleTest.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/base/RoSessionBasicFlowIdleTest.java new file mode 100644 index 000000000..5ece58381 --- /dev/null +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/functional/ro/base/RoSessionBasicFlowIdleTest.java @@ -0,0 +1,238 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2017, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.stack.functional.ro.base; + +import static org.junit.Assert.fail; + +import java.io.File; +import java.io.FileInputStream; +import java.net.URI; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.jdiameter.api.DisconnectCause; +import org.jdiameter.api.Mode; +import org.jdiameter.api.Peer; +import org.jdiameter.api.PeerState; +import org.jdiameter.api.PeerTable; +import org.jdiameter.api.Stack; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +/** + * + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +@RunWith(Parameterized.class) +public class RoSessionBasicFlowIdleTest { + + private Client clientNode; + private Server serverNode1; + private URI clientConfigURI; + private URI serverNode1ConfigURI; + + /** + * @param clientNode + * @param node1 + * @param node2 + * @param serverCount + */ + public RoSessionBasicFlowIdleTest(String clientConfigUrl, String serverNode1ConfigURL) throws Exception { + super(); + this.clientConfigURI = new URI(clientConfigUrl); + this.serverNode1ConfigURI = new URI(serverNode1ConfigURL); + } + + @Before + public void setUp() throws Exception { + try { + this.clientNode = new Client(); + this.serverNode1 = new Server(); + + this.serverNode1.init(new FileInputStream(new File(this.serverNode1ConfigURI)), "SERVER1"); + this.serverNode1.start(); + + this.clientNode.init(new FileInputStream(new File(this.clientConfigURI)), "CLIENT"); + this.clientNode.start(Mode.ANY_PEER, 10, TimeUnit.SECONDS); + Stack stack = this.clientNode.getStack(); + List peers = stack.unwrap(PeerTable.class).getPeerTable(); + if (peers.size() == 1) { + // ok + } + else if (peers.size() > 1) { + // works better with replicated, since disconnected peers are also listed + boolean foundConnected = false; + for (Peer p : peers) { + if (p.getState(PeerState.class).equals(PeerState.OKAY)) { + if (foundConnected) { + throw new Exception("Wrong number of connected peers: " + peers); + } + foundConnected = true; + } + } + } + else { + throw new Exception("Wrong number of connected peers: " + peers); + } + } + catch (Throwable e) { + e.printStackTrace(); + } + } + + @After + public void tearDown() { + if (this.serverNode1 != null) { + try { + this.serverNode1.stop(DisconnectCause.REBOOTING); + } + catch (Exception e) { + + } + this.serverNode1 = null; + } + + if (this.clientNode != null) { + try { + this.clientNode.stop(DisconnectCause.REBOOTING); + } + catch (Exception e) { + + } + this.clientNode = null; + } + } + + @Test + public void testBasicFlow() throws Exception { + try { + // pain of parameter tests :) ? + clientNode.sendInitial(); + waitForMessage(); + + serverNode1.sendInitial(); + waitForMessage(); + + clientNode.sendInterim(); + waitForMessage(); + + serverNode1.sendInterim(); + waitForMessage(5500); // we wait a bit more so session expires with idle + + clientNode.sendTermination(); + waitForMessage(); + + serverNode1.sendTermination(); + waitForMessage(); + } + catch (Exception e) { + // in case the session expired even before receiving the termination + if (!"Request: null".equals(e.getMessage())) { + e.printStackTrace(); + fail(e.toString()); + } + } + + if (!clientNode.isReceiveINITIAL()) { + StringBuilder sb = new StringBuilder("Did not receive INITIAL! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isReceiveINTERIM()) { + StringBuilder sb = new StringBuilder("Did not receive INTERIM! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isReceiveTERMINATE()) { + // we don't fail here, we wanted session to be terminated when server tries to receive/send TERMINATE + } + if (clientNode.isReceiveTERMINATE()) { + StringBuilder sb = new StringBuilder("Did receive TERMINATE, should not, session should have been terminated by idle! "); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + if (!clientNode.isPassed()) { + StringBuilder sb = new StringBuilder(); + sb.append("Client ER:\n").append(clientNode.createErrorReport(this.clientNode.getErrors())); + + fail(sb.toString()); + } + + if (!serverNode1.isReceiveINITIAL()) { + StringBuilder sb = new StringBuilder("Did not receive INITIAL! "); + sb.append("Server ER:\n").append(serverNode1.createErrorReport(this.serverNode1.getErrors())); + + fail(sb.toString()); + } + else if (!serverNode1.isReceiveINTERIM()) { + StringBuilder sb = new StringBuilder("Did not receive INTERIM! "); + sb.append("Server ER:\n").append(serverNode1.createErrorReport(this.serverNode1.getErrors())); + + fail(sb.toString()); + } + else if (!serverNode1.isReceiveTERMINATE()) { + // we don't fail here, we wanted session to be terminated when server tries to receive/send TERMINATE + } + if (!serverNode1.isPassed()) { + // we don't fail here, we wanted session to be terminated when server tries to receive/send TERMINATE + } + } + + @Parameters + public static Collection data() { + String client = "configurations/functional-ro/config-client.xml"; + String server1 = "configurations/functional-ro/config-server-node1-session-idle.xml"; + + String replicatedClient = "configurations/functional-ro/replicated-config-client.xml"; + String replicatedServer1 = "configurations/functional-ro/replicated-config-server-node1.xml"; + + Class t = RoSessionBasicFlowIdleTest.class; + client = t.getClassLoader().getResource(client).toString(); + server1 = t.getClassLoader().getResource(server1).toString(); + replicatedClient = t.getClassLoader().getResource(replicatedClient).toString(); + replicatedServer1 = t.getClassLoader().getResource(replicatedServer1).toString(); + + return Arrays.asList(new Object[][] { { client, server1 }/*, { replicatedClient, replicatedServer1 }*/ }); + } + + private void waitForMessage(long time) { + try { + Thread.sleep(time); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + + private void waitForMessage() { + waitForMessage(2000); + } + +} diff --git a/testsuite/tests/src/test/resources/configurations/functional-ro/config-server-node1-session-idle.xml b/testsuite/tests/src/test/resources/configurations/functional-ro/config-server-node1-session-idle.xml new file mode 100644 index 000000000..a414482eb --- /dev/null +++ b/testsuite/tests/src/test/resources/configurations/functional-ro/config-server-node1-session-idle.xml @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From faeb9de01db8afed0adf366a1ff926c102ab6fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Thu, 16 Mar 2017 00:04:16 +0000 Subject: [PATCH 29/75] Missing bits & fixes for Session Idle Timeout (#85) --- .../ha/timer/ReplicatedTimerFacilityImpl.java | 19 ++++++++++++++++--- .../client/impl/BaseSessionImpl.java | 18 ++++++++++-------- .../jdiameter/client/impl/SessionImpl.java | 4 ++++ 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java index 9f4a92242..50972b201 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java @@ -46,6 +46,7 @@ import org.jdiameter.api.BaseSession; import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.BaseSessionImpl; import org.jdiameter.common.api.data.ISessionDatasource; import org.jdiameter.common.api.timer.ITimerFacility; import org.jdiameter.common.impl.app.AppSessionImpl; @@ -129,13 +130,25 @@ public void runTask() { try { DiameterTimerTaskData data = (DiameterTimerTaskData) getData(); BaseSession bSession = sessionDataSource.getSession(data.getSessionId()); - if (bSession == null || !bSession.isAppSession()) { + if (bSession == null) { // FIXME: error ? + logger.error("Base Session is null for sessionId: {}", data.getSessionId()); return; } else { - AppSessionImpl impl = (AppSessionImpl) bSession; - impl.onTimer(data.getTimerName()); + try { + if (!bSession.isAppSession()) { + BaseSessionImpl impl = (BaseSessionImpl) bSession; + impl.onTimer(data.getTimerName()); + } + else { + AppSessionImpl impl = (AppSessionImpl) bSession; + impl.onTimer(data.getTimerName()); + } + } + catch (Exception e) { + logger.error("Caught exception from session object!", e); + } } } catch (Exception e) { diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java index 24e6e7464..92b75ba5a 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java @@ -98,7 +98,7 @@ public abstract class BaseSessionImpl implements BaseSession { protected transient IMessageParser parser; protected NetworkReqListener reqListener; - private Serializable istTimerId; + protected Serializable istTimerId; @Override public long getCreationTime() { @@ -112,14 +112,16 @@ public long getLastAccessedTime() { protected long setLastAccessTime() { lastAccessedTime = System.currentTimeMillis(); - maxIdleTime = container.getConfiguration().getLongValue(SessionTimeOut.ordinal(), (Long) SessionTimeOut.defValue()); - if (maxIdleTime > 0) { - IAssembler assembler = container.getAssemblerFacility(); - ITimerFacility timerFacility = assembler.getComponentInstance(ITimerFacility.class); - if (istTimerId != null) { - timerFacility.cancel(istTimerId); + if (sessionId != null) { + maxIdleTime = container.getConfiguration().getLongValue(SessionTimeOut.ordinal(), (Long) SessionTimeOut.defValue()); + if (maxIdleTime > 0) { + IAssembler assembler = container.getAssemblerFacility(); + ITimerFacility timerFacility = assembler.getComponentInstance(ITimerFacility.class); + if (istTimerId != null) { + timerFacility.cancel(istTimerId); + } + istTimerId = timerFacility.schedule(this.getSessionId(), IDLE_SESSION_TIMER_NAME, maxIdleTime); } - istTimerId = timerFacility.schedule(this.getSessionId(), IDLE_SESSION_TIMER_NAME, maxIdleTime); } return lastAccessedTime; } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java index a985a712e..8dbead2c0 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java @@ -62,6 +62,7 @@ import org.jdiameter.client.api.ISession; import org.jdiameter.client.api.parser.IMessageParser; import org.jdiameter.common.api.data.ISessionDatasource; +import org.jdiameter.common.api.timer.ITimerFacility; /** * Implementation for {@link ISession} @@ -174,6 +175,9 @@ public Request createRequest(Request prevRequest) { public void release() { isValid = false; if (container != null) { + if (istTimerId != null) { + container.getAssemblerFacility().getComponentInstance(ITimerFacility.class).cancel(istTimerId); + } container.removeSessionListener(sessionId); // FIXME container.getAssemblerFacility().getComponentInstance(ISessionDatasource.class).removeSession(sessionId); From 7e0a90d24bd35f78e6483d5e2d794945a54b49ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mar=C3=ADa=20L=C3=B3pez?= Date: Fri, 10 Mar 2017 09:22:27 +0100 Subject: [PATCH 30/75] Fix hang when decodeAvpSet receives vendorId=0 I added a boolean variable to control the presence of vendor-id AVP, even if it is vendorId = 0. --- .../java/org/jdiameter/client/impl/parser/ElementParser.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/ElementParser.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/ElementParser.java index 3bad9b167..80a4c35a6 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/ElementParser.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/ElementParser.java @@ -286,11 +286,13 @@ public AvpSetImpl decodeAvpSet(byte[] buffer, int shift) throws IOException, Avp throw new AvpDataException("Not enough data in buffer!"); } long vendor = 0; + boolean hasVendor = false; if ((flags & 0x80) != 0) { vendor = in.readInt(); + hasVendor = true; } // Determine body L = length - 4(code) -1(flags) -3(length) [-4(vendor)] - byte[] rawData = new byte[length - (8 + (vendor == 0 ? 0 : 4))]; + byte[] rawData = new byte[length - (8 + (hasVendor ? 4 : 0))]; in.read(rawData); // skip remaining. // TODO: Do we need to padd everything? Or on send stack should properly fill byte[] ... ? From 81f392caa84f040e7457bb0b672ad811ad80d12f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Thu, 16 Mar 2017 12:48:47 +0000 Subject: [PATCH 31/75] Add regression test for Decode AvpSet with Vendor-Id=0 (#86) --- .../diameter/stack/parser/AvpSetTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/parser/AvpSetTest.java b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/parser/AvpSetTest.java index e01527038..0bcdc1641 100644 --- a/testsuite/tests/src/test/java/org/mobicents/diameter/stack/parser/AvpSetTest.java +++ b/testsuite/tests/src/test/java/org/mobicents/diameter/stack/parser/AvpSetTest.java @@ -59,5 +59,27 @@ public void remove2Test() throws IOException, AvpDataException { } + @Test(timeout = 500) + public void decodeWithVendorIdZero() throws IOException, AvpDataException { + byte avpCode = 123; + byte vendorId = 1; + byte[] avpSetBytes = new byte[] { + 0, 0, 1, 3, 64, 0, 0, 12, 0, 0, 0, 3, 0, 0, 1, 41, 0, 0, 0, 20, 0, 0, 1, 42, 0, 0, 0, 12, 0, 0, 7, -47, 0, 0, 0, + 1, 0, 0, 0, 26, 109, 111, 98, 105, 99, 101, 110, 116, 115, 45, 100, 105, 97, 109, 101, 116, 101, 114, 0, 0, 0, + 0, 0, avpCode, -64, 0, 0, 15, 0, 0, 0, vendorId, 88, 88, 88, 0 + }; + AvpSet avpVendor1 = elementParser.decodeAvpSet(avpSetBytes); + Assert.assertNotNull(avpVendor1.getAvp(123, 1)); + + vendorId = 0; + avpSetBytes = new byte[] { + 0, 0, 1, 3, 64, 0, 0, 12, 0, 0, 0, 3, 0, 0, 1, 41, 0, 0, 0, 20, 0, 0, 1, 42, 0, 0, 0, 12, 0, 0, 7, -47, 0, 0, 0, + 1, 0, 0, 0, 26, 109, 111, 98, 105, 99, 101, 110, 116, 115, 45, 100, 105, 97, 109, 101, 116, 101, 114, 0, 0, 0, + 0, 0, avpCode, -64, 0, 0, 15, 0, 0, 0, vendorId, 88, 88, 88, 0 + }; + AvpSet avpVendor0 = elementParser.decodeAvpSet(avpSetBytes); + Assert.assertNotNull(avpVendor0.getAvp(123, 0)); + } + } From cfe9e5eafffafaca4c233e9016699fac5d686274 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Tue, 21 Mar 2017 17:00:13 +0200 Subject: [PATCH 32/75] Fixing WildFly extension resources. --- .../mobicents/diameter/extension/DiameterMuxExtension.java | 4 ++-- .../diameter/extension/LocalDescriptions.properties | 6 +++--- .../{DiameterMuxExtension.xsd => restcomm-diameter-mux.xsd} | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) rename core/mux/sar-wildfly/src/main/resources/schema/{DiameterMuxExtension.xsd => restcomm-diameter-mux.xsd} (74%) diff --git a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java index cd069ca66..3fc278913 100644 --- a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java +++ b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxExtension.java @@ -33,12 +33,12 @@ public class DiameterMuxExtension implements Extension { /** * The name space used for the {@code substystem} element */ - public static final String NAMESPACE = "urn:restcomm:diameter-mux:1.0"; + public static final String NAMESPACE = "urn:org.restcomm:diameter-mux:1.0"; /** * The name of our subsystem within the model. */ - public static final String SUBSYSTEM_NAME = "diameter-mux"; + public static final String SUBSYSTEM_NAME = "restcomm-diameter-mux"; /** * The parser used for parsing our subsystem diff --git a/core/mux/sar-wildfly/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties b/core/mux/sar-wildfly/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties index ecbb03559..25ccd0a78 100644 --- a/core/mux/sar-wildfly/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties +++ b/core/mux/sar-wildfly/src/main/resources/org/mobicents/diameter/extension/LocalDescriptions.properties @@ -1,3 +1,3 @@ -DiameterMuxExtension=My subsystem -DiameterMuxExtension.add=Operation Adds subsystem -DiameterMuxExtension.remove=Operation Removes subsystem +restcomm-diameter-mux=Restcomm Diameter MUX Subsystem +restcomm-diameter-mux.add=Operation adds Restcomm Diameter MUX Subsystem +restcomm-diameter-mux.remove=Operation removes Restcomm Diameter MUX Subsystem \ No newline at end of file diff --git a/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd b/core/mux/sar-wildfly/src/main/resources/schema/restcomm-diameter-mux.xsd similarity index 74% rename from core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd rename to core/mux/sar-wildfly/src/main/resources/schema/restcomm-diameter-mux.xsd index 55e9e2fe2..53e9ad15d 100644 --- a/core/mux/sar-wildfly/src/main/resources/schema/DiameterMuxExtension.xsd +++ b/core/mux/sar-wildfly/src/main/resources/schema/restcomm-diameter-mux.xsd @@ -1,6 +1,6 @@ From 69cfe1eb0c7901ccd89c06b6ea7d3be86ad6e39d Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Tue, 21 Mar 2017 17:01:08 +0200 Subject: [PATCH 33/75] Fixing WildFly deploy script. --- release/release-build-wildfly.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/release/release-build-wildfly.xml b/release/release-build-wildfly.xml index b438f703b..cbbe6cf6f 100644 --- a/release/release-build-wildfly.xml +++ b/release/release-build-wildfly.xml @@ -24,7 +24,7 @@ - + @@ -39,7 +39,7 @@ ]]> - + ]]> From 2fbe2da2045947bd8e5a637e418e9d9c0cd502d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Thu, 23 Mar 2017 21:00:33 +0000 Subject: [PATCH 34/75] Precise check of session idle time --- .../main/java/org/jdiameter/client/impl/BaseSessionImpl.java | 2 +- .../main/java/org/jdiameter/common/impl/app/AppSessionImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java index 92b75ba5a..da588a943 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/BaseSessionImpl.java @@ -128,7 +128,7 @@ protected long setLastAccessTime() { public void onTimer(String timerName) { if (timerName.equals(IDLE_SESSION_TIMER_NAME)) { - if (!isValid() || (maxIdleTime > 0 && System.currentTimeMillis() - getLastAccessedTime() > maxIdleTime)) { + if (!isValid() || (maxIdleTime > 0 && System.currentTimeMillis() - getLastAccessedTime() >= maxIdleTime)) { logger.debug("Terminating idle/invalid application session [{}] with SID[{}]", this, getSessionId()); this.release(); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java index 40ee4554d..bc6b668b1 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java @@ -210,7 +210,7 @@ public boolean equals(Object obj) { public abstract void onTimer(String timerName); protected void checkIdleAppSession() { - if (!isValid() || (maxIdleTime > 0 && System.currentTimeMillis() - getLastAccessedTime() > maxIdleTime)) { + if (!isValid() || (maxIdleTime > 0 && System.currentTimeMillis() - getLastAccessedTime() >= maxIdleTime)) { logger.debug("Terminating idle/invalid application session [{}] with SID[{}]", this, getSessionId()); release(); } From b672ed25031b1ab84195412d86380f61941ca5d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Mon, 27 Mar 2017 00:49:03 +0100 Subject: [PATCH 35/75] Revert experimental change on AppSessionImpl --- .../jdiameter/common/impl/app/AppSessionImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java index bc6b668b1..69151514a 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/common/impl/app/AppSessionImpl.java @@ -78,9 +78,9 @@ public abstract class AppSessionImpl implements AppSession { protected ISessionFactory sf = null; - protected static ScheduledExecutorService scheduler = null; + protected ScheduledExecutorService scheduler = null; - protected static ITimerFacility timerFacility; + protected ITimerFacility timerFacility; protected long maxIdleTime = 0; @@ -95,11 +95,9 @@ public AppSessionImpl(ISessionFactory sf, IAppSessionData appSessionData) { this.sf = sf; this.appSessionData = appSessionData; IAssembler assembler = ( this.sf).getContainer().getAssemblerFacility(); - if (scheduler == null) { - this.scheduler = assembler.getComponentInstance(IConcurrentFactory.class). - getScheduledExecutorService(IConcurrentFactory.ScheduledExecServices.ApplicationSession.name()); - } - this.timerFacility = timerFacility != null ? timerFacility : assembler.getComponentInstance(ITimerFacility.class); + this.scheduler = assembler.getComponentInstance(IConcurrentFactory.class). + getScheduledExecutorService(IConcurrentFactory.ScheduledExecServices.ApplicationSession.name()); + this.timerFacility = assembler.getComponentInstance(ITimerFacility.class); this.maxIdleTime = this.sf.getContainer().getConfiguration().getLongValue(SessionTimeOut.ordinal(), (Long) SessionTimeOut.defValue()); this.session = this.sf.getNewSession(this.appSessionData.getSessionId()); //annoying ;[ From 24748c9707a00f40f1b1d04dd8dca4462b337d84 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Wed, 29 Mar 2017 13:15:36 +0300 Subject: [PATCH 36/75] Fixing deploy script: add modules to SLEE container lib module. --- release/release-build-wildfly.xml | 28 ++++++++++++++++++++++++++-- release/xmltask.jar | Bin 0 -> 73652 bytes 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 release/xmltask.jar diff --git a/release/release-build-wildfly.xml b/release/release-build-wildfly.xml index cbbe6cf6f..6c52784dd 100644 --- a/release/release-build-wildfly.xml +++ b/release/release-build-wildfly.xml @@ -39,10 +39,26 @@ ]]> - + ]]> + + + + + ]]> + + + + + + + + ]]> + + + @@ -54,9 +70,17 @@ - ]]> + ]]> + + + + + + + + diff --git a/release/xmltask.jar b/release/xmltask.jar new file mode 100644 index 0000000000000000000000000000000000000000..8c5510dcbb8398a407df614666845b9ff1cd6e51 GIT binary patch literal 73652 zcmb5VWpEuqk}fLQVrJUHX117_nVFfH(PCyi0*m2@$e@l{slmz|0-Um@VY{&6q|sPg{T!+#I3U=Uz(VyZ&)Qu5-A9}{3;ivKMN z1IF}M6jXSTru0`-|L=wI_xc}EIU#u|aWNHD208INxv5E68G43!L>YRTnW@<(Wu_(8 zy(6b75j00SN!b}mHLyr<@@b)k8L^58@(Sus`IPSu6rQ1-Qc&WZsZemZv5=756>zyf z$2~K2?o{}!|-qO`G=AJkg&IRa5lELb9S|H zF|;%O`7av(nAX3(6aW81!^8Hks!HxW;`KNjPVy-63#;nOQ zD(??*?2p%Fo)vkQ(Npu!5WnHqtuEs4`3ELWPg~BjKd+o;esa9L?FxQ;alqUyVGhRQ zu`5mJkJ0ZA({ajRb-=r`)P`TsPM#znkbzoguR37;N&yEYFxGfq{mWEsjGw^zi@9(c zE?>)^(0&6@#Gj?s%!Fedu{uTq)=q;TRCTT{))wG zf}ZnZ&9NG8%yms5`cI)44FDo1PrH@@i8BxR_~05ZE_d#DZ&D9Uj;wfGQHo}WFdDm9 z&s(@0=~3skcq1HdpMERp)@WmIN+q-_y zefE$GRkH+b490joy?eg27NN0Tvq_iiM#%tf6?AiE1}1N=U16M!H>Y0|q0B}`7{)v+ za^4Yd6lP3zh2hW?(rft)os66ylq@}8t;UGD`V!;K;ng+fhA4YkzAq8_@1LmX@(p*F z8@Vk?zWY4$;D$$M$rAzuY1GT+8Z?zM+c1?f+Cy&xYG|f$Nf==Wdb7C*u_dJNTRU}Q z03B6UAG}#ByLL~esV2Qd9{l4QYCBKkoN=U|M`nkqOFB;6&dMz7i>gZ!Uyv{36&?2_ zS08NUa6$Bwar}KwU-(m}q|!J>h+>F8TFIUZP%JE!;l0mLl-YGD+jT?|v6wQw5EI_e zBP8k)ydmi+^@$&p!MkT$@(jNd357EC-%DLhaiJdHfaiT7+V{qDk|KfE1NT$u18 zq}El0F?LkN6Vgs3`GK3O(9%HH0hnDHt2!DZ@*F{!$a7+|;;7Gpj!;nM3Z17ra+qg>fl zVIemBHe4*xRqYBPcq07b#^D3#G(;ju$EMuGLni#CH-rUO*ofC^pk5qpX6>k_$#;JQ zoZ&*6$hm}kbq{1iiD#?KG}T5$@%MHX+0(AjStyyh++wuw} z6iuo4WiFdCIpf-8l226SfSI^hTy99YujUVTo)Zg~vS-C$C@nE6^`*C3BJlRBrS|R+@~kp;*UA`zzpCri*GM68}b@OM|K94+IogzWdCTH ztJKr7@+}$9DFYM;m=7z?F&S)(8VK;(9Lk>#r4nE9T5j{y9Ls7!XQA3p72kQOvlXto zT~t&jxxcwgp2>NY8ZRz~dsKegA}&`FjD~a5U(7-ulmzi?7oiXRj8k8FU|7)Zv&HKW zka5=wO5JXsV6vmF$iIrmSy9Hy@tys3nwxZ> zB_A_~x=t7O1_CyTcjB0jJc?+KSLdfHwT3?2cT~|bpga(#N|}(0u03eBD(&(?)~Lyz zwA#saghCJ-z3r@Iw$etEB~?W@`}NBsHf&NXjMDY&Lyt{B#(Z^#U_NkmRkk*H)>&wGR(&T}+!iu!Tzd^Y zWO#{6g(TP5eI%%&WvZOU*~!mkr(sX&RjusmpVK}{9VgeRii^JIek{)zKaNgl%=KKf z5)?PpQ^kmsLo*VO+ADLVRWOZ7(F<3jX-$IT8Z=RNC_ngoZiMwj#LF{`tLId^b01fC zX!E3b#(q78dvD2A*)nq0A3q%WVCNgB$xrfG-gr)g;#cLr>0RAFi1aWeHtI{(J;Zku z7s@7AR&(qpM%l>mMugxJFkFmN@nj$cY<1&HCj@*$v@4PI1{8l6^*^I- z)_l^d@}-KnxKe8iD)P*X*mrNrZHLcN#-r^cpzTY}sWLN*8wUU$Q%BTYT#jfJOMK|> z&=em?R@sTD;M;mY-#Y*QcR8E{pcS3ufL1Vktu+ET(gbS z_UFBz?BORqft#mz^K<f1(eoFPA;MP7?(2`yP_pGwtcEsOI?Jn8};sKP9MKLc}YV0fDB{@ zat5-r%nrkOS?yJ>xDC4!|5b$_FSCV~=So8$@yyn=o45KHaaR`HZ8q7dNR=1yUgJo! zk$TLrFUE-h%y3YSd`xD+TWC$Gc7aHdQidCI#rgif#irPM2l%Jvg!Xroo${PYyj%7l zcCHSZ_XxO7H6(-V#nvSFFu(1ff8$6dRtN7&+3zVvP77d9?#Fe2h8F@=K-O!*Ua(yq zA`K*mQBwjtr#x+>bcJbE`dUvzzpS7(#jGX#w9#DCpS4}zSN;CRRw#!TX);a6f%Oy5 z^b9U)9=qWbjYEaWw_0Zf(uUf=`g?DIzpZd6+!}*r?wBI=X3+Sz%{EHxMxSpBSfD$C zzHkEQLR%&MLhcKMBKnP^yr}}xXx^?6vuU@9Y^r?gSLp!P1%eJmxSelzq{hMPC#DuV zgYCNm4qGv-I7504%)xIU2EO5(F_0Z!gck_IrME4NIf_kR7^*Jujy-#*FX17`FPzvr zG{iUbR!Ms60-7gqOjAo)C$V<2WJ#AIaA{zB*n=`bxcIwWhz0RaJ!n@0MR~GKa-%zo z8~6Zl1$oj(d^cvnijho<+dDrZd(&8?-#=j~q(|g2$#2{`m8+xNc#=z9!pRx55kkLI zqqZstWp?u8fr>~nL z)Ne74l2g=U8x%5&ucL%WVg#YoW_s`=jF}p^nOVELO@H82dDkD3BQuxCB&cc$yzIp_ zUgT;q2p8Yh`@FjNmA#!$UhIDIeSYoNp(1AvJcS5VGH}cqL5SkLd|0Aa?fHUBu@2knd*me+{1;HCiu(-z*d@13H`~wHe(~SlmGJZu5ezVS+hkboJ+_5w4HjKi73v$x zDXtwyR1DKi#ZA<-9J@NB>3zl;kStND8Z7*Ex-EQd+Romm+K6|K-l0Oy6CBwwkxu1QKqW3AoG3vZ)!b8}Je>pe zymHExqr`Fw={GD0mtA=9FZ>x7lV&NpcUG7(+f5yvvFN{5qS+lV;}E)IC!ux>5=P4d zXgySh(x7?=S8;opZ|KD>hs#c9c`J)`cl+J*adhe-UT1&jR;|ypR^qHdnG#CtED$^` z@;25kEZ7$R?767PtgDQE-s$gZH=P^ot0^cq9P^LSL-c~emjn-rsHv{Q|`U8f@g}^zXH)Y zV@rQI@_IJP7ehv8^jJG3lYvYBNUAG_$@ zo7%klfmo>8 zp#Y2p>_jdGlMv}_l0vhpk=1d9Jo~EYNJ(d*AyKjqY@X*|acl`261RYPyTaq*GHST~ zoCPXN&YdBY(xBv1reVhk!!3&kyYxBE)0Vxy81)H$;U@c5HT%joz+uc>!WsMn)%l+S zLN`SP#0%0~T$3@ywd}I7;f+9lR&W3*!VU>(I7QLUC-%Sl6t_q7rhhOsE`NCp`v2fl zgk8C1TGXF0g?2* zPypaJr5b?+P@3}98ni01!uObZd{KxD;gP4-^fwmB#+pqw5Ih)C5q^{r;JX}R72rD` z(gGY~EJYY(flP^d_lKNGmg-(_*uke)Wk87DDg$jdwt&CJ#0KA*p5x-4Y1FMZT0Kl) zKDb)9RoB|b@7ZsZUe66N^X~xkjdkWdj)h@G&ZayDR}LOM`BT}*lG)ifmQ`wd3ml7r z6UF8|mh|Zc&|zxR_G(x+$62eXaXGaU^=w01)a|1H!YzP#<8xP98sDxgeJ^V^V&XLn z=B~lg^_=iIRTgpMgl(Xnp0|_@GNX)}3(gAeW;23kkqfSyXIS8J0L9`N!uhtRNfm0V z9BV4f;{1*F1U*7&kkrP!X1mt4KGl@tkHL0$7^(P8mW?n(#k~SY*vT(n4LjqBvIzEP z))O3fhir(ytCEkr>`LbCdtxWtXhP8=%{HxJ$gLgH#wO(z-v(+gSriiEvM%^bmQ(F% zIiNqCw(X&};?gzI4hgoP_!Zz%O&2m4j_V-!8OV~`*3v{IXdGHr?P4-_UX}x}$Irqe z(Eyng64UiC{%>OQ?UIIO?xvd@q(+>hT}d21%=ZjHTax3;l#uSr#y zDsl8JJV|=uTQkC>hRQjFd1ltt)YG;cHABs8dQp_d%yMiMbB}@1*OkwNy^Mw*244a- zHUTYdR*ou*=&-D4%eF;&=dH2{q>uHyVx?V9EWY{sVIB#_H44r$I0KTYrYKu2FX8ouP)G z`eu%62_YA<;l#DmU~URYF8Cc=JxhIZwJ$QC)37Ph9cYg>ie=R+t809FFhLoS{=slS zMDr2hXZq!2vmCA2Hy88feD@jITt2G8*2WGkLMFU%wGbpblU|IxM*%A^k1Py5DYeM^ zK!rSmpx{4_Af28MIYkiKvKYA$IKL+5os-sXdx>P`?UMh)O6&EC?Sr>oWsqF^+xA{y zo<2f+NaW|fU$Y)1uD&8mYlz=x8YnYT&qL4bMG{TlfLZ^rWAb&DoGT|l2nlZ{dO}D- z`t@EvZ^r?gGRWIV`&qnysaax`si=)*1HX?ym`2FkO#8%(g?bVmK>yD?@mAv0*JT zH_6{i&>uYiUZyx5rBlSknq&*BQAjeUsX1KH9!xrjZYG+4y-o*)o3uG8m;@;W)bT3y zc;!h6iIhmmKzSOo%Pg)ZT<=|35Q}{Uiw}7F0v0Z9&4C8n)8uD}fikmEH`S3RD1rYe zfrTs7jTEKM0mmVx5A?v_frKo_KFtUt=MDEPHBt?@wZL$@JGXKVq*VCuF;&Agd0J7` zH^{=gHX*?}=9FXY>+GMck**%5k@U#AlNr^lo_V_rdnP+D_2)frXU$TGrN9XD{6^rc zx#El|+mGSl2;lf0%@78QH-Dzc{i+A~26XhOgUcC;*T-mi<>$Z2MJiFuUZ)zjc|OAM zHdowGbw$GLQPlQQTuG)-Ey-6WnBK^nu&4ee`^Ngr%mt6>;zIJf5cjT~H7`#Gz8;|^ z*1l-r5#-h#G;0+-z}pbAlX7dbpvQP!R%#?r2cwqLAOHKznJP6_-79x^E(u3Hm=$NH z4{MgsKBVpU5^;1buxXHY(hH3=d?iNz^yd87+UZIzG|u{~v;+Hqro2ZjkkTBzlo{Un zMfVpz%B=j8n9Yq~jsZi?S` zqonSQoUC1u87>EsQ!_Cbc!Mfh^m}Ei?g?ui)IC*T9!Zj2Q!!aGZ@olQH78|%Id|plZuJrotcKp?Zw{6Yn z^OuqjLK2U!+`HGoo!QFHFZL{Q`c6ynPV~DI>xfur&5AMP^$9Kp8%c5?Le7zGDrcI; za3)ac-e7Sjla^(A>*2uCLX;MQmz%X5^6z_tTCk!svfmADTJd+}_%cJzKLz+&M2jeh zaznU1Dq$65ecj1cEG`?J#|j zH1kfM?8ReYY@^09Rv1mxOVXWRF>@l33^zLFbG~)qAUiQoB=#a~_kZ!(-v{9ktp0|RJ6QiYMg8A2c8Vsf zhprgGr<@z7ebZ052@YFWxy@pUOq)bIRAh^SOenYkHdQou2nc-+#?#d4E4QZ-vWWsL z6h_hHA}3flpfb{UYe{4|4yG7r7<~lZUJ0arb}e{)X_slY@O=3+{cgVV*=uH&=lRkw z2995~5;7NKO;Znfodnbd>@W_wvUqpkKdVaiXE@a(-yL_?y-up1mC)%~RBWP~{QDut*eN{Clkn7ol=lXeBFT!j5Q zAz3I8Br`B7@R1yln+Tj_@gC`4B(5G~XYpnauN!}lM);97yBiP8D!gkmd3HnDO?c4) z^x_RZiMCxsgT6ZU@4&sI2*Lrm-`DyT5cur(%HWP-Qvi(wAr7lZ)@hh>n&Sl)aY+%B zVH{M?1hifW!p<6W?D%pe3+tLR83a;X>MR^s1O)QGj>}VA3eAxzJzuno}A=J6Lxy`Syp==W9Jyh~sY4QzX|~2PbM(&8VzO zYS!F%&x(~Js#7V9pnoxJ!7a9(sGxh8I<>cf|8tilNH2T{ZYD z-Qy6RHZ%0A1P!C0RhGQ6QX(cdHt%^i57-(l)!BJ0?7XHT$`bdTnZ*ZI$p&dy-B#RM zJ!|1C@~Er13zaehr&M(d%px&!Vsjd@RYUV=s$F=PS88Ik7K;gdK#mP3VBC|xL#cPT ziu}R|oNF|sY)@QFLh^^JcO&&&ENFffYY!t_;^>cc?yg5byiWFp)z_gy6myy5C@)+&d&=Mz~>r{|~u$L_f|OWc1JBKG}D?PbE$M zvVCUI58x|{KAXdw>YgyQn%N*!PNzp_8b{19`qzckX3BP@YmOC9m6zna+$thj(|eMB zx(fS9%JXfAN=`@eS`t6>>;C0X8f@m!g22*BMPd=P%n8*yS+$Z%IrbmTT+$(OEnpge z%28GLk+U}7rO8=FJx5Ja2~8jV)~OwY<;I4P_@rvol9395oU|J45VKW8#n}>C>f&cY zZK-x;>ikYOejTA~i>}AYphx+;aH}lWSqA6&h>iNFa=JcRG*U`<6{P zmP$({he!>(8U`Z`+f0o+O?5gVa~wvF^Vo^x@FkfJDA1@L{$boI`(R*D+K{lmMlwjH z-25fwzA`z zd!;zhJUs|evo`iAB&Cd;PHjzT+c@!9rPUEcR_auV^}Snqrk0hj8nn}n`$=K|c!_xp2LI$U26$G^5=RorvXG7BqAdwTgjznoID2BfYrz{QU7_*c6Vjhkxl(ey zhi8%JjMTe2Gn`DTM+c5=u}#`X1~mO}DEmR0c^o~ZJGmw@)nLTB&gX?M!?smoS8g#R_FYkln$ff>YmiErwk6^ni;E=MX9#Nn|7&e$h%6_#O0>7C`FU)}d-N{D8vf&qT zanhYmb=-@2j|x`#2>85~Vq>_-a?7&5^l{mNRy_>U-FjwrA-u*GTCX_x?egaAV+(a4 zNA#xit_DQfM$?nLrJj{Z??;4Jw?P;+ag+r6o39V``NJHp3X?PmqF?jsw-vd*LJc~t z9!&Dnt@88Vjg}qT?s%s@Uv5kVWl=(G%Vthr_?{E&$^{s+GM3dSH);xmN`rx&QUESa-Y8kZo5Rr+Np zrDT?(-ku|{BiccrEk9gBD_R8wi(t*oE=eLb0an?9B|y)7Db?Mdq{%O41Z$Wj3g#y8D-BH zyNzZEaz4uq#Pbaq#b~bR8ap~&#k}Le@ij%Nn*c8FVEKS>k?)Tkx}l+*xPV|Qi==of z&{kgwEs-c!pavgRLxY1dkYeR619wm-iU=dUtL40Jv;=?8VH&l=|BP9}2YaXW*< z?+bS)1@xq59#z3|5l*Q6ym9i>Tr6{Kuud(D_O^uT%Z*?y|+llyzA0*Tq5mwuP zGbb(|`~ry^Pb>?K2C3kdeRt4sdltc|KCYWz!CQjZKt6eN=_XYw)7dqJD}aX@3qa-{rf>w-yed0=6B{WGzu@JVJ%b@ zl9>oD#(gnVY*E>)^n?d;bZlo2Kpl=p3v${`jKD=d=i3dv_vWxQcQ?{%e>J!Q11}{*0jf`Pi zT{SKyz{s6x+m&b9A15@iW$|^yq+0|=%N%&zV;xx|RA}~)4~{3gw^U7L*ciJ7Ih<$OLJdZn7f~^oyV&o^@e-&AvyQ8 z`VZ)W4}tjPh7*kz%OhPLgFKm1$rR#-^=u0j7agbN0I!dX?@sf5SjS59EjLW^I$TI& zgW=)EI8976`{Ch5R5~6g#x}T{gCY(Xu?nj`jOjXLoqEX(G#k!JHf?Z3&xpJhYlh7R z8t*)JCltOT{hL@j16^=m&x5$6jK5xMc@XV3+~~>TJm-d7A3(#!&D0NA38RWf$VmiM zVl3*nUxc-e;drP$W=fIJNSVx@{WhoYvj9pwgD46CpPq&FUVr92RFjOfo+IWyRKMgY zu61$ym1PRG>^DVtjj1SiQJua3&ebq>+`3q~e_;D#k8RJz4xSadDf2a>C#H$pScZgN zhGObCVNG$M@2=P`Xoiul(@u-YS%oBU0F=_77nl&=w+0z+WWM$_-dKY)P(KCs&*{!V zbEy4;_BT3T`NH*OfZA-STT{V3u;6&VWFuduP!xan^ z!eCj6XDtlw4uJFBdD%KJf7<^zU_OE%w~wTjdR!!Dt!iieFv3)dp83|NZ?6Jo))jv}(xz#Q!!Bd^IV zH%6=Mg6`a(LP5pImWzF-k^?Ax_ZoC#1by7piQARass7ry!?-(FxsXP;rSBmvb(#$- zguLDk4vc*r;wjy!P}!Xkj>s(x+m?9W;L=*cCeDeGlifgf07=>unwtajZ5K;)a@Uno zWHtUD%$KZZY*hE%eg=jh&UhKnE}26>zj0on;0V*0di`;=rcZEBoo~3$O9AG^G4SIZ z9B$yKF%X!WTyl=|n$4_!Oo0zX&(leD%E~;{MqyjbREXUf@OOL6=kh`)J%_z6_z{%gD4Imj0V$^OOqj47K!8EA{%zB41qD%M%Dd zcYCOpJ)GwNM^r!D=73A|x9T`;zwE~p@VWofJGQCP-`NW1c-c_)9LghIjIQ1^k3t+< zOLm`&&MiE1$5jfnaXGN9F<$TsJT+x8;+C7Gg#H8Vve*?#s#HKsXkUAt{aW7n$^YuD z<=b6nn!fRD_l$gwX`JTA;VGjPbml<~k);}-jo5)}?7Mk@+Ee^2k z2ccA#sU|jhA>=i+v~E)(UE28SPygG3i7%QH0wBa??kR3__mxm&`-m>VlFRB zV*)mi@UmVRb9RwohC~p zV7CI+IEI)M(AM{bD$h|+hn66}GHd$2i%0%S8gH10_YE^-I}_vR375%*p~)$s0T-H3 zlY25;cimX}fI{3US284BqNPI2RgTe+sKu@@G(txP+(w+Z%`)lNj}*k0yu5 z*pQs(2gefS*U}a7#_u~4ho|ru=XZ;&m_^z2$27mG*RUfI3nUjv5C^e-;gO%)V#lG4 zvi(3kphC}Tq+qI;7ta9b5J|h`UHF+Wic?EIrw*IP<$F{9o zo3_ATo@pOm(4T06%YA91d?0gj`*LRb{kI^i`_tuHS{>L5h$>2Hs>6XPZ^V|ay*;Qq zN^Hy3VK(48zn{q}jwI=aF_pUTGD5OdhN9GBEPWbKYR+}rf%_WXtN08lk}$RYf*5{v2uB^i+7qV! zx54(151&Il&=4KjQZxvAI$q`$k~uAA&-79=I2CB+r&Mu&th-_?g!vp)STP)0udu14 ztFVvtN0?k{Nvfl!SY`uaR&~t|?qxA%gZ+ZC=5kS$pIM#l6g(!>kS7Ep0S?K9%y!vo zAPa-T>k4P4`2yb9BWQzvd3iz3AY$p;=;4n!wnp{Fs0ilEPkqlci0jJ z!wb^TH2DPXkzb6#SpplSZ%G)e&c8QC$f^Lk#3<7(&|9)a)Z^FE(mpUNBK3s(8=n?5 zi#|`fazpL8qg(yc&9+VLArWl39|RSYzW$X_-04rQ^7EBAInW0s~_|P*pE~-Y+9D&lIW8PWMw=XlfGf5=#(*2w2(q=lA>BlVC z9&F(cOmnYlgw`o>3nZ$b&AsXP?;k8{>K#*&)9H1szE<&emzH&XUAv?~(;vimOB`q^ z7zz--{|Gv}#6n!q`_Ms_LPaF<78#N?4KYcRAFnv36NYFFc5gLDH3biHhY-rZOugjv zA)eR_Tb}BI*2nngis(}R1e=;M9Q*xR<)1Q~4+^7o-NM%VyarkxCh(*J;HSOPhY=8o z#?f=6kmbylZ;JQsv?vz)Sg*y8Sr{PR{T_zV_-`TpU~s^y7zwYg&n=m0nakDm@AIK( zep{h5Q*!OXM%ivrsNX?va!6T`I)kL%)D-_p+b(WnxFu&*JrceR;lt_Bw1j{FUAY}s zzw;-tDq}h}0W^wO5*?(YNyqpUO+EJ!I1yFq6L1E-giwojfwRT5c2vEuyn+SWHg1qY zXODNlo6bRfI&B$A&Gx@xlh7cxrH2RxCQ1MX#_)dun}0gA8ckRiU5%d~AM5O%t)^Oy zHNPf3rY(v=!yH@B)-eW%2_c&{7kXJMAkXUOt|7qQw{18k{|2XMCP^{C->uzHU^-@go`3 z+^hA6B?(0XlZoP>fTPAjvU`kwo|WU{$6Q|;8Okt0uzG)~c;B~YwGyw!FVGI+aptbv zW$u0@7=D*ytMAXAC@owB{VK0MJpT44PXNJ>(YQWDBh(Lua8GX)P+v)4-{qM5y9Y=3 z5u8@&^((07n>w(W@IycC_{($e&ii-d+4I;feHfBRBATjenkphl5Q%P0Bx=Ix9?@Rjy4Z(o#TZ$0# zjqG(}B2_{cfNHDDONjo6k!>jA2vJ5hXDXdI$l!_EcV$vhVUrCsh1VQ(h+M)kzp$d=diV*5=fO0hrv2BGL5o64Nrt8JZ0 zuB1l+pVQ+mEW3l%aGV!dy3Qel-y#&}l;I`#^Nb-pb)K%~z%caW#^p2&s53g>peulb zBr!Ej-1UpmyizGe%_QOxogAg95g~i>rCLF*D);BI$Z>~WtfcF~ufuudvptbII-?$H zqbZYC0Bn~AVlg=yXEWc%3>%of*v@9UUUqrRZV(W-q$HEFP&+>ax3Sdk^iW)*U6~6@ z9;O<~&DR%=nv?2ZfIqO4{Ig0*XkmPflHS%Mf1lxDvHR;0j*KuX4Ibr7V&immP`$8< z48Bo?>Gb{mXjyk>BKHWWY6~xg9mB;#1f5$Ilb2A+9%TWZ+K{dCBb)JjQMQsf^|EP4P%Jnc zCLz@(oym2sp>4@AJ{7}NaAd5JyYb6TEyRY)@`05eLByzAGvR4fh7TutP#^eX?+X@t z#?P#MYyh+rcHanq6XMnFq_)V)xTnaDKben#L@0vr#CuGr%^Z#{?JB?nW(;wiYC6;= zaoYE15;6U)Szq@^yt*Z;NtDflOcyc1t-6&;ZR!cfOMC{4?XPa-z{f$` z<@*axldROIh$ltYL^% zm5ul)&`Hn|jgBQ$6%9X=I<%eedbc{_O#5rO5h=p;Kb(zwSSIyV2%*^pEH2k=D7xr# z2_;Xb_ivJ)nlLOJYl^LMR&=XPcU`!hfrnh@+sjQYK9s!lBag#jQ}|(DnjVa^>&Y6n)4>ohUZ!8r|Vae~L+>^l{wj`Tc1vBz6vgz7n=5da%01)Y7 zd35nxN@;s_!1+&c__&dKQpsnS4&;hiDz&!7#wb?2U?1l3WulB&No`PC#HQWiEeH05 zrR96fVv*0OM-IDRl`BlERwlnG({uV^!)(+#c+m0Mc@ z_8b2RJ{ytfOu)x8pyf4_^6u#p+|--BU(IOFe?I9Lx4S-kxHSBLmFsr9Gjjd@i!`3O zy%U#mZwH$jau%mM=123h89fc>svL{~t5rQBcS!?v!Wc{+`2JSp(9%UXxtv4tN;h5~ zP}0hg43cth6Wfvx@{`P+s3D*htyZXeY(d+-@`-G9_wPAq|0CMkfM=CJrTqhG$4jZU zPiN^t+;@2g_sA0tb6YMU35J6`SJZTo?9)p5i%+vRwwWR4tQVaYan=f`>&iw8Jofs! zs7{w$nV%=txlB0@tq^zY#FvzWl9~3F$}BHfRNi1lN>z-Hl3C+As8iKy7^mbcEDEls z6g6KFxp1pS2-8S5-MSveI>X=`rZ2UPQ%f4Rm5S1%a+DwzBv|rlwHBjMDqbvw9Ali$ z8L7sf0K2r{d{>1XZAi?Bt-k6A7*Y$C*fP0cI;tCUm94;)c*B|kW_luChDoLnZ^KaA z8?yYaPvhtgswh(zlkCY@>kE6*5o(`rP;kF)m=JfzjXf1=Uu@MEfM9$N&i+ZTqLA;q z3xRcMjLRSpLe6i}(7cXbaVI*4LQX7(e;9YKR= zD3T}dfUgIp>KYfWH|he=bCa#lDevfzV~-$*?RblI&%y~WzcVWh#` zJEh)wRM$9Ap6B&xUF*Z&Ti{pchsait;3(xYJZQ2VUSWSo9n6hol2=P_1D0=Cz#ln& zLMAh(`2Cx;6Qf8qa2|tK1z{F&>s5!D%PQ~DsyHcF2=SEs9rRS5RLbq7MkqsxqGn!u zs_ywroBp5T37ee|?n(h_n+T)0Ck9N-%QzSNb;b?!e z;&~qaU^d{BPE>QZ>BziF>wwk5^*053sm@hkHo&A^ZoT8@l39d zHlQ#ZlP85D*kYV%mvBu?=d@+xuizhf^I`lVtWWNK%;Y~@I+X#lf7`fex!X9<=#I|*mKaQfe z??{0?4p~=q!ToXQd3z=+R}$JL|E4pZ3*Audh`$NgJK>%p@qIvo$G6>o*xX)Inc7%h zym6D?f2d@MyvT@t?pn9;*H}ZDX-avAg9p*5*L#peFKas%$aSBjg1r`_L7yCCnP4fi z-~lQI-%J?<{`TYi_M7(Q?ON%@9y9H-so?B|DPHh6b+qSO#h8S zRkpTXG{Eqc&t%t=wVmeRv|pT_%tSyWc`hL-Z&xsdOA7FnS*#XcEIusU^t%lTw9DT^ zzLAKS-CVJ&79l&#zRR6-&UM~-TD`s&1m7C_e<*vW@XFd~S-3l9$F^3{UKsQhhS=CzYfsDB` zwhh(Slz?@JOQ`ZqX9tD}F!!VE&%P&PffFAdF?6yI_QKc#QfhqI6zv8h3ynMh8K3;T z+3*C%4qVrP^W^Pl5%5$9zs@s@cy5I(?;G|paCr(zNd1f-cZ71c%=GW1oY#+#thY~F zG6D?!6hcVF&{z{M14h1##Bt_7ul9m^&+0rg?bfGogvm)j9&J?(`L_}J^FhYoZK15i zxB>Kv%%9|RxD9Dj)TNCJi>hsHj3>~SIc^>-)zF{pOV75l{3HPY@nW@nJ)qYZ zgaX6yaw*Ow(qOW~%!XV9gR7OL^4g4ATD^QJIV{69D1FR0rolJyl)xkB+Ay+V)aL;u z9paN*fT!APZEw}OK54kLB7%|#1N5n zuEK*B)=xYxAuV0F@mHj`+_G0x(4-_@j&o0x1 z^dBnPfJQ|@DAYApE9k(2MkwX(%0{dFVnsx^4B55(QQ53?L0DqHyn^TOvHs%BcEfyJ zE3U^8ISYo209UDK^hkE@SOAOEMV)R&JdgDX%^^cK^>S(V>V-Y+DR z1V4#i&9q}RcEKP>;l?<_iLgo>wFhgX(2nCBLuxF@I)|5Cko7TcLV`b-w}OWWNRXM4 z>zQ5mIj2g4nV>_0?~sSZ_RVZXg@UO_AR=wh$U4dTQ+7sHU^K*`F+_Du!(x)0xi-xe zeWq+M8dddKBve4F?a~Uf;gCowGUY z+>oW5C^bnf_1RHPfXY}$MtZue9O^A^p{hVY2PAW~QF_uZ#f1%~5N?&86+3QS6#-+N z-+ov3@1Js~R>Wlnh{76el1NpW6AB3%2#0^FWvONItcU>(4{)G`gJ(x={JinAk!G^y zGc}p@tbEvuLr}rfW`o+BtAth~Bg`W)^1MgUGQ2sHIW^EZVq;Bg^P^hsL~NR?C+u3I zE<%WooDR{<=V6eD&8!`r&%1#lA-BKO>cf$PG+N#9E!Mem0x!}OXF}Y;t0XBUiTh@5 zgBxAWlES3GQytSOC3Tqm*^T9urZKrhrXxIc`p`N_{*(uL+~5yn{PuE9j`B@WnfINc zK4>tH#2LpjX9uJwGGUXg&tzjNsRY<7UGwwj_0Jq)^P9#|gN!*CL5unp?U?9lTtoAl zY1*N|wPZ6}O`oQBn%nTg8e1!Sh;AreWASTTgHMyWat#v>S0?Dt&a#G@T-^VlHc)(M zZ4vp|#Xp~w#1K9}Co}f7^W6VS@6nr#`iD-wJ$z(M+ z8^Uz=1&2AH;SPDg>ELT{^q3||XK_eebW+Q5SL+i7*sr@Z7;5_Ee<FV?4aGR=--CA_BPpCPhFSF%X;vc6+*`7C57m7SlzD$6==JvUJ5cN>3-oP{cr|# z(&$68;is^aeAnZCEv74BW67l1lonC~no-xBU-?#EHq7gdQ7{A45*}}zQ~B=Hr_C}> z&0t9Qnq##?5=7U;WL74=)h@mm2TQy4>cPzW%-x zy0r5NGf$W>9=e7@ZSuyZX-h+I3c;T*eUPQTRf{}0p<00I5yJaH0qMQie$Q8#BmOgV zhO!j?G{dSA{wiicV(s$tmyXAb=67w0;R{@|u2@Rm-jE1ek(Uu*uCVA&bNVE4BXpe5 z^-~fai&`u6I-~xqzC$b9bjU4Mf{m8Uz%`@;RNFnmSu0k9$l5Z0xLx*mk3_Ww?bo&Y zvg!Qz9G~N=Ankk<ryTc?GM2&#g(zxhFY(kn>1!>qk-$2uhJtUZqfth^hrz zda?>pr-NYgNl;>D11uI`Yw~#sHn-yVGw{W!T-HrKLH>y+ zS)R@ybTIt@+dqyj7$?f`S->m{P_;Ruk3~PmFy3tLF^Toa83vf{dk6wzgZ=b{i)gye2414-&69< z3RSqimfCtlRf%O<+C%2Q0Ai={N8P<+5%8Z49AWN26XfjEwZD7$285QpKNEM8?vC^O z4u#gd&PFK_kZbPGqj^G1zuvI%9t|vG{q@4{?i;Wo(2u*8Lw}-!W`JpB0pvr2wf~@m zOxBd14Ke8g#4m(!Kud;XNKrYd^`F+0LLD(@u0T} zsmEf=!NrE9$`=-AoJxwCTp`|5$6xcbgj5Sc`!UO~2L~X_N_P6OopOUbHNFzAhfF`> ziPd4+iE)*99T9b9D4plcFWg~;&D=dc*KE`gg||Y#>%-g~i-m>ZBsh$4EiyOHrA^jJ zy(i%*HynF|f+a9CZAzMca@5HYg%prnoHeQ%2;bAG!6vr`HMz797iF-Mnk1M>btv3M zo69zG-1mLWChnRBt7rI(`OE%A+EZls>e?ruLS|yaCL#7{^*I9%ri})P`9U#bpp$Z1 zx=~RXmJKS2V?w$pgQFr{?~hc?*CHhHU(&tl=g8omv1gpW^tI+hj=SDS>cavnL=Jy) zd1qM44?|^Jl?Z){i6)7hc*GW!pDr>{NyIWI8bq|xMB3TUbuVekR9&OuY+7rTw6w(1 zyCvzWoYp8{k%d#s;WJ56XsMSki^>36rWRD_yOlbpbh-!T+j|P;UaKZ(1E;?wL70oF zR6g8y?`P`;t96UmmEFj8v1p=oaB1gOTSe89Lm7}LiZA|9)f(|D1H+8(%b)gD>G+o^ zao>c(V>TN+FY}91YNMq19JwAO)ns&)XPQ&X^({%{7hRmt-r3y=h8lX|BLh>G{KfG$1{JxUin+!36)HX^`jOnw-|(--l-Nk2JkvnbiAmvFinHWbb^hD|#pJ#!5z@X`QRp5j-X4Uz_KGIr{tY0%6>J*7g zFVnIl{jato~S57*pJtHCwqdYYz^&LgBoUb8?TW4lnHbJOggG_(Sa{R%*SGLhGIHEoq)-lhC$NIeqm` zl~JN4ikq9Pp#Di|sU3^~i@}&_{;E*xJAT;;dvn_cv3W^-br+}dqj_Qe*WM9QCVP3qlo zyI)V)BOjM?h4d6$v1!1yH-(1QKdsX8Dzx|#<6|R~%;tpj4Yh`zo!(YC2%K%xP z?fte4u{1lAB>_5bgnesS^Z~_kh;;DgTVn;XoGWs-rB#W3=)s~;ndA?%Y>?JFKd8eW zRDxcb;;3xbRi*ucRwjPf5#XogSyI>cTRr?GP#J3=yDu8{-WPaqk6Ln6a89~3x1vz- zUAl%ZN&ihzME^%Z?DC(FB+ECX0X@xFp$*x(#Skzr{o*j}f=#4Xo^S9TB%!D=iW_{A z6)LD~ER5IO^`4-BYhzVa6WPjsBc%Q=;;6Uaz(V4nw;?556rhtXZ!C)XAU=e@c1zs; zN0MK5(zAz9ej~rweO~g8#C6)IF6f=ps$oy^(^QBOMDK#@LS5&yX+DxCzn}wHFYd5DXvGx)r+KJ z|LjS&RDtg@IIr4=HP;~S4NVYZAUKhR`Zi}uu%gYeu!IMuTdDyMKahuo%YHRqMvICi zru74U6DnvD61^GcOR@}+DQc=_CLbN_*NFYf3`V(TNd@n2`c_F-UT5k2EvJ*#u>+iz zvYr`yhYlRUi$p`N0I3GZXwyXV*vmJi*#ujsPh5EyX?Q_th=s23 z*z-@Ar8r-1zb29 z(W|(s6J|^`MnVI`BIZEYPR~>!rU~*OZ^9|P5UF+84eyqphanX26BObtzXv|Z5%}5& z;;eml#o*A^k?dr`?tM^qx0wMVUZR;X5*#v{W8NTK>O#%WBlZwUr2<3~c{rw#Rm zMD6)|_+F!kBwEcyys>bNyeW0UDzUgYslv zbnq{fhRlprT5D=$%;hK16t$2bR9`y)g)pe4R)LIhSCNeJP{FW+CCEX1<;oRys`&BB zSKV5uWl{>XV?S4Wg$tx)uIpE zfzk;bJ?Gl~T2b!Ez02PCcq`HQ=Dw2%)y}vOCJ!gU6sUyvRtUAL#fBSJfHW;O!c%G@ zOZTJ9h&O^9cgaZ35e>(8zGgYH~?#XRkU_TSW>`Qg;|1Dh-Bf~iP^^u z_xmOx!{Emr8e1kez||BCq?%-g*?p?h5a0sf%g%9(OyS#P$h&B^9p9uul;Itbmxl=s z$*M%vCWJQbU%EHp}u|bAl<3GD#idT5e>y zJ89z$pL@AivdZ-0igTg^0$}0I^W!p~cpW3=Pgb+jT~p@v8rO4q#j*is=zKnG8{aRf zv@DiVOouN`V)jk-*XUpR4?TY6O7SJEKX~)ffV9(DNbtJ%PC+*c{K9IGu0Eot z0>zY9&;OAQ9w^+LT0b(PD~_%jM~0^rP#W&}2tc^b?>&8mf*e<;uP9$s z#nJBXm3U4glg9RhcmqR5@Noxg|BKKLW&JT7TO0uehH~o4vAnEB$W5mwhL_18iNM}B zKixHOT0~bA(^nVxSAt&lyeOSUWrb2oV{tHpx8A67>^5>{IH%Mvg zrqTm)`)76Ebf1msr^>`w{9ZtLJ8~J}$>d7E6OBe8)HS52G6$jZrU3CZ zoyK=k&T2w*&C%t$bcPjb(l+awf_Pz$9VKZR9nj|dP~KD29u<1ot*%R$K-&?Gx~4aF z;m~Ha8A8Ub#MkfN=Q0Gry%EbU&!7wjrqx`JsV@;XOJ|S@xWrzxm5M+}eswEO zS>!XVgxV2R;8pFDMqZu~&ghtwzA7h_kF!TQwt;%IW}@3t6sqV=UBN^c!ZFqcxBITh zicZ*`eVfYWbdhU7)sVrgU8@m$;#9CinJ$+!YwQhvBbL5ytzR+d8u3w(^@_W@z#fA9 zYE2bnfppZGqqWw{Yj663w{P&s%B1hC!*csU+XLnvPUgaYi=l!`AtLNkEvsHP93|o%`g16QUUy(@G)9qe^ zqDukTQB0<$$1Mc6_L2dRq}(q{o87TBCVHFJO!BT4vI{Dzd?OIAZw1x*+TfoZ6n+G0 zIP7bH5%9I9^l#2@s%D=5V5Xy0^}dXtG5zF`>xr}o;lEp(uo2IZ%5*HKS3#7`pjXXl zf|nh8*4f55xiw_2ZmK?0b#W|5#$|3TV0EBwX>l$!ky_nSAFtQ0 zw)UimTs7Y*2JIt4i)1G*HL1(c2T zOfJ#|EU@)Zfs-%cDX_O+;9=Qn^Hi%kcH6b-sP9m=)yRq&aODe{Z9c98t~`X-pZcqD zv~s#EE}OledYCv4>>G_GVy@zQ!xm3keVlv+EYr93>nF*t*fE>*KV%7ay__l&*}n^k zJPudW@xV|oT+^FTs2)eBxeV_$w=M4~*(yf8>+6FINxNw>)#Lba)E;CMDyL)4bmsZG zW%c=R%kOaoto9vbR@3ODbRajj+ntC>_<|imd^-?y*Bwt8E40MFi(G+F; znfAkUy@w{32}@Ll{ilxMYuZh_1JKTpC34^%WY3+jO7aK5)Nf^n0936T4A*A#xET$x z*h2|^Hm+^~k0D8@k-Fy|)LRd$-%pZ%AkMi;-_Dz40@*oi-j{yP1}2L@`V9+I5h(M{ zWBz<_EmVedNHxS_5qox*MEaQx_SDb>8kX@44!s9Gj8ELACy8gcADbbxsNgEOL%Yl( z>5@%4LKRgI#w3g67ou2l141{?$JiOhjF_vc_yaF|Vh$kuw>M7e5`Isk=!(c;!B6}T zqBh8r5(hqs3qs;BiK+LgQgKcN*4v13{2A2)m_1e~CW__`d(L3?LJ&zz!#ii6Bz7@z zdeX>H@3`h5jpi_Kt_seYnJzeV$&aoNSG2VEzBsuxWnAR9)r^+qQk- zB9?!_w`%rZ2J?1i|2=T}zp8kL|4_vb=l<>=b&>`}{Ui<()1k(tJcf;iCKgRBAXWRb ze$b8|y1Z%bQE^~mMNHm(4f>oP)c`DJw`7!?@7P>T-{xg;@euI;`T5-tK6aQff{OtE z5a$GAw+wTjtEzNBQ zZN)*7N%@inl1s{5r+}qS11hHegaxBhPK8N+8jf1ST?LxIeI1lUo9KpiQ?k*A8tWkE zEtVkYGe;-KKG(TRL3dnq*wnr>CT39n4|N)Uq1i#0|Gw&HbCj~#h`+{)$l`r1YF>!X z_u(B#OkjOz@;4%NzDn@cSV;UOP}?1%Xq&t_tO$CuG-s^P8iW{8Q>^Oy)D*Pqz;Scx z(wMbxuH|g#k6IK`ne?u8%2ge@n{b=%7jxvk)dexIqno7;18B>8{94f_CSs94EXCo9 z;gHFxH|E0|;VZx$lvd8$?l>3gX`*)P&U~uL6b!>rQA|z=EHm`hFO-dwsQo3>o|qJB z5+xLN!E23Yqr6_02VSS{52s5FSW;ldZK zEWa`ay=TCv%OkW4M&gg?=bkk4K{+sy)qaTClF?@dGHdD68%>*$kfm1eidY$H$Tzqs z#A?-^>B0uTr;YA{$5G!r`G=gm!SglAH0K%qpQlZ0E8Q~9m&d5bkFWTK|9{`+fBOPj z`JgPL`PGp5m|CsugD2I8)sCh_=UG|8BrRdeWDwy)OH2d!qCT zy|YAswjvIdTsyKbdy0lgm|0n3+KA(W!<(Zb>4q8VcB3${8Y!Erqhj1>Cc%mAQV$sp z#OKov>@l@o8(%BM?<&Koq@{F?6Fw9s7-wrE)-A*W^!S1fw<$;OsZ;gM#d#V?X#T&+m2{Ar&lBm%RYTA%NN35 zE^t_R84m<HbSO5A+CCUU6M z;g_NoN*8vb#}nS`fx3Iy?$kmD+HkkuOwL*607?l31K!qaw8xunHe+&^QK&5XwHZAZ85LX$o;WV`=P`Mc`@+nTS;ctmiftURRYt8r?F zpVT*2Q#eg!JwjI18OOnRH=W~g0P&>O-%c&ND8LJb%TmLHw<=fnZ^m_Zz5evMt9Im{=ry((;Qx&I&s9#e-i)I)&4dXuV?# z?r*U4Wi#xGHTjAkxdi;`KparFElQwU35s>psDbG-!VN(E%0HlND;4BZc!m1X?DPZy zFc?$)aO6sAgmeT=O@B<@9Mc->-OZrsSlFVUnb&nUwC4zRF}^X4sB$on`Mn<9}@58noYB`og3ijN1>MZS7n6 zA9T1K`9=a=@j?`v{tSA45%SZsnA}@AK z;YRFQaAy(LG9;WdCSJWT7_{ih2z9tN7PssDB7YApi_ikpjZf}U1?pxS_;FmaU4u9T znkBWdRWT%Pj^M07q$3kDzkjGwg3a)rsr=h74BF}Gq#FFZ;G{!h&Sixqw5wqy^$d=M zuie5q66rjT<2XgLv*9$w7LR;bE`b^;C%<3(JWr`CWAAZJa);L=G+mJ7y@_RP9#*zG z6#4}T#0T}r5bOt+xFdACF(KnU9Eyy&(Hwq1g=2~jShwjhV#Awm-W4r=K}ZN1`CYUs z%M0xjHfbN(kwyFz0Aq$t_^rdDPJpig_0L1VyVJ{NsJbeM=!M!;#uSv5=sf&U%(X9T z+_jW%;x^?|JBaJEz&}skfm>nljjt0|?Th*RH`Y^A(a6uX{1KhNE0c|93W zCd8~Ni$b-?1p=e1AwvGG#4zyP8DSycXe&;Y`6AM?X8%b@|6c;-t)b5^`~A!v1LqUn zcKZ6?vkDk$DQXptCFWO>*F~1l0XEwLj|Or!BPQS6{hhC#N%|VwO16yu^<6svEUT z$NNAaI~Dqwty$`0>>zsT6|_NxU#={mL;XKVaet~9%<6&U2Q_np8^MD2wno$61+E4< zh5EFpgb6jvVo}v5e`iRb zRv+$9ZH}4oNbM79>`URy)daR+^glsu=5=4Agn5iiM-_ZN_j&w) z;+}1jB#ku-#g5s6rG&D@(w>5gdl?eDOVe;~KU*%c6o|*5oXT0_3|7n>|KFp%%2WSGa9;68&W$Z zeoT(4$UmH`XycIoo&vV9Bm4Dgi?K$<8i8p9sv@(I2XE$dY zk9%{ef*b#|`ymorwg}%w+vYP=f6XRhfb#0gJy{lRAHoaJ(k!7~J3u?_7hba2!at^r zD;A!5Lo$RQ8d{8rlG8(7%>6jMo6^sdpg2KEUj#AtmSh%7k;#a+*Xe}ps50%0L^V-`Lu}j`oFCfU#R&8 zm%ccmPN;u(2GF$o$8@AhT}NeI9r14rQ%WTzxe_j=90My^xI?(`F&fI6psdW^H}F$( zt4#G2a3yOQd@Xs&wcPpi&U>N@)HHUMpOdowswEu>jKi2A6AK6(6`Oq9Eo+;FHv*r3 zA2@zNr@@Fbk>!^XhFGC5Ysr#HP1HUIqX4wN_KQ_E47X`ZChA(L@{0(6Q(@gz3hZ4U zF{7LM_D#3Q=S8iH*5i;PnK)R@33z$YnQLkdx8i07C5kvSbmglTP--Gbzg9c1+Zjx zAe`l_Yd-L;uOgP3jv+)#e5uc};Q3t9$E#cNapVSk4NtnymUP;8pI@=Rqc;Enk#GA4 zYY4qAQT5;BRSaotDJEt`6i2!}i-x_)MLWQf90!W;h(8vS|8Q#%bHu35uXTTKg7XJ zw>R;8xDzipFwGY2d;n^k)K0MvNBQ4tQ;RS{Q?2H!xGSDu*A2zErEw=15%hXj}Z8i6s5 zp?2=G(#j#|pVNFA;en-KbkhBGW7c98YO&9!qUVS^o>_rYl_HkP%A}KFpiKoWi{BRf z)5(kIOYP~YKJe2NkJ(#0Iv6jDBFKHv*%~DEt#YrgO=9!VN6Tf>24vvv+M(UN!-$K2 zX#V59(H1AA=S{U-C*LKQy^@Cy263#c3nZl+fo>kib62VioHEoU86#|S^1y@fx-%#NN?s2R zF=T+Y9|vJf(bIs+FZ`VI1TNn^o(GO?D>7p<^s6~4E{tbuUnSxbW}7eI!EMp+H^))# zw-BN|UbAsS_a~n0OSNlb-~Y0q8bFj9TU3{dh3tils<0!Q{T0h1*a<@>>FRCfe zA@J|dC}XtI|D7zR&#Wx)`|A=vi1_c6@mG6LHgmK!GWj20|Ff?^F)Y8SE%OGfwRXAn z;6^hY%ZyFC4m21Ts#(QSQQ})M}bD1TaQbIy!Bt$A==`K_@>K5Bf z;;fIt-J z;GjttfDsT%gAO zZ66qZzXs0@n{O8i!X8rFYltr2S~&2!6}P)=C!DjJ?0^^R%jM{8Uipm$+81Yf_(m6Z z8hDeNVF%I@5Sv4vty;hP_e{>m6D4EFM^+((U0&_L4EXr>!*!wFsy znrH743cz_w#pyr?od;U}A+pBM6fj;JwrpcGOB!yX8jt(N*=~+EFAdmO4nuMnE-L$| zkj|yll!z)QK7r6v)E&TiQd-&Sfq|P#sy&c}wYA@ysP)%%^ule5QVAg=3~5`65Q`MN z2TLGmm7hMaTCR%Gr^jsOh$D|>1aHrX!+VTMIOHPBK%e5_erW0$-&-vpkJH;+WFjAr ztI|SSjw3E?S83*hxNO$ir2N`e2CsoB1@MUK$npJR+Q`j84fB!TA)q@~Xc=$$vE8R6 zAl#A4O%)C*=W&_AZFHOyTUh&X+{COx1Zpj3^*UO7qStX+p_wCLrxvVNBkF*)zPksK zxwet0i^touuAoiqyg-%ex>rl}VX!S3|MM0QA(W+bqqIR;TZdGUuPjwDqO9nI0-=iA z`#^2qD}nkhIYi;u5lB$+4DDCGQyH-wr{RP^4%Xa=?IN?$$5)cc#f(+dH3f}&q09#<gtK|*Gl&Ek?KF@x(tZY4=hrp56FKj z|1dlY_8F*sS+8Oo>*(msw=6Xxj#RZN{y@^vBE!KEK7IIu0qIg=F{EE7`Z61Fh6S$g zJcimzH6k)U8qIWxU+7@@J3vfKX4F?~#Z2TI^pQ5mBrCj~Qf6(bOqtH36Z7*p>o~H!fA)ZoC_S1llvCG_? z--^s6<6v_nY#`N3E5%|K2Htveu0_?|e0-)Gqay z;r1m(zX$5sl&~>Aev^%4owq{o;utP%s^C7#sUNj*?9rXgAf*#@rH`S*hR6}mSaOUa z(4b7}McVPlD8tff)140c#7p@ES6Eb<1m)e2{-+!f zQ~X(3cl^4E94|_TXOIw1eW_$q2{4_R0DM=XAt%UY6AJrXDQd(}kyf;8jXB=knxX)r zYKMW{j8~yckt`EswbFdDT@??a2!4ap!(SEjY==Cf&Gfm08MK9m(hi4q!Su#mS@k*< zVYy;|mm2T!eQ&FnYPZ6&F|E$d+CMbJ z+gl(_{A1PW5-~M}HP`jlBsi1=|bbuMk%Y=B8_#r4KHgSC+ zDl}Xok1*!T0ZtRN;Z4)9>vPPqcUc%@G1nVW@p}-to>yXW(*jke=nb{HGh+9}pI5NH z6kb1_Jq8W{t@j*GML4*A#HJ}DQ;Ltp2lXs;9I4||jg|=0V%VD7zi2r9QZ)VXH)p~g zQRAmf5)K>*0Qm#Kp(vjC6gMC+rMC((lp%T?hoE!1*zZ>Mttaz5|nMsOm2$z{wq4X`V~oyL^E1IL3Ta%g2sG|EF3 z$2Hd)xrNL507@A;ZMkvND!h^V7>FPHrMCW17i|2KA&;_&!DQ_c#0G^MBpuaDRpjOn*&(FTXrT z{>?(^{~qW6F*N!wYC!$X1JwiV)3+h>%kJx&nUp81rtkoXmZm!0k}zR0ov6w@7}OjD zojWs6aKLKz#RM(sigtx&Mbm?l4LHH`u*70>h@8rl()10k|8=agfQNhiDy_`uYQxi8 z_SMtY^v~_|&-bT+9?-AI&V@Pz3pQUV3CJmTqS&M0G-1GRP2mWv6;29M@}N7%VBHx< zB_MVywlw$BZe^S^c1|T4(e&9hk||qhsSeM9^&A(yY49mwD*;;*H_q!X6>%n^}+70F?@C(Vx#LY zO&t*2?XH78Bx_KF$7^9c1lx@hW@ZhFgy}NL5l~^I0l00^2j?6?fH&Zx%iko(h8I{+ z*+zNN3z(us=zm30HI##lpP@E+`jzHQQ5H?7$LKuRm8%qX^6V#NJ8Bwz3i{l{D)M?} zJo4?L+5L7ikzd8HNdee>CUITdlJXpC0esf(@w{RX5_i2qBc5WkRCm3SdvC{t7U3uB z*)-DV+Wy$?rYHC~bJ70E(W0e3$I>iTHBHS>(`@=BT%uLh>H?Dq32}ukR%IFj7dRN5 zb8btJ3ap6H;bpg3O`f?KOFAtpSzsGy`F(g7qh(+e-N5|0DfdDEZ?_G{XTS=nHeL_P zT-0f;S;m|g{@qF0fe=E;H$_b@q+2Bi%laxZ%)R}v@j^P|60yKZEF}?tWg`1bx6bP1 zG0aXqPy^~`18&ycyYlYB+!Q)X2M7-@mWH=ae82(j9ldAXalZG8$;eRm{lq|QmDa1P-V*Lz=-Zr(6>2X^l&b;104?@s z>8=9AR$ngsJGj3YlNTAq#QcEoY_o3S5ULQx;kn>I2gKIE+k{O=qxcZ>jVhl=LTC@w zxjhgwxZ5s;R9IJj4Ot!j4#Ga4+!z*uzqbHna7^T-Q`r9D=QJS$q>=G!pxuq-#n{Wp zqc#02_wr1hEEk16L5x_l>w5Fpme-g*j|0Tsqixp^R1&QO!ln%2WCUvShMA@G?-EYs zb7n}5?(ArfMm=3a5xRFL1wT}O?)y`TDs%Q%uW>yK&P~@YEagp!QKoi?g|84Odn4CjFJ(hm0rUWdbpJnC7lR!Hk2dfCX4#>!U@2Qb+%MgO6u851!Mi-BczRjhF zoa6)cDGdkLtp%z?7a_~kG<5}il$&+n4Gi#XH(9)D`C?9NGvisjw;dZm0|(#u(9Vw) zvbMDd{1#uEoh$YB+_e;531@p*&s+I&p1zfO%Bzq>S4uG)Kg*Cln}PC}IDd z+5-nq1y*uHm|0?uiZprM1y0;HgV=_WWzd)TiuL6EmND~5uPr@=& zTxNy@^-C6~KlMwU(|eeC z%$K&2@E#h6?Tr$en(y$phT8aQF4?d1S1P8UR?Y2O%jLb*eH_2=5yDJgP$vN~(1_eO zZPzD>SK^u#ujTml&eaEO?HP37kI|mw|q}py{C%WJIx&6wH1vh zAax1GKhQw>vh2b!rY9gUl}lPrdLxc&iRZBEB6`Tdwl%0iOCyDC&{mW%2)dsFX5qYA z^=BP~e<@?YqAe#{mhrTb>E7vYB5#`j2rm-o-$*Q3=cbI?+EA(ye#L1K_;r3k1Ne2| z-6~|m2iy6`_V83$7wn1~PDjZWuoncvW+dD*C2(Ea>5<)0J90gr3S&hdgDH$z?jAE2 z27qP7#IM0oq4W!Vj~|Q6l&SwMyfHidh1Vs`(piqlV0sW-02jlTdU;&l27VqFuV+s6 zv@8UG3c&QBdSH1Lj#3ND;Q~9>Kh1_vrRMgnqgu;mit5K8skZn;_;0H7>o5#Z<@sVa z|K~^e_4Fl|U~q77bTM(T{{k?sM)oFN44!sh4=y$gM)s}@|NZuV#%ijuS6|G05oy1^ zh&1Z|hqr~kqBZ~PP*t=0l2)Pm*-O@sy5}R(u4xl0h+iQ zXj^LC8gM)~qTW$I_BjO3RMV_1-ose_QUYDrZG`8qncZzEIzHduP8q%t z?E0Wx{jtX;Ni({m%G6?iTJcTk&x-KcP{>aj2IV!qYYPMiH$(f-RL$RooznetEE9w8 zr20h-;a4>3s@E3m*nn4n-1J`iBaUduwp4f64{+!K9o7PN(|leP+%gHyLQsyI+Pma$ zXz{Et`(gwExBV+@uIrA?4^6!dS$2NrU;z|yD{SWgR7vmp%S&ZOU(%O=v$Z)#N}Z;h z8c%x>@4lQ~!TGx4D-ZUBCt4uPA=oSVom!yZu|3k~z24SIU{3aD z1nj&c8W%ida3kp?%r)~dP z)kpFK{#Oc=WZW$fVDzSkY}Ge?m z13RRRz9yoI`Jw=^hT{&IS+k0PSU;w%sS za6jya<$gmv1$c-bt#)iEzub{jqiN0TDb@w-?P~vbQK9#6%uIfECw6G|(d~gd6jKHw zsYl#D_wKTLybz3GMsP@laMklDRlh@|_D5k+6{GAkNP;n6O!Fl%ToD%?pNNrzC!t8H zDxm^MsugCoqqj6~>?@V}$MA#Lu#JAM;LyxQvx#f&0S(PaD$CfH)Ps}9DTjU*`30m% zxm>fn!uksq%m0N)E^u+UXBF85%buP&WzIJs>zs;idyMAFpxnmXBXDrtt6>G7Do4{N zzTpVy5xqr3bG{LwjXUER+_14!;Pj35dvuyQ5PglsGu-*r4JsA^`NTBH-w~VGQ1OxI#Lw9pJ zJf>bY?lvY3KHqOBenE3e=?)EmRT~DRN_6rbl1+~n1QwGf2^zJb(L4+HStD2VjbdLd zq46r!#*0$qkk1Clf$K=Qnq;zd?+^wiRj2;#SFKPJPpO zfMZGJ(2X^uGn4bM4N%>3cX!qnoA)rAYOtH1v`R_6V}0r%7IKcPWM_~uozriUJ!z+j z(Tk61nO;t{M!4w+G4o^rnN{@;0!eR(RL&!D&~z@-rkAwPqe)8;X>gm|n86Lo9T-S! zv5Cti@!F(6vhDbD+I*lcr_gZ!vGHVMjK#AiksI!ZjVk!agh z!a65wkuQi9+*|pCrH>Bdv1qDTg*v86g$Qhz{wpfgwt9Z+iE_9Ee0`#AB-2%Y9W+lf@Nb(|jG2K1pRIFbRmxY4jo)pQ3ssH^Xod&hk+Rhfc? z0xq?$rnqC8r{OD&F*#6C)g))=Nd6CH?--rwmPHF!B^BGYZQHh8vCRr9wr$(CZQHi( z)P2wB)A#%O{OP{`Gcq!s?7j9}YfVf()`THMl&yRx(JyF~rRzYLg(8neEyd|rbkr87sh`H#-kJup zTwl@(31iZAnzglM^HclT{XoCs?5%RGVSSQ=XN@>&E$>v{IAwRkKiWdj6B&LntT+16H%2}b;swB6&@eHS^9BWEyCw811CzE{Ag>lLffaj5A)kB z4%{NJ5%EEo+CJD@WE3ZAeMWAt(6NNX`>E7A+C*fZ^URtf3ZxGpngqVC8IW%#`~E`} z>OAM9wL{bTFaZ^CSoL|26%Yn8S^aIebwzgPEK4e5COnp5>djO7_8O_q?F>}9(``Z( z(SRQhtcVt;`Z*a)&2o>0xVjx1v1872i)4|M$|U@lP%lh{_OrCF-A z0NjAkaS4Cfz2IvK;dw3X=#Y}_m< z3H2>{-a8_nqfblhMDqg!$yYz9lf74dvL@YFtI1@hAJmZS1TX)1OX#7t!!zXTVufI< z>X1a}`!~3gQ^&Kn-~@j$^&UfXbzuyt5(5mrnd`OenzLXw_yD`K=H! z3U+K&^SjO~tA|(@pI12^WrDq2yBW?Mc*?~q<~S-6ro-eDZuU3sD}T6@;)5doQ}aIM z;S&uHsD$wV0nh(}kc0p!8UIE|T8{I7Z5k_IP!CPOozp=PgTrlwt<8O7n19ZJ3gUpT z1ng{yDkKOiCuvI+O)BBN&)flz;hi{|N-`>$yrl$xrGELtw#Qk386riCwR@MuVAwTtmK>MmE(d{;mTDX&^rSDP%79?FZODU~RJ|iw z0;5M)G^YT}rqj?dN@mUoQqMIdjegq~lU$i&$5R*xJ z9sD68DS-)4-96vJ!NX7R8fXIUiRVLNGe}1WD6M|r!I3%}7(-O80$URHajxZ3 zEkQab)SrCnkpxk%r>T(iNt7JAdk^6Y&XBIT#WLUs4O$b$6J2>{liDNVJd2Jt5^rQI z$oYZ6o0IuF$lJUR`&GK)=u7wnK3O6VF1KS~$MC5mV1iS6`WsIyx0Zr?5G=i?Pwe8h z{bY29uq3B&E|H>zh$K#Ipilv11McQ9`uPE`>;cp}`>G9`_N59^>3!$jZ7#e^|=;;|v+0oYtRfL-#cu`flY8{dt*9 ze)&@6+ZJ=M4XyMki1OOgvoP84 zuMe#;jdhKZPs#}>*N{dQpb!OS?}fXXipAX1U+ZhTGDDT@xy4ver1zFN9l_fpu8JaH zoGKf`EnyH5P|!=LF&2(XB9MILU`2-IDFX>%=BRM$6F1qMH!*`mDD@Y-CJe#9P~=uL zdpi7zDYNtya;k%1!5^|c#_e58HmabTS`Vdl>I*sxD}Q8}+bVdSvGpmA-i*XlS+1l5 z8R+0s`1eprQbh#yF^vONE?6z!_+_H>CuTuo_fZ$f1!?Qiv2P`j>Xh1IY3{Hm;T0l2 z#=^>dbHgWW*7E;o*qi!QAaW-v0W}wTfjjVg@`5;uY@QRF<&M-gqFA16 zhoL48r9If_|IPb^TJ)`4ed>!}2gIJ?Fvvi26ne9K-@LGCsM(9~ zE>G-Bh>d5Tv!{TZa6_@=kq^1nrV}Oj9}KpWgz{x9k?wzX5yTvAMf(66);3_m@ZY3c zf6XRDY@E!U{{4E!N!bES~l~p)|%$T=_0spS{2M=nt{mJbzlFV?6u znx^)wu5>9=wna*;L=#lwsYi@Qq^Vj)E`NHh5~YQ{9x`6zj*<7TPM{kdx27;A9G%di zHDXWEn7lL3Sn@20^)Y`4)Ic+g0@Prm=#o&?z}j4GsS0~zKq8$q zGQMlSYoj3g;gEMOcvHQlHl5iTj_=`N_-Om|)YVlD5!`o_g9rO)YJ=;3GV^`2wf-;Z zg*#SH|4VRC@XtoV!1=k1SW+^XE)={#8XmDUL1ByA=AKnfQ>3LN^@w~GY$)aIF2kP#{#IP z=QZmbi_VvjX~3x0?_d!Mie1z2#WFek8lp9uI8?``(*`9BRe$d1%dU;cV2MZ#NNSa(;g$H%pb!&rP_VW_cklvVA00;Li)l2F{rq8m*g&MeV<^I8 z*_!2ql4qlJr01-s?~|KC55+-by+x}|R?bAC9+($Tss(w~?G-|$LA%8|KO8H)bDki_ zp2@xocw(5?{}lPefDP*5^t(w9gVo9n2j7H5{Wj-~h(39tfIV|lP7``bAd!~f7LNSnnGR0~a~s`Eh1c zQ~)NmtUUKmHO)u8GG#^5p{2Z&pOb9NdQf@*Q%j2_PrKjbckRZu>k=cW(Rznc!yvBf z(Q(n7&GYX#OpYM8Hc|{NBjW@ZpUz%ZJu*aam?rjh2=y$J2cEOP7}Y18JR4>Y9^Jq( zZUDF}}30ogeSzvMkv@g#Yvx(@R9q`IiOxUtv31V_uR z#(V9!55^}4jtvK&(8V;)P{!Wl!sX+}oP`U_<47rG9PcnStAu1ktBG6|gE90y*p%@o z$LLm7tpu<*Uz%ZD4ZvJ>X+1MkdA<#i(My)@#G^y8@dzh?8%xzido0Sc=%ouX`QwAH z`)d&RJrE;%ZoH(a)NF~w^Noi!KPBes44JrhgyQP;+G$spvc8vj-8Q9_4XTmEvCZ<< zhj8s_jfKo(M!VKf7+N|ZtjF2r{erM2e5p>V?L4xHgZ0O5oU4Sbn-?*8ic3W9{s>Gr zzq|XPkxGWtxUasrua5p4jT9@!$sIMi&#d6$&^&^;Ci38%Si29|VA&FXwW;EWKlS3@ zP)6L~pOzVr6p8p<*g0P|&6T!Ada-2g@z@Xs$PzByG%oo^+?170xCK^u7X&q=lrf9VX#@iw31WNaxnwh~szj}gE z!gdM_s_Lm3XT#pXZwnA3H%P9Px`<`81#Z-Dj_|Pg*^KNLR#&I>ej;;`8oIsQ9MXCH zL+t=xWFGM?c{3sXBnzRk1od@tYgpD6Ln2oC;Qe!hcHg)Bw*_xB+NV(T%V}-mr8(&n z25LMv(wYei^^Iz#agX*I59u05LQRh|TFV`U_P~70fZj;;zD7syc3bm{|68^j?4Kjs zvp+k5XM-&xYi}H$Ssq&kt&HMz7hizsVj%+>>AIbGA*r&cIzC>-?COzTZFs>w$=09b zWQ8&nip38|S_xBDTCdK>(_6?}+R9j5fBn;O=ApClVfRG!>PlZ0 zuQW<6BYcK`gh2@Ah2p*L;2ColR|ZBPzB*jB7Ega}9%rm?d;k6bqK_;jRwRGU!GjDQ z#xCOE4mBhVMIVz`<37C50IKgumD>3QMA!1b=qrhRZ%-{Af}U3@DPD~iB9wd5XGX5o zREQA?>17Gwp(pqte}Xd?aDJ8*u+m{-=91VHxCd*lI>G66uC)y9oIejR6|=4_=Mt_b zeZbK-?|2SF@X)iALf5NKl^JB#x=b@~;A*3ZSVKE>jE{RF6G3mPqoAH8hPrLCuw{p3 z3LHmW{YJ%#lMONEqFpW_saNXZH=}I(^4KfLP%`VbkLSC@yWCX!RT=03ee19w4$JhgzIG(Yz9R#9i^&>Ch+ccd=y+_WHnE}JBMX9Jx zpYn{q4&|>a%8_}#w7hICKlo=6jSwxzrHE#eOcn{yQm?RPb2cHWU!o08kf-TH?fW5u z$nybMJ@m$PRDC)dz^-n1aNPWf2^Eovq+LV{GUzT-^aST++(4#Q@pRK5^?jQa2nLb5 zy_gT`uRm1_(pf|*?ocWshTYL8!d&W2LRnlvsLpFoOmEexwtAEb4TYy-b`C=XA4Z0s z2&L^2?5SsWlIghl$Gm+M@Je3j+#+r`h>wuffc0#tZ|q9mZ_a!A_sQLYm&I{hh8QvE z_h2~hmk18D7XxdN6&y;gYJ?KxUXrL4@0%O5Lpu3HI-L9lAl&C9AQQHC0y%kvwvY;p zs|U)`k!5GzQD&X8(_LH}y>iQ0y2~ZRSRT>-bEHw7R{OdPs1Bll>hQlEeSqco-$!3= zTylUPzG7>V6f?j51q|2ovbXm>EEz-qJUr)s7Xu7i#)OzjS5Vh6h(+wj60%W`f=x*UDcgz!O+(HE@yzJ5RiL!?0v&CuSkkM#jV z7n05(+kbu^o@Fk8iRHI%B>!t^_{(Vf@9(3m1MoXQ=9x!LqAmY99t>ph-FFTM>IKA4 z1)pG+S)82Utz}bo+@O8_!batHIA4!xq~Gj-7#<+cl55@ot0XaaE47v9dBgE|YgMni z`}12(01b|sJy{rF*JPrZh5;jiQ!jpcBB(ixeROC~0EraNqdr#~(T;g#-ZBkes@Y2* zMD1bJSvyg8m^7ii!(n3{naia|h1xotvzn*4Yr|jVJnZZTEyT{@!9S~&*Msp^7d7r` zk;wi0ROy*2#jCG%2t4k1(7GG(BRFcBKAwbADWuF6YPmWQc)T%s(iLUxrCMejWy*{S9R>YLCq84)HtQn37%vs zG|lwhS`4+6>K00|+?O2`T3e{wm)G3j#5CnfSh~QYL$k@MYS-5{SUr}w91|Bqy}!+O zSba8z;pT@NMv|+r;1eA|hj6DFME96=@yU%~p7_*b8FIYD1X)HL)j_8D3VlteLQtuc zvu|$quS>c+u?^B?>0)`5CVj9dyHZP9@ArvE5tCjvHLg0Zf# zQkw^Z{Pl(|LvKxHd2iMA2-)Eq(E{w?sKTa*?|^g;`JdvhSxqM1C>|dhj|*U}heM9T zzk8^Jr+8jL&z#xwbnz4WDj`wOZTD5>d}NK$_8$~lB(uZm1s!0`(c*+kmr^v_dk!k% za0=ojsNw-+r4=y{EW-854A7uNm2cX^Fq#;m^lRW#@SMc6r4MKUX|rv2Llh?b4A6@T zFrcmRaYlQ!Pujcp+WnN?9#vhS%ac#qvG>~f11wK)RqFods5WdZTS7`D+Gk9Hd<`I(vE#k}kwn#Qe~dKQPV5m#QLWI#}S#4c_9Mca-CC z3i?O^>{{4+poh2CzUVTqBqcLAUE**%-m|v4rq?%{sa`kvx<6resJTIk8It_2f4#RFv2Cc<{gu4k{y`3EY}LD5ZB6@NVuy_ zP@bKyO9Liab`u<L}DY35m0ton)mTG?~5~F{Md`BWjj6nX`k$7L%+wEjGw_s|!kTGKqa~ zSBkSU+pHPXY3d?gRdg9aM2#>wS<1S~WQoD;e<97s$80hAwC53Lsa4hNR~gD95<_2g zS~6L=NJpWP&t}~ev-R_(ZKayC+8XCqP868A5J|$?cDJWy_cM?FVH3H1AOv1BJKTB_ z9^I`?_$Z)~EIMYQ&c*6Fjlo;h@rUT|#$8cFM0W2w?7K2g*{&<_0videH9(*0%t;Di z*;m#Pib(UstK1b3%0NUhr7s{1|Bm8M%{w4Q*|lTpb)q^uO$ZoQ=b>#Px?8kj*HbIZ zRi4|FYN9sr-EF`p(l3<%+FZh3*PQJLqo3G=lnFROZY()-NJmM9I#;0LtSXwPY#-9q zNzgA-A5ua=4QD)2-M0|Tn)_a;z$hBt_wNns*ixyqgx_i@V@rbc7mNiy^GO;k%KYmHrTz7pnK9QTg^;s-X2noVKi~I&T*dh%ibBS`YWwwQO z`XydWlo`s*Vv+*}T#1$qsZD7rrupDMH`gray3pmGL{$CjZpz9NdCP$+%*tmFZr7I5_8S*C@8(pWqx{OnWqz?0t@N zVtRRwzCmL>oKZ5+b0wBA!y4J@{Sul%K)4go-#9Xf7k#Hzs32t?fe zY^Nz0$p=e|XYMZOEqJ2H>e})zOuSi^Gnp!da7pI|hI3(_a(?RBfJLNQ8&D6MPpJQd z5@6}KDjEPNAqLnU{crUWU=#XptQG$*wTn9c4Ef`5TeG13!t;a6JnW+mif2aM7m#K#-8V4bP?Ki ziPmK*dD?Bdc5cDTV%WH7gN5^pCAb}OxwMNX(452i;eOo6-Y>oB@;YqOKKjX1e`@FZ zL_Kew(nT{RWJt~31RSKedAAmH>pS^@pGAi#{tczqLPsOhPQ_Kuc?j8;tB1d92W4~h}A=R{EwevVDD;k2chd)W%~N4lSy5ffEm zCI)2<5fU=X(#*-;KqDVl~cr4p?jVBE_?) z+M-osNnI&g5nBzv92rd8p9gnB1GI-TLIX2JlfsC3S51`9UA-@^n$cW$1cHSdz zl3NOKZyb4Ghj<|wL@qO89nk~9l$nXRHsGlj0+j$dU*y~&1@ezSFry) zqSw=6eQlc;TI(AoX#{~#^P6@c|Y`~9t z^6$hiwFy9jRXS@^BX~D|QpkzpUSi?C$oDyP^g+Rhq^3BYFE)<3r#U*i|9pIa`~2ut>Qc85 z&)}!ZNbrZoq?_OGJkY1T@Q?Lx}Pj}(z z=ta$oV7^!nYs9*6oobs$$%mzlo5{AB{dLLrN4pmAJY|~6s4cQuZdlRJKws&!<#`&*k>xPB21~N!X z6C~=b;N{3$6n{Ye^IEuNEB&+rRBai6nCZVIE&c0S{Qtzsm8$DX3ns{aj5WXmz5#(; zw{1Q930E{}&Z<@-JC`fd0;#UYOkRQ3kER)+Tnw(AdFZ{*Eq6H&VTcq@t*~XB;w_$X zNT~lDrR9FmpXS(p&b)u0y5w5*{`x$}@gd+&uEAqltAS%njbL~U8>K~wmr?d6=hzD##%vxJk_(JB&k?Bc>*GC8p2G0Wx9su zdoUKJ&O@U(pRQ_Wo=?_A$D6#0^dcqsewLv+2LiPb!0+oa zi6*Kl^iSC+3pqAZ<&R&IvMMS|j}p$%J7C%Nb!Y9Gp@Pn9$zvq8G4;x) zhIXJ{W@ip8Jg5HjGi9VT6z{2}VP)o-U7WF*nmos3(K2D$FHbt>NVJp2ULCj$&(*!| z3(Ii5n3GJG72(daGSc;jU8@i(H#Glr{?6E$;oL6JzghN6=Fj+JIx4;=(!vJ_CV3Q2 z0dFk8*%Z$L{w_=Om>CSH<&1n)HsrS($~1kV!Xk}3_dEE>Pof-!O=?H4wtie4D2{lm z3qxU%d~R_OFNQgV&zd$S1*Z!!UzW+ZdWA8q7qePxq)AnaN1Eu41!S3AuLs{^LIJ@D zQ$(*vL+&I`+4#|8<_ym)$Yo|*PhR+{=wMI!gRp7izCs1D2ja>hb3ObnrcX>kO}9Yw zcv8|^rw^1gy_X_9#7i-zS=fQuKvt*x_%E`DJh);(d7xf%PhstzVRj^4JKqY!0j)U< zKW<k4>Zijsv0xFiip=DQr?NMZ2UL1KuT+w)95MIonyr_+K!w+LeLaB2yWRW2OM$x10E-A+8}zzW|lN(7!D6sIAUO|Iay>4Yd5adQYJo}(j~{|IS$SoA9DFT zR^@|lel?=!KMPsiUNC4yb0r%~mLXWQz!KlBdCm&W^wupEY!T1YaTfMjx`tl3kc^a4 zps{wm-bmJxXX8y|yH~JAHX7+>+ah?ktYKWZ%%0(-=L8|)3U+el`Ou3*)){4yEWcph zU%8tCXt!VnNvu5lZ6saYjU7Q6sNPXKnRxKzv7SC-Dxe!xl3jVX74F@Mis0ZAwWN%*iIjP#&!2fZk<4uag}shEfM z--T|$jchDOwT!L7UG7yBtf;WPKlJ|3vVHv{t6vja=OfL250$E!#LRrey$c2XJMz zz==oD_1vd;o->YrO>uO3e|^2d{6wN-p2&*{h;l{|K?wo{0fDhkFsh;M412(pv=#CX z6{BQT;a063%xR#uAB(BV($J%x2Q(zDWI)N;9R?|uj?)nRn?1H1zU-zm8~eNZM~&k; zwUh94m@Gi<=WN(PuVv$zaF-^V5KonD$Kqz&O&w_{Eq5DmlzR&>7-K5ywrO44kk;A3 z)^h3_ylmYpqY!-QsAxyuizABqK~5Ef#4bb~lEeO-ClW5G?yM81<|=j|zSW#w#^a$- zGLHR}))DT{xgje))L?yNO1-p;k#L4MGdNBGXgBaN>GdyPFMC|JS{+y&{j=DN;yD@B z7Z{?Eh4eX5F)s=RzJFn9weTkYkaH@CowLW|z=4_@Co0}6jWTtUbxd`afiB%O;a!@> z*3!-uO}f63|8Xe}(?8BIp2@zYi#3b8T)ctz*{GT?Fjl0Sq0mp+nWr)1cS10DAb9e9 z=%9fxJ<7`O%3SY3CvP5AgEYU8cIBCzMoKS|8k|2j4(s5wlXzo*rVhF}_8izssc0gT zBGH?WH7q7KZ4jJbef*3_Ty8A>z}2of`Z2L?-zXAlAX<_SzTL-RK_o9c^%;e;97j8z zb=6n3%E``4Jh@O2ULgqFK{%EyROF8MQ4$WI+4za^oJV1FYLf_`@=-a&QV_-3Ak9sc z%$#t=mVg(Xh&?!lw6sQ|4&_w=rZBno4->U}cNJwp0NW}90J=H;2Ua0KF0Bkuh7n8H z*f~21I-8jM+fFT0dDR9$zv7v1agJ{(bTSP7RyeuDsk5R_{<5MS2Ehp~z{o3an1TpG&+Yn2(gb+++`Mgvv$7RPOUB36S8?$9|dnF4krnIg#4E>v1_bmo+mkc^$z9HA9( zr7}%o?o>mWDk#zY(8?1vt}^CKWZKN>)Z0w5mazNzmT5`4)q`FVYRb2Soo%AHpvMy6 zH%8Ob&K(r5w9Q3$oE5<1i5nziTs1NiY9>1SlXNTXb{Q&UiXfAeRO#T(EkYeW7h?1s z%}2}LQx96RpW&I^`+++$bh>`D<)l?QW6^+g- zB?+_R6D{0J*+8Kl=>lT7LT1?QXOA6YFW*ZbO>gzwZ`o8d?YLM^JrBd4R)T3_P65$x zr;F5ghp3WFMk!pTpU%yIWtR+2DP#742GM`aybHScqHzzMsn1Q$9w7lDW~bcCAg$o{ z$BiYZ*ZVH5sdWmzGM?)+OQ6!D4^U`tE^~+AKZ<^Lbf4#Ay`dw!!?OrF%^}Qc;DkNdpSKx&=Lu4A>6|&>? zh%T8K_Uf065mjRP}hS|+2-e3ZC&6Cz^{-aYIUJIcv)DTM|PR|>r(2uYwKbZb1Ctlct?)3qLg_wdU zWE#}K{hOuuvgEsN=;uEN+)E(6jDYv!7BJ*y`+vQdqUKhA&u$8pbZqD8k$G(9gIs(Q ztpn~lYx~xmh|)=Kf!2V53nUhQoH5^?6{$iH%O)1kf1!v&!^3&{!+($sG^V4Vdz>(f z)K*`5Otn4_yxyK)a($yxr_2qJGEPZRnbl4W8aJNEH`xmdEr%8jCiBxTdko>*wdpaQ z24up~d9a~}oeJ@l(l9Y=>LRx(EXZ|;lltQy&UqYN1t1eg>(DAa3!qymRPeKTofca{ zTRzq*{0V1kDs6Zykt&pF@}yt|(-#}i>OeX%Ac_WC=YCq`TxV9Ug)W3y#Vc_2YBaVM zr`UV+Aq&mPU$j3jjbtyu6S|9Oxxy(-_kU;dAnYvM%r0evz4P`%v=Q6FM`koGQB*{J z-Y725S}#<5k|nS8G#y6zTqy37UNGN`0<9%uM5}A7q5y$1mR7H^+vsCRpk|h5*;O|) zh}A!w0mVU`zk;&8CW6^N<%^7NLwBz)jnqSr&u%-)B13Ge8Fw;X7i;qZ!;0j1^OAn6 zb)Zl1;4jSkD8K=hPL@%p-~dUYy&l#&$Qa z4zJ2?s+kd(0b0M8&Eyxuhn&h2gT@dBZ5M?B6spN~ z^&S-}9Y=*B=W<%q8fE^#-qR3a2I*#(LC0MXLDx zX3kTP(iw;Cbtnn(tY3n~Tl4fQ#H*m2kB!+?3>7LtQExoIoWn~h)2;JZSMM6#7ofN( zw~#aOi7X4in}jd4I=xTS>!6XaIL`{B4UtOOH%)i2G|Sz1;3e`#JU!H95B2OyXvM-~ z<|15G+_y(`OPt2&wMv_$Hy(8>ByH1uywyjxy=ur*65bMud@xU~=fex#PqgYfvW*8( zr+OKB?IGi_X@{Un9I5v~hdIhC?A*-kEY4+uwEhfa<-V%fUy4fv?aAFuNccyM8>nL< zCWaMj5wW&Q&J|8R)5!=6UXjzWkcu-tcY*0_ZDe1F$*@z{)H4434LVs*RiG@PXv1n& zwEl-B%fDR~&N4z5C&u4U3nD?XsdW{i9;e7Vw1Esg7cQl25w6GL@sMp~apk+Hu5p#p zLpCY+4wC3?st>Q?3K}QyR9q$ygAgKP=n%1g_TaBInhzcz)1~I8v>9`pzFg}E_}6Cg z4(_Sg>5eXwmJjm0Xb;~cAu_a4N80=D049ub?8FwIc_XShUFQ|o|3uN>j}if#fP{j;^#~C}Wya8s5n3I6P4GPbc4hAV{pSVZClVZ{on3t>rVYxLHJYoA z6*#--kmk=uZ}RPN{5TVAXe-RLTPEK&FD#SHVxZ10$vu1t(o{+5Br#RYM+Ww=Q=@Aj zbE_NDsGtX^+54FQ7pZ2bPS!^kVdKJJJvK4ikYr^y^^dLjS~x%du>SFY^IgJtIiJl{J+RC!JYol0w7GqPL&M&+x?x&;>8ETs0M@MZOThr!fEwrK z5fxHZHeUuzx!}KCl|Ajl%KoGbOO$r^I3`l=Fg<45Aq<=C2cWj}d05o;K_=)jl=p2} zzs*B@ugs}@)l=ZfYOY8gr8CB|)ugv1virqw+k9^z7IR9;bY3r0tzh4|u-QYhM(PNA zm2(*K5BxgK(0YRes7<;6KLUaOhx#OKYp8GaFZqC?v7@b(%fE4Kp~~NOpVrhwKaNo6 z3KEK7K&QG_45CD-c_SYfW=;x+GEpL4M;xjRRBy#myu*aDiLS&D4RVCbpkWj&C5_v><48@V zu25691LYgg;5E-yNEV~L!kC5OzQ{)N8LKb~IdGlUbSeif9IR*wR7+7zzB<)#XwaCE zd{q|PEI!w|gA8psX(z)Q+?UdA9=BY@&o-&xl3aMKK3zbSGr8L2R7~A}&;HOE=%=)V zQ@n?QyXn^4&p?9k@Pis6a zr3e+JwMX7&dU4_i*nU>Ct2E<}8s;fZYMJO)jjU$2OSs!E-y5es%Agt|nmHPe66b1( z-MXFRnX`Ob{zlvEV+&b8dy$fMGFG?mn0)qPWdGK3y0FUey)o%IVl;BTubmCuH|Y7M zi+}ihHie}_1``hEdN0k71xBu>N*`DcvLSnr`WuX%zRu1amL$y#jy7ZF%~&0C*xX@_ z9@A^k%>oR1R*>y2PA~2u~ku0gVBonnQ>6`t&EggGC-RctaZqf}2I|l{zj955W~Rq1~{XDtjGpFtzb8|(_RZ> z{zKYQori#FS892$N0gSBIAhwAmlLCJ(6Y5l<;MH6sCi&k%4i08mh1A@s-RrkiT0 zF(jh)84cv<`g+kd|=6uHQS`vKDOK6&DE0(Zm);G zHa?y9J+8MpJ@&7%ystyazWYS-QKwAa%&Fh`mzc0w)>Kk{TdwY z=6Ho8`*V1}BfC}n!xyO+!hsORsa3zjuNMdyYLi~!4?Q~r2gTmNq(p5f>aig^#`q{Z zuoOET%glZdN87oZEUBI1(5P@85*flEd+JQ>Mx>Hm8J6k}GjMTxu55?p9`u;K2?C1y zt7Q_F$*vXfamy}ohE~MAT~{bnOHJQ^WKbDn%^J-3Ks)FXy($fv^G04)d|(E39;h1- zS-1@M>_GgBBLo>)x?7lUahpC8s~zL=K%w+HBOC27N=C-es3coe-{MDOP)dNMjP@|e zxy;7T9Z|N60nslnPH$_Rf(urLiy`nQc?Mmpp9=%%-a|4MEcR&q&-TZg84u|%1f(@d-r9;0 z$$Q2b+BQ45Y#V+a9Ibr=R5BaGRE~+EYUyr~Sk;5)EyKYu9a{rf8+PApnQw_mw+6D= z+V%0a`Xs38pH+1u*QGzm;k>w9+x=S~8IZ22huZDBL&4bpwD@M*_4m6q`+{+F2gd_` zb#(l@%m;DwyAKv$VD^zw&%kubOHL?U>uvpu9l~!|KHEJa8}5MUG=mI^r_>h^q;9i4 zLsDGUK_^`AnE?XSq+t$@zELDnTw_hk)CoF_7h^V0tZe36im%TG-|3cJ5d*r85WU@l za?;*^d3=FEB{ird!_e@wON*mj-Si-F*;^ZoM$wJ=gS++s^ypFFe3{ z4*lnD;i21Xw_rsn`a5tiAF)_lCYW1&$uJ+aSX;SxFGwGySl&aUR2dy(qthI(AY|PK z2WlA|L!;*zADG@2J6JX^XkDj6+wu?+S6ZN5);qQ!5w>A3Ub)V@ZuDE-i%}wi?H48A z${Dbm@+}3s)F+}K$ZepXABNPPo0``ZfW66nMo_LGMn0^}x^)9$8$7(|jmWyRJgmCE zIeOhUL20r!S0L?}w~aK9tKr=Ra-C`I&;D#Nq}Z(p4KTFVWAEBTJ1gw6vDsc*=_m|! zkBD5oWp7-!5i{%+SNCC0*SxrbC4rL6M6LXRa1%(V9~4sfC&USCAInq`a?HBI5U)ENW{7kkg{CV`?rOkK6 zebM+2t*wJ-r)4oh9tJ*{8a83#*Z1?#hZede6}kILzH+XH$gX1({XdF4<1Ah5lYZb@ zGsvMX3-9ipU$X7IxS;_CkiHZli`k1C2h0UFBD>-Z>u8XG$WvW(Xs`>rjFCL^nSozn zhD4qAn(5A?euO&kYL);eh4on-R$wS{^JfqtF27q@i@A&NcP#3-NYu$}rDO_Zj!v(RcZ&Ybdm4VpfL! z2nn*6>8;tETi-MhYkpl*Z{ZHpTlbp9|KkFwb328vuY5G_L>d%K#9O_7+3c}LEWOa( z&>v-L6M%t|81^2ZhaR50j`f%b>8Px)gX@&jlh~6c`u%Tkl z%7!bXY;`-xRa(c>qSf;w4DUbOJL)+g^0k(3hq z0)(M(Te;3@SYHa$1+gAJe_IaE$}CnRFhwq^yh?2G3)4Ncciy_X_rlZQWg~*OZSxvv zd}iW>)T$ylB#%#NS zhg=VZCSIh|yyO}$V$fRH0j0%Y=~(g+u__`sMY;B(UkZm3QP8E^XX)JO17bLt zNT#NYOe20(uzBO0Wvr``hH70)9J1|ejZ7|p=6j%Fk-28@e=0i*s5+9ZZ4(IY9^BpC zA-KCsaCdhJ?yf-t!QCB#LvSa!LvVNd&)m6lbB8;BX1>ljtCKAH+10ytSJi5E?YIAd zaH8C4!ZhHWQXH?76Fo0vf8DGgT%zA zONTU8(B4+6xCOaM@6QQB^6#B`?dl-S;>t99DViMQIXbtOMNgW_!sKhAb4J0D+c`$` z&uokqRm>dvkj=!4T+vHB+79LdEOi{61bEOn!WN<~oWsfHG>Z&I_N`)RxunRclNnRT zfg__vY~zt6H0G;oog~oX{cx*a7?OHX8aI*N9=$t>{s0Nly<+v?u_@&MzsHI+g>Um* z=u^g+e%Z;0XwX)gWGaAZNR)VM+J6@EEJha}d^GKNe0B-kUAI8Z0eZA>9KtFPO;KTJ zw=&DIH%LwsJ553=Xb!tWN*aR{S+@N_{X^^rZ-?C2 z6MpQIdRkpW-94Vy~?Dnm|a)RzZN3S}l50(X(3uo-7c$=rRL zxVfsq(Q`wSDgCx>sTGrBI6K=j-nob7uqnxh_EQ0e`_^tZgt8(nyPRlxMK~X__v(qZ zGac=@`I>fhA1=rsm$wC<%nfh&jHozN;@=IyvOPUR1^9{bc;J3&cmIqXT zqg1%{Jtzz_NK+|6d+Ecvn8u8-A|2K@6W^0g?dPe>Ge(%GzHP;m?1VHCS5eq_Dl_jN z>>}ex4kKUCRDDFGye)}~7w#eP1oyF7$2*M%d;ZqNx2Z$@SfVDw;7xkJFLVoo_6)mP zcY5+R=mmdglkZGttH1}J?Sm*^t=z2*$csTJ#B=iFG$r(E_l>xgGy5*4b4Lk0PAkeg z4-jYB>Fan>C|7?yn-&{%WjCUu6{Au4StuKu;W<4`q}+ktJ3wU&q=HKa473cAB%!lZ zk~~NC>i1~&`f8I2!by(dBq)1D?LEkJcQM)um@Cd<)@@1Dq(KsrQQ69xsB83zl;~dg z?d;40RVY@Lc^z>K)K%)13|s7yNdpR!?mY^UQOU?K>c-zfsc%Y}4CB(Nb?-kh9A`Tw z dMh$MxNrdFpdh*_<`LZlO~_0!uRjop;S?UNd`)95giuG?bfSdL@ru@@Yz%~c&` z+_FSlGRJ&u1jk4^b@;;J=6aKq-tEyW5yzao%l&{*S;`=z80pyCnys6BbQFC_``yTc zi_orO3~QDQQ#&o1dB1g$(<;?AH*yT$thkL~lBfXGV8yk7uAEcE%7%Mk%rjK9b#$J- zvvj$B77J35DNQJf8miOXi(vL1C--blPSyq=NgLtjJfN-fmii=BW^uJQMxO4-hJ@fP z(#1kc6BiBidWlA`0FHel0Wr$HN{wP#gp@A+MhK&wA%6Xr= z$EB}OUYvIwK~SA_omJoxE@U8~7jrMz8%fU1v&0nr#4$p&oK>&Z zj$^rGZ!J0yx2PS6BOB;V;+B_@{&Bh<%wFpf(n*w(*J|!@l7ZCT71# zv^!CGFx>>lG`=TPYy^+&!zjCnqJr;a;n^xy%hwwE@J0hHtcvT1JXEulDLdMKn0}JH zU=U0&?q0nQVQ3rbO^xV{E45pymf1IDdlvZ_qzPT|qTQ({<5caKx7`^1n*1W7<%slo zlZztKMC)>VB*cgNT0JGvE`7)eiU?wbZi3}?TbxZRfZy--!52qfwW*z8e-f&#W zp6{cUo1ZeiT@-2U)N1i-)<*K_Yqtjz`U}($4I!O6*O*8JiMA3nVA+FfR@P8ADaK`S z``SF1LuRw;J_xoK$__Ois?Nc!hY*ZaZ8dEu3uc;pyVwRLrYO4yo=9tEX5I=+x~!6x z(Yly1UU`@yJ$^DKhBLq*G(XtOSBXB%;guWFwh9IB6*Nq^ixGnsz`B!|9Mi``sEBQ; z;^nxq##1NarGg2n1CuSQA+fr4L^I?{45PSGtf-6O4cas^-|e2$WwQd4bgnF@+j?Y5$X>hf|0hpiJumY`=njLg<;=7@~|BY;}%Ll$FgM< z)VdVo0n-G~MtFBFA$ZKRrTpcvLy33<1aWpI$u-cc8`Q0sfzd#{uBx1C4}_w78U(oA z_OlLptQ4|MMoBZG0Xxm5uT$|;DK>#!4hMMmRMeb6^w(4^Fef~D1$mAQ)Er ztcHd{tOx-e*=QWNT-wv1;6V<39IuP1O+_}$eG0#FmAOmbccL#G$FbsH%WkuBT=cuX zuP2{l5LsDIE#<_*cym{JIC#KmV2T$}_Iv9mEr{TL!-*jIE<8)S6<$cu0(I)3)cQq>0jk-wi7V~{$S8}Fy0FnK zI-KTnGU|Ygyl^}ED06@1@?7D{(2o}XL3n%h5gQ{7&t>O`>yK?=Pi6{?Z&N0GOJ#T) zC4O>>HxNcDJ=`rW*43GPPiM;<43{Q^yY6;Go%~F`O#@cx&Xd!-o-xLdFM{dJ{tmf(gpH@vc*r z+`%BeM{&k16YldKvu;yT`jceNKun$G9}&Qx^oR69k+ zW83ASeC2Mm{d@+qjB@vI-`T>s6V!ZQEz}zakrU}<Tvj zZ&ycoD1tM4do1C4%v9IsS@-T?EMX$jOHcJ)F$~4IHgU$c)FU#P21(I30mR!qq!`81 z!o>MDG&RCn9FOJln;Ba~u-$GO@pBH5TNzW=+`v^mnh{NRt+oRobZ0vR(Y{v}{%&r| z5ApmX58k}d-+o{{Or#ZQUU0ZA8SJv?c?t8}2e`#|Q@g^ifPXZj7k=0EmLTj0dY9w< zk<7yr&ii)cEt_@(r8~9V8+I}}yK@Dy8}>U_vaGc&Bbk>_8QyQ-$inRhc|0=;yk#90 zWL?fNWLiGS96Oz>%RE_8{05UAGy6^y~Bq6T3q9 z>5lJ69fs^>@@>BqrAw8ZOYy-ly)z{xTcNx&N^yE;tk}RYZFQ`d(tos5;7upyrNUjj zqabOPpaQQ;)7SwmT${70%PRGeLk`YC4{Z2L#hu(6=+8-$$e)p9f+*F%W-6h~KZi=V zyvIq0zFPAS9ES`49Io*JCR`6a9U>Va>smfKt*~FTsGr|75L_>#@Czc%2!lKwngZ>u zL;^XXb(eYEyK*W5YZVn9ktw{l_Z2b|+)1~vm9eJQ#O|`P-Bc5<8*lHO*^P&(iO>E#>j5pE9* zSD*syC7eqqrAlic57M#K3OLnZ_4go3i-@5=sqG@qf^zI_%oDC|a;brbR++Q*;E&ae zmvZP#DJkM8uf3H3*E_>ccm0?u1Wh}0KWQp|Joqi)=+U8P1TLP62h_e`zm#2!H!QfX$Ud?#RjI(8_sqtaqrKN8V3 z!vLI5S|OdTAq94N0&&pDJ(PKcNWeAG?W!ibM~za`yg9lqa4Rx$t*H9ae%h^mJC@@p z<%QSjj1UDIJh}Ybu;u(}l&R5Oj2nyRXcKFkP*l#7LNZtZi4S^3)-Ac8HB^wUo zX7Ed`%VnPJKd?hsU~1LTE?5S!}7xS}4kN)16y> z&K0RpB8XMwg2392^Q#8FH}yRC{=R-$C{9bEnt;k4z9^Rxz@0$=ttjSh#ClXpNmq*D zN7}}!iW=g3!^Z-YOl-W6o}W{!X_}A-u4^X{XNnu3TE?Im_pweZHURr$Xi+MG>1>{O zwFdJy$YO;dSCTz$ndREUJX=)AZ!`3$XjG|`62-bB?)SLwYeIn7wtxRT*w>xaD?%xlb7D0? zE>jT639^EcRyZtdAS8rrg<5StPMTUIRsETyC$?Qf1me!Psu%HGIVuLdN`+X)W;Dh@ z9zI_!g>+X~oP!R@B&Nv-r&_s|^WmJ^ynEm6akDb7DD~|jOxMza)WJfk0uXKvNDqb3 zL($twAcI~7mXE3~PGGj3>{XGC!YkB8TSxlfS281S?&8$pDaFR9679iZ7qq(lXU8r3 zV7pi`U8shn=ke3sVoHlmTH@?J2*hm`ou?;~f8rkKYLCx5w_M^a~-5KEwim#T#OD6XNkK+q(E6MFxUFvDq&I=99;BXGM? zT3uKHJO>=cjv-VSWl#tvKa_nKu}zM|xsz}LydY%RHuZ;W&3CGdd3-)W2Vy(aiJ^1O zAZGpm^g0s=+EMxkeVtU@Xz^;p2-C6e3`9=vJJ=l=MD_agd+3&S_4<$x zpcjhI`e9t|n@hrrdVGz&Zx-MG%P8)Oc;T>fOzY{}kU;(ZvLp<~a85#kHcfE#-_ z#?7dUi8P!NcH{%}fU6;FH4?bla^hJq@RF3OrB-&~Pw`&iK&$yqcUG9Dc1X2qpk6Qw z$r&BzFu)Ujz}WHr9m{YkKK5QW@s=@;9p_)hTWS_+EFkVvanSvj!kwZm&-QG% z-r*mf9pVH~fvpd|v1L*9D8~#aNwdfVopOLhoyI0aK_-ott+M&9WzpH=o)QtRM@j2v z=1Mr+86W46=NcO^pe?MNA(#kx@olIv?sRAT{8%wF3_+DdpK}hXi-vH^U%cQ@!+u~u zNteP))6UxxEF@k61C~J zwOP^3o1rqp)~h)yz%TyWu&|)Ek-iL*(-HePTe<0dvJ>$Cvz+f&KpOKhFFi=V_p^ZjjucMVd>!QGx~xJDb>dPl{m*DA6Z>EVVvl@ndcebj%(+wceDg!}u z$4MUon1Iojd4RS@=Zk^*4EEC$N=VG1DHJiRtdRXKuJC2ndT75Wc ztJtM(awCeMKAv;92R$WjSBh)IIY5Zn6T~GPPmj<23@PWDv9xE%4pE!mQ761$L%9*9 zqA$@EmUT1u47>Hs;;9JC#>n(JtGONcN`RLu*KvQ#*~f*c8$rlkHnOl1v$<4T3g$2i z@*Vom$d8nhw)`m0VHOnafSrUUC5XfY2)Cy*`}pP!O4`;8?yY zZeXyBO8m4}d1qdZZv9@=xGa?kK?ymP?bh>!|7i%6iBCRdA6yqf(uimp`%@Qx9Y;BqjL* z{0d!%{8%#B`q1=_IHkQwJ;f5dK~YpcqZ1^9AE zZls;DWMFDfZkg*}aPPI>i;?uBTu(g~RY^L1V|px-9K7j1+&7>X96Nm1ucf2cr&5qZ zX3k>72YQrQVGru`lDcch5|r2OMwpW=cOWc_S`!LVRKbP<*O57mG4+^R?JPrw8L>5p zYk+EQ>)rxc$8Jrf};K3tV?r{(JIt(-{1el;G(|LGd80iR*-}Yrf)k z1ph6X8=~m?BG(Xf@LC|4!Tb4AjLZ|5E|(h+-!?Jb)y>%3_gi`P@xuc*%Hep0-FPXz zd~u-n?+QXR(0Snaa`P{RdAuD_v{%%v;X0$;0uqv*Li6qV=r=hw?QZw*9}mr31D~%3 zMAwwx25|!OiHdKQ7h-|K z^GN=HYoD{zk%)BWss1rzvWHeZz-uy6RTA1J z(cttWcJR$NBj3Wp+)DFB`;E1`?~| zZXLsx$SsV%l*W%#YdgzJi_s?Oxy3~ckT8wT+5>Wd=_hjTU z!D@*SoDokpkn)OJ-+WL~2>>T|T$Lrrp&;vUghJ-yUw9IZ2yf}-w;%Hn;~(bP&?fJp zy@hluxQXp!+k&#=3-pPb-M-m)0|oS<8qqj@_L*4>Bd3mA6=qyDVB_8FR_ne8vNwg- znVr9!PL>|LZOW{-9QT&c7zz|+v>P(yY;BUpIm{0ON~)7y@i#sWx3M20ciAovLcg4% ziSH~@H+&_@I&=w+>f(Cbyeazb!77ck1xAjqM@_iVKPbHxD=kNorWb4JJ98evT;QcR zS+tT1;(gT%BS2{17ItH3k697V@lfi@KILVi`T&n{+`=7B{{2(8*Gu|sYnU1?VsN$I z69e)AcNZrg`0SSrXsCnmjVenupTQn;B5EJF((Wxd##w~k8THEN^w1f8wG58RC^@N7 zHPLVBCY|?^q$=oof%dvy>fA+@nMkrG-S-xxDgl-5_PRVo?Kze0l>^cH7)dBp77!t+pyeLhRvHqd&oX?&x_q($Hlm< z$MeJE!d~kvLC=PqdyjY`=`JpL(oKG>0m-+j9;~h9a3sZ63hzzRi=b(}1%yUMI^_bm zv{}t>W^Fu=2nh&2X*lxFFNi*5D|QHq)L(QNxpe)EY+#|;-T@>j;fdH~V;ykmm0m;> zpT%v>5}W(oqItvDhzHe$h_|`NNe7`n%0jLn2hyJXXT#Y4>M{}jO(vtcp#=lWD`h4n ziC||}K$o3@pEAC}k*rP{bBS;c3(9K9>3TR!U898lSWU+IR^_ zKKZRQJ-HnTaf*^cVzTiM4X~h3WuMdoTwa9E!Ou6sl|>@qRqi(YU%L2mGLJuq;Zx`- zYA!bL9rJjN?Je^7JY6iF0GX>%=mOzwPei9$)1uP{nn5#xYIXJtd-}1pHd-e*D~`D%2-Hl)*A_FBK|vEqyMZ8y!9wo0{&v&&7h;V(AF>a5-yt#sksJ<%S`hs&AnE z*rT>luDDwDCW&p;62zDMi{*raQbhOAE$t|EaY8!NQ57^$1z$RP?+&iet@<$iy|hMQ zW6F4X{T)JjcWkiyAUh82KtJgA7u`3yAm@n$_u2ec(lbP8!_+5Scxc1+Fs+?H}| zw?WXlST8c&;?fMJrr1i z@9J%*`heR}8kf4CQ_sUBs6CAg5F4mHt-ko$P*cx0MsBZkSO;WR5F3?U#rYPEt>|;^ z>KS0WIHtO^Oz_NoVmf8QKqXt zF4Enjj7If9A57f*kYDws?KTY5oJ^gO&GZ(*_GX`hhZhIfZQlH@1!tUSB{X>jt?kL8 zob8SFCodeJ(F-Pepdi2ek zNNzsVy566x$}*H0oXgVZTCGEdEui5UC>eYQsGkfucgdtwI`ADjH2NW1j@dJZahqis zIujY5y+O_Fd&if(+1NM1lW+!sYMB!T6d!c(;c~(yVr93eGiC3qtR7zM8M{Gs>U=vA zjn-N*eOtKJ%q|*2odE2)DUu5?2BCjhNARN#qdMo$B*Xt542b?_FtBlQ1nk9oH5zc~ zx^ff(6i9NBfq=OG89>Cw-b&BW(a2Cp&rwg+-puijl;{kA9IDa`#TGMam9RASpWzW9|;~T`UwZ}meN3Eqn6Yw zTOM89IG5Fz9O;bL-5cyZk7g{v=xJ4I)$F97WIkkgUEgruY`(NT(SF>%b$}>2RYO(T zu)}Dl?p8ItEryYOdsc_w7u7XqYus4#3QI>+0x9jpL*vWH3cpf?9l?cMiHJ6R8fU^`)~q zo|!FO75OCSLKSdzZOWNBkGITh-y!k6q`>hW>>lhPNPnpu&ttB4mf{xLd5Kg?Y^>Xv z+fHts6g=0oU{bzKC_;`hzLxR2(rR0*C5tOwWfWH#!ZDALqD8ZFvEH@BuYxR%cqI~~ zD1t=^8>{NP>Q-z4$#`CfyNxAN_M3y*gh_Nh6ciOW(tMREYZ?`C^(O%atA3_XNIPE~ zI_wDJaOZMUQMU2NMk~#4D~&j-NwV`%bWll0+~mX74j~2A6O$f#xo}j|!=Bl;-QGjT zbTy%uW;3vXRH|N9Pk!4sT+Hg;r0?{9XF+G|-v30VAwm}7a%*W6SI$zxo5#|%P}^sJ9RQ6g5z%*X_LfM9x3fNj=V{?d z8@FIhoPL>`%OkyXM3E<^p7DVMGSYB16ti2JNLhrCg0pR2Xu_AZREjWdt4XHXB<{?S zRdCZ^s%>)JT{K$posw))4^Z!l8r>YW7@`-(QIooi7L)T}rd*0*C!)YtiB{!FhGwKa zh0cJWnqJSYg_t;r!jhO3Nzjp=ws-Usfh?rWRkJ-G2+O+Nk-gN$B+}$dNLkmck+CLh zHgGY#ef5xA=sT!ojFGQ}M)!4#a}`7JS6I$)SLi%Cg{sOJ0^OL7)O4is;^S_!%LCie z-1WIwZ|YKRNxX#*G+1ra`NmhLCI{cwaT>S`^i-VrhQiw^F$cN8^xuPNYDix~oJrn> z@I!%~VIhC*?I)dl$0U!y<+Aw(nF5>sjO%fwhu`fmk;ezfZN|CG2(Tqf-WKhK$5vCyN9)ognPep^V+_nA0JsV^^dG``S%Wb7jwxXRaK+d zTCH0&Cz(|k6|(OzX(HJ`((*x?II>36-M;-;q%`u%V?_zswQr8$Dz^}&*lwJttQkc@ z{#-^_`%=js8MGA^IDwHMF}JoM!DcWbMcout!(%CMaDI0iaQV_ZY1`UlX}z;fD`pim zzrFNh`)Fu9{T>Q3tT}%9t1A`S`GqbjcO!BM;>K|Gj%bW1rRJE+-tL{ks{1j;NSph$ z*tdgEEafIiO_?VX4m1gl&{6)LoWOJ>y6RiNNbGM=2u&etQPA|G zUnnZxuR@u@DjW|v8n2t9~ zPdQ+cT^*4}x;YTcvI00FaVJYk)(Y6(>Xm;{7C@i~qUn+Q9%e;STIdb-80!Ghwk`mA zxgm#v_*K%7%UMe}*SCI@xH{g$*$Wuat_ItaudbXij5i|`m27r^Ojo=R)FK(Huq^LA zi}{Tz#0cmTy;ql(zW>N1d|Evk1AOrK$8Mu~w&wbpG<)jDa zEncM@-*mlDdc4+32JMMVvWrQm3&*0r;=CW(9>}+9VHl}y77&La=C->9BOjt~Uu!fU zL9TAeQcvle<9sa48@MWI>x6&*luM#3+fwkMN>I>P_&En0a?{~YeXpHMKD?}BThX4f z2d*(H=k!%)4A$mvw2L|+9yY*r8uqxm-2Tdn)1PzA!CS^93a!Li_ulFv<)nJ{0s2bd zva4((@VbvQ)jJhBfz)oXcG+c8W9=(MoO0d9aw&HRC7lX6pFZVBE6R{%%816)Ncow7 zQjL$T=A8lNPEQIW2}6|=w~i;7=i`Wmu~WF5e&BbrU-G!~&ez7#&`djxew_k*kT(L}-Yo*KRe{7@H79czA!!Z{p zHma8iVD09avsh_v<}U&#WtVZxFsukK(_&$GtshfJ_MMC2+GAv`r}l6meli>sCo?x7 z!yKQ~m+-e1%oebE5T)-rDwv?JYZOAuYjBjhN?JHofUCxh8mt_);$*rnYzF6bqLaq{ z9P0m0KCM=q1}+0>&salfn;1|3P7$Z> z!I+A^ILYR@a2RSF)X%27t-3urU!$fRW( zrPQOgTUHTk8Wi$t{yaun+8WLSoE^VQ{Ia-*)XWZgew;l3wO%?g@w%`U@3DY6Ga?X> zA;~{>keamAe=m&7)Z9EZXA+-}JyesZdFW!x*rTlUP3$bcg>E7s8JKixcC4{e8B&pi zm3{}-M2eF_z82sdPEatV@K{iguuC?Bh8aLeqR$i5fXZ+-Hif3K@?~Tyt#LG#(8TB2 zZQm_0QGdV2=JTWd;kf0-(}Zt#|CGI!>q+ipc4dm^*YHnUF0wBMf6wZ35B zdhhg&g`Yul4;f}{t|xPIA9YsT-f;^)r<#0SpSN)nNzk_46sE&GLo#@bLf6?@*KxaL z!+p+h`MS|r^5_}q(l$C|b9#`*{TK}Xve)TzcKMa(whjEHdsSzBodx$fIrwFB9bS95 zSCiW#9^?57yiZq_n`_$Kir&J>d6EG$@*4km$++wIvVglCXOwF|cxFxrI2%0fWGK0D zFZT(u_WEY$X$TUp@*tfNcftkz5YZ#9{5oPHF5+p(Jg)pUs)G=V;K)@7W<#M|3=lY#+$aHJL)&{@$U#_2Ep{teyrVoUojor7~zWv2@oBFD$swl zrWqU-qo%2J#E*MtAx#{&Cq|fwi#HOm84EHjMViiAF_ZAwsXypV+C^Btr`fxfAIRpk z^bKaI%#QYw%-n`Yl=<5U?x=LoRb--HkzsZ-BAVE3GDn3w{mYWtM|+3t zDc)^0f6e*$fhQ;&qT4t}()7VgQo_wceMd@6yur56^vyWyd$xrfWG}&tLnbdp-3vQ$ zE!}ON4N(lIgtqYI#A%=QyM%SAAe0jlUaP}+K0;OlS0bWyC3XQ3vf|_XWuB*})>7et z>4jrlU={ngY>_W^zJu(bCY(qzBEjk4pih+g-Dg5!g1Qe79I;{ajD$E?qX<>+852W< zrp$nkqYIdd&LF7bSP|~@oas4GMgusO`r|%<)LZgu*R2x1jA_u8BC~;7imYS6kr5*D z$$=1Rnz=12+HLx|of+qb{NO~Pq>A~7i%Kfipb)kmDr`h`I~)gZ z0u!pMg@r+;`2*f&g1Y%`XI|@K$K7Wk)~|Bcqi3spN!Tp(0foK}cA37!@X7joS?%K; zsQA#-+?l|-_)%{;Y<;1Obn${~Gq84kz za6)gb;;v4yl(h$wzqa_iZk7iZOPNGA(_wT?MX(gP;B?$5#Ck%o8KKR3!X)HsLrE|_ z9}_%|JM);nXKw>W5GKUiZ%YrvXL@$Hpwb*BnuOxfaMM(TC+JRo+V$Dhk4$3|xZ$1Q zy`%XTHIZ)uv0Gng@bXunnNjSe?`07ASLd53X!GZ`_o5u|GeV=}^<`|YMiPspb1{aX zL)Z7U6xT0hYp#o%myaVhB0a_;MHn-fR8vi85#J;>VnHL2H+rd9mvP0uiwydPw_Q(T zavfU(H+(AszQazj8%B3=EUCaY+3n`eSG6Wh8h0H|7yl!BVLDMF5Z>0?a)*(0EF4#? zhBI}Q$qpO}u+s+c2-t|_=BQB0l$6I*SJBDXI(wH}Qj$9$7X28eIdq@6=hHQ{yK$gmZD%WMhaR@h3Dd4@gCdKc7KWhaC{G#; zW8qX=RQjlUTtgQB-CR$0E;MpjD-O~GomSHLE1PZ|Y_2)dfFM=cNDeZ2fQ(REv8=dF zbdm9w7_k;9PNkW?JB?2Krsu)+w5Ki6Zfr}`+PpdD!Ew@(^Dn;E28hiA?rXaXf=rPX z0q#+1V<}g;)w!8Ubkp&J5$>cj_xcd!4$S#`N0vXBL3TjN2>jsr7darGya(`MX>r5+ z2%&Fy!rlk(dV{e8l8(M4Qk3s7d^b?j zwYzSX;r;VTm}%PZjGD~ctU0N&zBH_L;mJqwWrO*M5Uq${t=Rq0YZ{rb*L+BxUva`b z(!+g%YdZ0d4de^nBpW3#Uqh;M+^*=Rw)5+beXJ*vpA#fY*_Q|usCr*ZSzS0hvGL-J zpVUnw<2Zh*#>^|uCr%aq!zHk+WVyC4ZaN?;Cyp8MyBnRcY|g&7k`#haNao#eCNM=a z0s>D8)jjrLVO65M0hK={6||}UHVUtP3$@TrRt-+luusn**axv zm3EPAl~|U*$?(T)F%$WxcRMRqQ?wfng!{VFm3x?IA38^}gv-XxGm&ysaGTLt0@d0e zf*QZ`SND*rZ{Tx~JfKNB6Ak#yRcp>}lP8_CovEXQTC5|_aiGx0%V$bctTEL~UaCi_ zpbc*XeD={!60kvny$fmyhhgLAeCCwsWy8i*NZKWcylm+s&8)qY$D+P5X2^n|!%qoB zCdY7vh~%Q^LC0$Xe>_p6FphQk6hhV^9ReRG7Yuo(C%`Sx{si&3AwM0`Z#i=(A2GI} z(JN~8hPM!;{+3;!>W99bKiA0@p{ig(31LOWN>3IhG;?)AvI*?ce1>;hJPqB_he1E) zkf?Pmj@HK{?TghVXhF}g8SW(YPgM(%#tbrVS2UbkjRK{ad5rltKKR19ydWBw8(7ZI~LQsPb1*9ZsT?Cx3yqO7SM7P zG>&RDoyLX#{^*O5^*tL)rGv3?}90x2>@sHu%iDYGJcnU4ruKzmzfwZ&(` zIjNX7VvBWL=~)noo$A&9Z70JShR?Fs_9i$~>xGhvR%uIvKL)*H;Z0*5w0zEofRD}$ z=CzWQ?^{s9>xK{~c|%!`pw1ttCh~9`Q(6~yzAj!rSuftS9048EB6Q5n7q5!dIx5o% z&^$YDXdBzvYqyQJ0}HlvXE%Sk@-xZG%5FX=r2a&I02wq-346aNcoNDaPU+eqpDbaO zt|0tj%P5D2W&mivP!`^3n=-=GvKf~ zbev%iD;S$MJ13qx(2hIEFCgk`Wzo96T&t_VckJ$v5|@*k^&Nl-Q22>4XOzYyac|FX zQMZmNeCCl;TD3Uopp1MrIa|u6+tRDaPtyXoVZGS0s@O8CyxOaI@Z2m@dOVdXx~%BD zHoQ=Rzp>z=klJjZ5K^;tvX12`gF&)SS#9kKBQUXUbd5 zjFM)2(!#@kR0hK*-!9IlJy^38U9={TLaaEWlwe0b1ao~qe=Bnd*kS?OnRFgSEu*Q9 zLOy9N8u;x-UMb}elg9lsdAN6cd;IsDU|Y`Rm(f#r!z$mFV!|d9^yQiAcf z4lW_6Ifh&D4)yUp^%)A&Z2~W>p7$-m7;G=eLLv4sxE_`Gi;4k5noXJ`>Vibr%Zx%rQnZ9M>d@|#uYYq2yR)jc2hq@4(l&Xb_w+X?<{^pNL7;mh zRMtU`?<6Hv!R;sUbS z1GnXlBvd={QjZP<-^_*C_`Yy|l(@Orn}fC{;BV|OKgA=|ikogTM*qg)d&K`@&4K}Q z&zDc?^~e^Dc$rnUqVnlnR+l24?(3njp1x`Hx( zB?QS_rui`E`Jg&`j^-_>bV}K-J$qEvZ_bv9INu4l5R)wEsprlSp*@*X&zf>-zA9K+2;h@ZmVKb@}AfEda~GNx+n zFNg5JM)l>Dw?4qpvPThqzV0M}>u0RVoYYaS&StRdUrG;oAM z!bLB6EEKsE7--Lyy48;mhbNlG4PLT^n@-rhWr}EDOJErlHrt!*{piuZEbd!}&$^`L^z9!S-T@iEK9fl6@+({{{iMHBPl z+&OZ1uVpDrnYh0ER@D5rFB0JEYGvsNC@)HD`+Ma$Gb0Dd(XpAKF*y_mS&M1^C;4 zE|un&5f>3wRHBs@`ETRD5&pR1xAPySfq;H9UJm%5-wNsd_Z8KVw12wdr_JB482|Sb zHa4~n1~%3XP5?Jq8@T<6@Y*K!Z-)PM{6+u{a?9&-_g@fL=j+-ROO+U!(ud9mfw<)QW&U)P{LY&LsUCvW>0V zuiSA9cOKyhC=KZkaQ1J{#2-hlFBiZ&zjBA5ljE!e={q3K> z0{<@Y{X3hO;rE25*RH;!aPHdxgfP#)OA7vBAlEk?@S6M|)8%X&%znz0zBUqDCA{F%j&K|Ek!FqxFvPmR z{jTi$hmBm{3cdf6fxiy&?sEaqB>+g*k{LizH zg8BaeE@)|H^oQQ&>j9t@Q`aT}fL{dk0qY;W0i1Jvoh<$jCPefM0F#E>U*E8J~Y1fR(NO#)j1|LtdLvfiDoyw>=22!_v|2Z@~&i|D`|k+AY{#LEU43U_SOEB+3GKx{=Zps`2TVGZ>t~OkH4n>OIZ0oi^tzrK+3G;N8`Qz2H3_uub044^CKl$NZ)IZ=l{acatbtn*XH0N&uo{&|5i~l_KJ;wY!_V?1Q zf8F533ZYmHK=?lWPxw;A|2_HlHN;<&U(1>Q;f-A1k<@=g{%0C0lYaSo@PDhlz9zp` zLi|ZqDf}nopSp;z$*%?MevYvi@#n_p=q{4@jJ{C_m_Q#s+ak=K>*e;SEu{XZJ{ zb6xz`hF;e^|7i&J>;KWv&kE?Tjl8a#{nH3-=RY^{|E;3^+T81+xj)T)?)}H+UdPz~ zPWps@aR2q1<#zAa=s$MR{PE7{_i6w2KAJy}xxVcC|AhCa_2(bEYJU3Te;ZBohlPJN z8ua+rM*frS|L0b}&iDU=nd>X^&w&5m?Ejxl|J^^Y^U8i&61)9JO@EbT_L~1XE$b)W v?Cu}&UnOb1=D&XB_>+GG_2w^LK*~vi0v4=5K%9U-N`N;%63~D}3()@q&SUJq literal 0 HcmV?d00001 From c71ae1128e5d8fd90ac1d2fbd03096cb827bf93b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Wed, 29 Mar 2017 16:26:41 +0100 Subject: [PATCH 37/75] Fix AS7 build (exclude additional AS5-only class) --- core/mux/sar-jboss-7/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/mux/sar-jboss-7/pom.xml b/core/mux/sar-jboss-7/pom.xml index 3a1c2a541..b4e379480 100644 --- a/core/mux/sar-jboss-7/pom.xml +++ b/core/mux/sar-jboss-7/pom.xml @@ -155,7 +155,7 @@ - + From 769159c35c9dab0cce33b63f74fef73cd7e1a62f Mon Sep 17 00:00:00 2001 From: Grzegorz Figiel Date: Fri, 31 Mar 2017 12:19:49 +0200 Subject: [PATCH 38/75] Fix for issue #80 - new AVPs definitions added to dictionary (#81) * Fix for issue #80 - new AVPs definitions added to dictionary --- core/mux/common/config/dictionary.xml | 336 +++++++++++++++++++++----- 1 file changed, 270 insertions(+), 66 deletions(-) diff --git a/core/mux/common/config/dictionary.xml b/core/mux/common/config/dictionary.xml index 91bf1acf5..9aabf9e91 100644 --- a/core/mux/common/config/dictionary.xml +++ b/core/mux/common/config/dictionary.xml @@ -38,6 +38,7 @@ + @@ -2103,6 +2104,7 @@ + @@ -3243,6 +3245,13 @@ + + + + + + + @@ -3329,83 +3338,273 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7573,6 +7772,11 @@ + + + + + @@ -7616,4 +7820,4 @@ - \ No newline at end of file + From 06049defe161c7cfcc20e6fc5e282820704e8447 Mon Sep 17 00:00:00 2001 From: Grzegorz Figiel Date: Fri, 31 Mar 2017 12:24:00 +0200 Subject: [PATCH 39/75] Fix for issue#78 - AVP index getters and fix for insert AVP with index (#79) * Fix for issue#78 - Get AVP index methods implemented and fix for insertAVP with index handling --- .gitignore | 1 + .../main/java/org/jdiameter/api/AvpSet.java | 17 ++++++++++++++ .../client/impl/parser/AvpSetImpl.java | 23 ++++++++++++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index cdfed9175..c5a2c135e 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ # Maven # ######### target +\$\{env.JBOSS_HOME\} # OS generated files # ###################### diff --git a/core/jdiameter/api/src/main/java/org/jdiameter/api/AvpSet.java b/core/jdiameter/api/src/main/java/org/jdiameter/api/AvpSet.java index a2af490a8..44b5a3570 100644 --- a/core/jdiameter/api/src/main/java/org/jdiameter/api/AvpSet.java +++ b/core/jdiameter/api/src/main/java/org/jdiameter/api/AvpSet.java @@ -53,6 +53,8 @@ * Serializable interface allows use this class in SLEE Event objects * * @author erick.svenson@yahoo.com + * @author Grzegorz Figiel [ProIDS] + * * @version 1.5.1 Final */ public interface AvpSet extends Iterable, Serializable, Wrapper { @@ -94,6 +96,21 @@ public interface AvpSet extends Iterable, Serializable, Wrapper { */ AvpSet getAvps(int avpCode, long vendorId); + /** + * Get position of the first instance of the AVP + * @param avpCode code of the Avp + * @return index (position) of the first occurrence of the Avp. -1 in case Avp is not found + */ + int getAvpIndex(int avpCode); + + /** + * Get position of the first instance of the AVP + * @param avpCode code of the Avp + * @param vendorId vendorId of the Avp + * @return index (position) of the first occurrence of the Avp. -1 in case Avp is not found + */ + int getAvpIndex(int avpCode, long vendorId); + /** * Remove AVPs with avpCode * @param avpCode code of Avp diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java index 800fe3f5c..767e71b7c 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java @@ -68,6 +68,7 @@ * @author erick.svenson@yahoo.com * @author Alexandre Mendonca * @author Bartosz Baranowski + * @author Grzegorz Figiel [ProIDS] */ class AvpSetImpl implements AvpSet { @@ -132,6 +133,26 @@ public AvpSet getAvps(int avpCode, long vendorId) { return result; } + @Override + public int getAvpIndex(int avpCode) { + for (Avp avp : this.avps) { + if (avp.getCode() == avpCode) { + return this.avps.indexOf(avp); + } + } + return -1; + } + + @Override + public int getAvpIndex(int avpCode, long vendorId) { + for (Avp avp : this.avps) { + if (avp.getCode() == avpCode && avp.getVendorId() == vendorId) { + return this.avps.indexOf(avp); + } + } + return -1; + } + @Override public AvpSet removeAvp(int avpCode) { return removeAvp(avpCode, 0); @@ -219,7 +240,7 @@ public Avp insertAvp(int index, int avpCode, long value, boolean mFlag, boolean public Avp insertAvp(int index, int avpCode, long value, long vndId, boolean mFlag, boolean pFlag, boolean asUnsigned) { int flags = ((vndId != 0 ? 0x80 : 0) | (mFlag ? 0x40 : 0) | (pFlag ? 0x20 : 0)); Avp res = new AvpImpl(avpCode, flags, vndId, asUnsigned ? parser.intU32ToBytes(value) : parser.int64ToBytes(value)); - this.avps.add(res); + this.avps.add(index, res); return res; } From 1c87b5c391fb2be2ae62fdc26d5152b27ad3a32b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Fri, 31 Mar 2017 11:59:05 +0100 Subject: [PATCH 40/75] Fixing checkstyle and dictionary issues --- .../client/impl/parser/AvpSetImpl.java | 2 +- core/mux/common/config/dictionary.xml | 265 +++++++++++------- .../src/main/resources/dictionary.xml | 251 +++++++++++++++++ .../org/example/client/dictionary.xml | 251 +++++++++++++++++ .../org/example/server/dictionary.xml | 251 +++++++++++++++++ .../core/src/main/resources/dictionary.xml | 251 +++++++++++++++++ .../src/test/resources/dictionary.xml | 251 +++++++++++++++++ .../tests/src/test/resources/dictionary.xml | 251 +++++++++++++++++ 8 files changed, 1663 insertions(+), 110 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java index 767e71b7c..a20e719d7 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpSetImpl.java @@ -240,7 +240,7 @@ public Avp insertAvp(int index, int avpCode, long value, boolean mFlag, boolean public Avp insertAvp(int index, int avpCode, long value, long vndId, boolean mFlag, boolean pFlag, boolean asUnsigned) { int flags = ((vndId != 0 ? 0x80 : 0) | (mFlag ? 0x40 : 0) | (pFlag ? 0x20 : 0)); Avp res = new AvpImpl(avpCode, flags, vndId, asUnsigned ? parser.intU32ToBytes(value) : parser.int64ToBytes(value)); - this.avps.add(index, res); + this.avps.add(index, res); return res; } diff --git a/core/mux/common/config/dictionary.xml b/core/mux/common/config/dictionary.xml index 9aabf9e91..26c3d6438 100644 --- a/core/mux/common/config/dictionary.xml +++ b/core/mux/common/config/dictionary.xml @@ -38,7 +38,7 @@ - + @@ -3245,12 +3245,12 @@ - - - - - - + + + + + + @@ -3375,106 +3375,140 @@ + + + + - - - - - + + + + + + + + + + + - - - - - + + + + + + + - - - + + + + + - - - - + + + + + + + + + + + + + + + + + + + + + + + + @@ -3482,16 +3516,21 @@ + - - - + + + + + - - - + + + + + @@ -3500,111 +3539,119 @@ + - - - + + + + + - - - - - - + + + + + + + + + + - - - + + + + @@ -7773,7 +7820,7 @@ - + @@ -7820,4 +7867,4 @@ - + \ No newline at end of file diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 91bf1acf5..26c3d6438 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -38,6 +38,7 @@ + @@ -2103,6 +2104,7 @@ + @@ -3243,6 +3245,13 @@ + + + + + + + @@ -3329,6 +3338,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/guide1/src/main/resources/org/example/client/dictionary.xml b/examples/guide1/src/main/resources/org/example/client/dictionary.xml index 91bf1acf5..26c3d6438 100644 --- a/examples/guide1/src/main/resources/org/example/client/dictionary.xml +++ b/examples/guide1/src/main/resources/org/example/client/dictionary.xml @@ -38,6 +38,7 @@ + @@ -2103,6 +2104,7 @@ + @@ -3243,6 +3245,13 @@ + + + + + + + @@ -3329,6 +3338,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/guide1/src/main/resources/org/example/server/dictionary.xml b/examples/guide1/src/main/resources/org/example/server/dictionary.xml index 91bf1acf5..26c3d6438 100644 --- a/examples/guide1/src/main/resources/org/example/server/dictionary.xml +++ b/examples/guide1/src/main/resources/org/example/server/dictionary.xml @@ -38,6 +38,7 @@ + @@ -2103,6 +2104,7 @@ + @@ -3243,6 +3245,13 @@ + + + + + + + @@ -3329,6 +3338,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testsuite/load/core/src/main/resources/dictionary.xml b/testsuite/load/core/src/main/resources/dictionary.xml index 91bf1acf5..26c3d6438 100644 --- a/testsuite/load/core/src/main/resources/dictionary.xml +++ b/testsuite/load/core/src/main/resources/dictionary.xml @@ -38,6 +38,7 @@ + @@ -2103,6 +2104,7 @@ + @@ -3243,6 +3245,13 @@ + + + + + + + @@ -3329,6 +3338,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testsuite/test-framework/src/test/resources/dictionary.xml b/testsuite/test-framework/src/test/resources/dictionary.xml index 91bf1acf5..26c3d6438 100644 --- a/testsuite/test-framework/src/test/resources/dictionary.xml +++ b/testsuite/test-framework/src/test/resources/dictionary.xml @@ -38,6 +38,7 @@ + @@ -2103,6 +2104,7 @@ + @@ -3243,6 +3245,13 @@ + + + + + + + @@ -3329,6 +3338,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/testsuite/tests/src/test/resources/dictionary.xml b/testsuite/tests/src/test/resources/dictionary.xml index 91bf1acf5..26c3d6438 100644 --- a/testsuite/tests/src/test/resources/dictionary.xml +++ b/testsuite/tests/src/test/resources/dictionary.xml @@ -38,6 +38,7 @@ + @@ -2103,6 +2104,7 @@ + @@ -3243,6 +3245,13 @@ + + + + + + + @@ -3329,6 +3338,243 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 6d48af3e2b3d30990910ad87f32d2a3ed3231ce2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Mon, 3 Apr 2017 16:19:01 +0100 Subject: [PATCH 41/75] Fix release script, use RELEASE_VERSION as dep for RAs --- release/build.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/release/build.xml b/release/build.xml index 3c110890e..65ed84aae 100644 --- a/release/build.xml +++ b/release/build.xml @@ -111,14 +111,14 @@ Checkout Diameter Core (jDiameter @tag:${CORE_JDIAMETER_TAG}) - + Checkout Diameter SLEE Diameter Package v${SLEE_DIAMETER_PACKAGE_VERSION} - + @@ -128,7 +128,7 @@ Checkout Diameter Example @{example.name} v${EXAMPLE_JAINSLEE_@{example.name}_VERSION} - + @@ -137,7 +137,7 @@ Checkout Diameter RHQ Plugin - + @@ -148,15 +148,15 @@ - + Building JAIN SLEE Diameter Package v${SLEE_DIAMETER_PACKAGE_VERSION} - - + + @@ -164,7 +164,7 @@ Build Diameter @{example.name} Example - + @@ -177,11 +177,11 @@ - + Build Diameter RHQ Plugin Documentation - + @@ -430,7 +430,7 @@ - + @@ -473,7 +473,7 @@ - + From b73773b166bc0eb46f0abedd5c9cf98ce2ae32aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Fri, 7 Apr 2017 19:23:44 +0100 Subject: [PATCH 42/75] Add support for routing answers through DRA/Proxy Fixes #73 --- .../client/impl/router/RouterImpl.java | 100 ++++++++++++++---- .../server/impl/MutablePeerTableImpl.java | 9 ++ 2 files changed, 89 insertions(+), 20 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java index 09d4cfee1..c0fe2bc05 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java @@ -257,8 +257,25 @@ public void registerRequestRouteInfo(IRequest request) { long hopByHopId = request.getHopByHopIdentifier(); Avp hostAvp = request.getAvps().getAvp(Avp.ORIGIN_HOST); Avp realmAvp = request.getAvps().getAvp(Avp.ORIGIN_REALM); - AnswerEntry entry = new AnswerEntry(hopByHopId, hostAvp != null ? hostAvp.getDiameterIdentity() : null, - realmAvp != null ? realmAvp.getDiameterIdentity() : null); + + AnswerEntry entry; + AvpSet rrAvps = request.getAvps().getAvps(Avp.ROUTE_RECORD); + if (rrAvps.size() > 0) { + logger.debug("Found [{}] Route-Record AVP(s) in Request with HbH [{}], storing them for copying and routing.", + rrAvps.size(), request.getHopByHopIdentifier()); + ArrayList rrStrings = new ArrayList(); + for(Avp rrAvp : rrAvps) { + String rrAvpHost = rrAvp.getDiameterIdentity(); + logger.trace("Route-Record in Request with HbH [{}]: [{}]", request.getHopByHopIdentifier(), rrAvpHost); + rrStrings.add(rrAvpHost); + } + entry = new AnswerEntry(hopByHopId, hostAvp != null ? hostAvp.getDiameterIdentity() : null, + realmAvp != null ? realmAvp.getDiameterIdentity() : null, rrStrings); + } + else { + entry = new AnswerEntry(hopByHopId, hostAvp != null ? hostAvp.getDiameterIdentity() : null, + realmAvp != null ? realmAvp.getDiameterIdentity() : null); + } int s = requestEntryMap.size(); // PCB added logging @@ -312,10 +329,10 @@ private String makeRoutingKey(Message message) { .append(message.getHopByHopIdentifier()).toString(); } - @Override - public String[] getRequestRouteInfo(IMessage message) { + private String[] getRequestRouteInfoAndCopyProxyAvps(IMessage message, boolean copy) { if (REQUEST_TABLE_SIZE == 0) { return ((MessageImpl) message).getRoutingInfo(); // using answer stored routing info + // TODO: Handle copy Proxy AVPs in this case... } // using request table @@ -325,7 +342,18 @@ public String[] getRequestRouteInfo(IMessage message) { if (logger.isDebugEnabled()) { logger.debug("getRequestRouteInfo found host [{}] and realm [{}] for Message key Id [{}]", new Object[]{ans.getHost(), ans.getRealm(), messageKey}); } - return new String[] {ans.getHost(), ans.getRealm()}; + if (ans.getRouteRecords() != null && ans.getRouteRecords().size() > 0) { + AvpSet msgRouteRecords = message.getAvps().getAvps(Avp.ROUTE_RECORD); + if (msgRouteRecords.size() > 0) { + logger.debug("We had Route-Records to insert but the message already has some... not doing anything"); + } + else { + for (String rr : ans.getRouteRecords()) { + message.getAvps().addAvp(Avp.ROUTE_RECORD, rr, true); + } + } + } + return new String[] { ans.getHost(), ans.getRealm() }; } else { if (logger.isWarnEnabled()) { @@ -335,6 +363,11 @@ public String[] getRequestRouteInfo(IMessage message) { } } + @Override + public String[] getRequestRouteInfo(IMessage message) { + return getRequestRouteInfoAndCopyProxyAvps(message, false); + } + //PCB added @Override public void garbageCollectRequestRouteInfo(IMessage message) { @@ -375,24 +408,39 @@ public IPeer getPeer(IMessage message, IPeerTable manager) throws RouteException } else { //answer, search - info = getRequestRouteInfo(message); - if (info != null) { - destHost = info[0]; - destRealm = info[1]; - logger.debug("Message is an answer. Host is [{}] and Realm is [{}] as per hopbyhop info from request", destHost, destRealm); - if (destRealm == null) { - logger.warn("Destination-Realm was null for hopbyhop id " + message.getHopByHopIdentifier()); - } + info = getRequestRouteInfoAndCopyProxyAvps(message, true); + + // check for route-record AVPs + AvpSet rrAvps = message.getAvps().getAvps(Avp.ROUTE_RECORD); + if (rrAvps.size() > 0) { + // we want to send it back to the last + Avp destHostAvp = rrAvps.getAvpByIndex(rrAvps.size()-1); + logger.debug("Got Route-Record AVP to route the answer with HbH [{}] to: [{}]", message.getHopByHopIdentifier(), destHostAvp.getDiameterIdentity()); + + String matchedRealmName = this.realmTable.getRealmForPeer(destHostAvp.getDiameterIdentity()); + logger.debug("Got a Realm for the answer with HbH [{}] routing via Route-Record: [{}]", message.getHopByHopIdentifier(), matchedRealmName); + + matchedRealm = (IRealm) this.realmTable.matchRealm((IAnswer) message, matchedRealmName); } else { - logger.debug("No Host and realm found based on hopbyhop id of the answer associated request"); - } - //FIXME: if no info, should not send it ? - //FIXME: add strict deff in route back table so stack does not have to lookup? - if (logger.isDebugEnabled()) { - logger.debug("Looking up peer for answer: [{}], DestHost=[{}], DestRealm=[{}]", new Object[] {message, destHost, destRealm}); + if (info != null) { + destHost = info[0]; + destRealm = info[1]; + logger.debug("Message is an answer. Host is [{}] and Realm is [{}] as per hopbyhop info from request", destHost, destRealm); + if (destRealm == null) { + logger.warn("Destination-Realm was null for hopbyhop id " + message.getHopByHopIdentifier()); + } + } + else { + logger.debug("No Host and realm found based on hopbyhop id of the answer associated request"); + } + //FIXME: if no info, should not send it ? + //FIXME: add strict deff in route back table so stack does not have to lookup? + if (logger.isDebugEnabled()) { + logger.debug("Looking up peer for answer: [{}], DestHost=[{}], DestRealm=[{}]", new Object[] {message, destHost, destRealm}); + } + matchedRealm = (IRealm) this.realmTable.matchRealm((IAnswer) message, destRealm); } - matchedRealm = (IRealm) this.realmTable.matchRealm(message, destRealm); } // IPeer peer = getPeerPredProcessing(message, destRealm, destHost); @@ -906,6 +954,7 @@ protected class AnswerEntry { final long createTime = System.nanoTime(); Long hopByHopId; String host, realm; + ArrayList routeRecords; public AnswerEntry(Long hopByHopId) { this.hopByHopId = hopByHopId; @@ -917,6 +966,13 @@ public AnswerEntry(Long hopByHopId, String host, String realm) throws InternalEr this.realm = realm; } + public AnswerEntry(Long hopByHopId, String host, String realm, ArrayList routeRecords) throws InternalError { + this.hopByHopId = hopByHopId; + this.host = host; + this.realm = realm; + this.routeRecords = routeRecords; + } + public long getCreateTime() { return createTime; } @@ -933,6 +989,10 @@ public String getRealm() { return realm; } + public ArrayList getRouteRecords() { + return routeRecords; + } + @Override public int hashCode() { return super.hashCode(); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/MutablePeerTableImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/MutablePeerTableImpl.java index 895f52bb9..470b7f257 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/MutablePeerTableImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/MutablePeerTableImpl.java @@ -513,6 +513,15 @@ public void messageReceived(String connKey, IMessage message) { metaData, config, null, fsmFactory, transportFactory, parser, statisticFactory, concurrentFactory); logger.debug("Created new peer instance [{}] and adding to peer table", peer); peer.setRealm(realm); + + Collection realms = router.getRealmTable().getRealms(realm); + for (Realm r : realms) { + if (r.getName().equals(realm)) { + logger.debug("Found the realm [{}] for the new peer [{}], adding it to it", realm, peer); + ((IRealm) r).addPeerName(host); + } + } + appendPeerToPeerTable(peer); logger.debug("Handle [{}] message on peer [{}]", message, peer); peer.handleMessage(message.isRequest() ? EventTypes.CER_EVENT : EventTypes.CER_EVENT, message, connKey); From 13a05d19fd3ef1d97206528ff31feed22c733820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Wed, 12 Apr 2017 10:46:30 +0100 Subject: [PATCH 43/75] Initial support for Travis CI --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..252825fd0 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: java + +# Enable container-based infrastructure, see https://docs.travis-ci.com/user/ci-environment/ +sudo: false From 01d03062f00ba245873d864134dc73b265edb2de Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Tue, 18 Apr 2017 16:59:40 +0300 Subject: [PATCH 44/75] Minor fixes in pom. --- core/jdiameter-ha/pom.xml | 15 +++++++++------ core/mux/pom.xml | 3 +++ core/mux/sar-jboss-5/pom.xml | 15 +++++++++++---- core/mux/sar-wildfly/pom.xml | 2 +- core/pom.xml | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index 4d867c747..6a01551c5 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -51,9 +51,12 @@ - 1.5.9.0-build538-SNAPSHOT - 1.15.11 - 3.0.0.8 + + + 1.15.26 + + 3.0.0.10 + 8.2.4.Final 3.3.0.Final @@ -108,19 +111,19 @@ org.restcomm.cluster core ${restcomm.cluster.version} - provided + org.restcomm.cluster cache ${restcomm.cluster.version} - provided + org.restcomm.cluster timers ${restcomm.cluster.version} - provided + diff --git a/core/mux/pom.xml b/core/mux/pom.xml index dac1e8c1f..9a4d01a2c 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -15,8 +15,11 @@ + + diff --git a/core/mux/sar-jboss-5/pom.xml b/core/mux/sar-jboss-5/pom.xml index 03bab9ea9..3ad585cde 100644 --- a/core/mux/sar-jboss-5/pom.xml +++ b/core/mux/sar-jboss-5/pom.xml @@ -116,12 +116,19 @@ org.jboss.naming:jnp-client org.jboss.security:jbosssx-client org.jboss.security:jboss-security-spi - + picocontainer:picocontainer + --> xml-apis:xml-apis - + + org.restcomm.cluster:core + org.restcomm.cluster:cache + org.restcomm.cluster:timers diff --git a/core/mux/sar-wildfly/pom.xml b/core/mux/sar-wildfly/pom.xml index 785da74b1..d61e2f312 100644 --- a/core/mux/sar-wildfly/pom.xml +++ b/core/mux/sar-wildfly/pom.xml @@ -124,7 +124,7 @@ org.jboss.jbossas:jboss-as-j2se oswego-concurrent:concurrent org.jboss.bootstrap:jboss-bootstrap - org.jboss.logging:jboss-logging + org.jboss.jbossas:jboss-as-system org.jboss.jbossas:jboss-as-system-jmx org.jboss.aop:jboss-aop diff --git a/core/pom.xml b/core/pom.xml index 985991033..933a44e2e 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -22,7 +22,7 @@ - 1.5.8 + 1.7.2 2.13.5 1.5.5 From 18a9cc249d7acb558214a46c673e19a9f524c4e1 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Tue, 18 Apr 2017 17:01:23 +0300 Subject: [PATCH 45/75] Commenting org.jboss.logging log in extension for Wildfly. --- .../diameter/extension/DiameterMuxService.java | 13 +++++-------- .../mobicents/diameter/extension/SubsystemAdd.java | 6 +++--- .../diameter/extension/SubsystemRemove.java | 4 ++-- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java index 6551acbce..51488d2ae 100644 --- a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java +++ b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/DiameterMuxService.java @@ -1,19 +1,16 @@ package org.mobicents.diameter.extension; -import org.jboss.logging.Logger; +//import org.jboss.logging.Logger; import org.jboss.msc.service.*; import org.jboss.msc.value.InjectedValue; import org.mobicents.diameter.stack.DiameterStackMultiplexerAS7; -import org.mobicents.diameter.stack.DiameterStackMultiplexerAS7MBean; import javax.management.MBeanServer; -import javax.management.NotCompliantMBeanException; import javax.management.ObjectName; -import javax.management.StandardMBean; public class DiameterMuxService implements Service { - private final Logger log = Logger.getLogger(DiameterMuxService.class); + //private final Logger log = Logger.getLogger(DiameterMuxService.class); public static ServiceName getServiceName() { return ServiceName.of("restcomm","diameter-mux"); @@ -33,7 +30,7 @@ public DiameterMuxService getValue() throws IllegalStateException, IllegalArgume @Override public void start(StartContext context) throws StartException { - log.info("Starting DiameterMuxService"); + //log.info("Starting DiameterMuxService"); diameterMuxBean = new DiameterStackMultiplexerAS7(); //try { @@ -49,7 +46,7 @@ public void start(StartContext context) throws StartException { @Override public void stop(StopContext context) { - log.info("Stopping DiameterMuxService"); + //log.info("Stopping DiameterMuxService"); diameterMuxBean.stopService(); unregisterMBean(DiameterStackMultiplexerAS7.OBJECT_NAME); @@ -67,7 +64,7 @@ private void unregisterMBean(String name) { try { getMbeanServer().getValue().unregisterMBean(new ObjectName(name)); } catch (Throwable e) { - log.error("failed to unregister mbean", e); + //log.error("failed to unregister mbean", e); } } } diff --git a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java index 498c14e0b..1147341b6 100644 --- a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java +++ b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemAdd.java @@ -8,7 +8,7 @@ import org.jboss.as.controller.ServiceVerificationHandler; import org.jboss.as.jmx.MBeanServerService; import org.jboss.dmr.ModelNode; -import org.jboss.logging.Logger; +//import org.jboss.logging.Logger; import org.jboss.msc.service.ServiceController; import org.jboss.msc.service.ServiceName; @@ -24,7 +24,7 @@ class SubsystemAdd extends AbstractBoottimeAddStepHandler { static final SubsystemAdd INSTANCE = new SubsystemAdd(); - private final Logger log = Logger.getLogger(SubsystemAdd.class); + //private final Logger log = Logger.getLogger(SubsystemAdd.class); private SubsystemAdd() { } @@ -32,7 +32,7 @@ private SubsystemAdd() { /** {@inheritDoc} */ @Override protected void populateModel(ModelNode operation, ModelNode model) throws OperationFailedException { - log.info("Populating the model"); + //log.info("Populating the model"); model.setEmptyObject(); } diff --git a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java index 5df6509c5..409bcccb4 100644 --- a/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java +++ b/core/mux/sar-wildfly/src/main/java/org/mobicents/diameter/extension/SubsystemRemove.java @@ -4,7 +4,7 @@ import org.jboss.as.controller.OperationContext; import org.jboss.as.controller.OperationFailedException; import org.jboss.dmr.ModelNode; -import org.jboss.logging.Logger; +//import org.jboss.logging.Logger; import org.jboss.msc.service.ServiceName; /** @@ -16,7 +16,7 @@ class SubsystemRemove extends AbstractRemoveStepHandler { static final SubsystemRemove INSTANCE = new SubsystemRemove(); - private final Logger log = Logger.getLogger(SubsystemRemove.class); + //private final Logger log = Logger.getLogger(SubsystemRemove.class); private SubsystemRemove() { } From 9a7f36900b039a752db25c191d75ea046288dfe8 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Tue, 18 Apr 2017 17:02:14 +0300 Subject: [PATCH 46/75] Excluding Node from imports. --- .../ha/common/AppSessionDataReplicatedImpl.java | 15 ++++++++++----- .../ha/common/AppSessionDataReplicatedImpl.java | 15 ++++++++++----- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java index 56ba70d3d..97a7d9e69 100644 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java @@ -43,7 +43,6 @@ package org.mobicents.diameter.impl.ha.common; import org.jboss.cache.Fqn; -import org.jboss.cache.Node; import org.jdiameter.api.ApplicationId; import org.jdiameter.api.app.AppSession; import org.jdiameter.common.api.app.IAppSessionData; @@ -76,13 +75,19 @@ public AppSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicents } public static void setAppSessionIface(ClusteredCacheData ccd, Class iface) { - Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); - n.put(SIFACE, iface); + //Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); + //n.put(SIFACE, iface); + ccd.getMobicentsCache().getJBossCache() + .getNode(ccd.getNodeFqn()) + .put(SIFACE, iface); } public static Class getAppSessionIface(MobicentsCache mcCache, String sessionId) { - Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); - return (Class) n.get(SIFACE); + //Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); + //return (Class) n.get(SIFACE); + return (Class) mcCache.getJBossCache() + .getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)) + .get(SIFACE); } @Override diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java index 7574322d2..8b1cfc279 100644 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java @@ -43,7 +43,6 @@ package org.mobicents.diameter.impl.ha.common; import org.infinispan.tree.Fqn; -import org.infinispan.tree.Node; import org.jdiameter.api.ApplicationId; import org.jdiameter.api.app.AppSession; import org.jdiameter.common.api.app.IAppSessionData; @@ -76,13 +75,19 @@ public AppSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicents } public static void setAppSessionIface(ClusteredCacheData ccd, Class iface) { - Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); - n.put(SIFACE, iface); + //Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); + //n.put(SIFACE, iface); + ccd.getMobicentsCache().getJBossCache() + .getNode(ccd.getNodeFqn()) + .put(SIFACE, iface); } public static Class getAppSessionIface(MobicentsCache mcCache, String sessionId) { - Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); - return (Class) n.get(SIFACE); + //Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); + //return (Class) n.get(SIFACE); + return (Class) mcCache.getJBossCache() + .getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)) + .get(SIFACE); } @Override From 046be6d2ef4196a59341e20b2b6154136241f2ac Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Wed, 19 Apr 2017 12:56:39 +0300 Subject: [PATCH 47/75] Adding diameter-ha-impl as single module. --- core/jdiameter-ha/impl/pom.xml | 52 +++ .../ClientAccSessionDataReplicatedImpl.java | 260 +++++++++++++ .../ClientAuthSessionDataReplicatedImpl.java | 243 ++++++++++++ .../ClientCCASessionDataReplicatedImpl.java | 327 ++++++++++++++++ .../ClientCxDxSessionDataReplicatedImpl.java | 84 +++++ .../gx/ClientGxSessionDataReplicatedImpl.java | 329 ++++++++++++++++ .../rf/ClientRfSessionDataReplicatedImpl.java | 249 ++++++++++++ .../ro/ClientRoSessionDataReplicatedImpl.java | 326 ++++++++++++++++ .../rx/ClientRxSessionDataReplicatedImpl.java | 141 +++++++ .../ClientS13SessionDataReplicatedImpl.java | 61 +++ .../sh/ShClientSessionDataReplicatedImpl.java | 81 ++++ .../common/AppSessionDataReplicatedImpl.java | 132 +++++++ .../acc/AccReplicatedSessionDataFactory.java | 94 +++++ .../AuthReplicatedSessionDataFactory.java | 92 +++++ .../cca/CCAReplicatedSessionDataFactory.java | 94 +++++ .../CxDxReplicatedSessionDataFactory.java | 95 +++++ .../cxdx/CxDxSessionDataReplicatedImpl.java | 179 +++++++++ .../gx/GxReplicatedSessionDataFactory.java | 94 +++++ .../rf/RfReplicatedSessionDataFactory.java | 94 +++++ .../ro/RoReplicatedSessionDataFactory.java | 94 +++++ .../rx/RxReplicatedSessionDataFactory.java | 94 +++++ .../s13/S13ReplicatedSessionDataFactory.java | 72 ++++ .../s13/S13SessionDataReplicatedImpl.java | 156 ++++++++ .../sh/ShReplicatedSessionDataFactory.java | 93 +++++ .../ha/data/ReplicatedSessionDatasource.java | 354 ++++++++++++++++++ .../ServerAccSessionDataReplicatedImpl.java | 191 ++++++++++ .../ServerAuthSessionDataReplicatedImpl.java | 191 ++++++++++ .../ServerCCASessionDataReplicatedImpl.java | 180 +++++++++ .../ServerCxDxSessionDataReplicatedImpl.java | 84 +++++ .../gx/ServerGxSessionDataReplicatedImpl.java | 182 +++++++++ .../rf/ServerRfSessionDataReplicatedImpl.java | 211 +++++++++++ .../ro/ServerRoSessionDataReplicatedImpl.java | 180 +++++++++ .../rx/ServerRxSessionDataReplicatedImpl.java | 144 +++++++ .../ServerS13SessionDataReplicatedImpl.java | 61 +++ .../sh/ShServerSessionDataReplicatedImpl.java | 81 ++++ .../impl/ha/timer/DiameterTimerTaskData.java | 77 ++++ .../ha/timer/ReplicatedTimerFacilityImpl.java | 147 ++++++++ 37 files changed, 5619 insertions(+) create mode 100644 core/jdiameter-ha/impl/pom.xml create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java create mode 100644 core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java diff --git a/core/jdiameter-ha/impl/pom.xml b/core/jdiameter-ha/impl/pom.xml new file mode 100644 index 000000000..fd891cfc8 --- /dev/null +++ b/core/jdiameter-ha/impl/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + + org.mobicents.diameter + jdiameter-ha-parent + 1.7.0-SNAPSHOT + ../pom.xml + + + jdiameter-ha-impl + + Restcomm :: Diameter Stack HA :: ${project.artifactId} + + + + ${project.groupId} + jdiameter-ha-api + ${project.version} + + + + org.mobicents.diameter + jdiameter-impl + + + + + org.jboss.logging + jboss-logging-log4j + provided + + + + + org.jboss.cluster + jboss-ha-server-cache-jbc + + + + org.restcomm.cluster + cache + + + + org.restcomm.cluster + timers + + + + diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java new file mode 100644 index 000000000..8f120a4c7 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java @@ -0,0 +1,260 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.acc; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.acc.ClientAccSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.acc.IClientAccSessionData; +import org.jdiameter.common.api.app.acc.ClientAccSessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAccSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientAccSessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String INTERIM_TIMERID = "INTERIM_TIMERID"; + private static final String DEST_HOST = "DEST_HOST"; + private static final String DEST_REALM = "DEST_REALM"; + private static final String BUFFER = "BUFFER"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientAccSession.class); + setClientAccSessionState(ClientAccSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setClientAccSessionState + * (org.jdiameter.common.api.app.acc.ClientAccSessionState) + */ + @Override + public void setClientAccSessionState(ClientAccSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getClientAccSessionState() + */ + @Override + public ClientAccSessionState getClientAccSessionState() { + if (exists()) { + return (ClientAccSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setInterimTimerId(java.io.Serializable) + */ + @Override + public void setInterimTimerId(Serializable tid) { + if (exists()) { + getNode().put(INTERIM_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getInterimTimerId() + */ + @Override + public Serializable getInterimTimerId() { + if (exists()) { + return (Serializable) getNode().get(INTERIM_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationHost(java.lang.String) + */ + @Override + public void setDestinationHost(String destHost) { + if (exists()) { + getNode().put(DEST_HOST, destHost); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationHost() + */ + @Override + public String getDestinationHost() { + if (exists()) { + return (String) getNode().get(DEST_HOST); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationRealm(java.lang.String) + */ + @Override + public void setDestinationRealm(String destRealm) { + if (exists()) { + getNode().put(DEST_REALM, destRealm); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationRealm() + */ + @Override + public String getDestinationRealm() { + if (exists()) { + return (String) getNode().get(DEST_REALM); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java new file mode 100644 index 000000000..385b93ff0 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java @@ -0,0 +1,243 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.auth; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.auth.ClientAuthSession; +import org.jdiameter.client.impl.app.auth.IClientAuthSessionData; +import org.jdiameter.common.api.app.auth.ClientAuthSessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAuthSessionData { + + private static final String STATE = "STATE"; + private static final String DESTINATION_HOST = "DESTINATION_HOST"; + private static final String DESTINATION_REALM = "DESTINATION_REALM"; + private static final String STATELESS = "STATELESS"; + private static final String TS_TIMERID = "TS_TIMERID"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientAuthSession.class); + setClientAuthSessionState(ClientAuthSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setClientAuthSessionState(org.jdiameter.common.api.app.auth. + * ClientAuthSessionState) + */ + @Override + public void setClientAuthSessionState(ClientAuthSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getClientAuthSessionState() + */ + @Override + public ClientAuthSessionState getClientAuthSessionState() { + if (exists()) { + return (ClientAuthSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setStateless(boolean) + */ + @Override + public void setStateless(boolean b) { + if (exists()) { + getNode().put(STATELESS, b); + } + else { + throw new IllegalStateException(); + } + + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationHost() + */ + @Override + public String getDestinationHost() { + if (exists()) { + return (String) getNode().get(DESTINATION_HOST); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationHost(java.lang.String) + */ + @Override + public void setDestinationHost(String host) { + if (exists()) { + getNode().put(DESTINATION_HOST, host); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationRealm() + */ + @Override + public String getDestinationRealm() { + if (exists()) { + return (String) getNode().get(DESTINATION_REALM); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationRealm(java.lang.String) + */ + @Override + public void setDestinationRealm(String realm) { + if (exists()) { + getNode().put(DESTINATION_REALM, realm); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java new file mode 100644 index 000000000..7b3178c36 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java @@ -0,0 +1,327 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.cca; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.cca.ClientCCASession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.cca.IClientCCASessionData; +import org.jdiameter.common.api.app.cca.ClientCCASessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientCCASessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientCCASessionDataReplicatedImpl.class); + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + private static final String TXTIMER_ID = "TXTIMER_ID"; + private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; + private static final String BUFFER = "BUFFER"; + private static final String GRA = "GRA"; + private static final String GDDFH = "GDDFH"; + private static final String GCCFH = "GCCFH"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientCCASession.class); + setClientCCASessionState(ClientCCASessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ClientCCASessionState getClientCCASessionState() { + if (exists()) { + return (ClientCCASessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientCCASessionState(ClientCCASessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTxTimerId() { + if (exists()) { + return (Serializable) getNode().get(TXTIMER_ID); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerId(Serializable txTimerId) { + if (exists()) { + getNode().put(TXTIMER_ID, txTimerId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getTxTimerRequest() { + if (exists()) { + + byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate Tx Timer Request from buffer."); + return null; + } + } + else { + return null; + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerRequest(Request txTimerRequest) { + if (exists()) { + if (txTimerRequest != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); + getNode().put(TXTIMER_REQUEST, data); + } + catch (ParseException e) { + logger.error("Unable to encode Tx Timer Request to buffer."); + } + } + else { + getNode().remove(TXTIMER_REQUEST); + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + @Override + public int getGatheredRequestedAction() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GRA)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredRequestedAction(int gatheredRequestedAction) { + if (exists()) { + getNode().put(GRA, gatheredRequestedAction); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredCCFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GCCFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredCCFH(int gatheredCCFH) { + if (exists()) { + getNode().put(GCCFH, gatheredCCFH); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredDDFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GDDFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredDDFH(int gatheredDDFH) { + if (exists()) { + getNode().put(GDDFH, gatheredDDFH); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..b14e10625 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java @@ -0,0 +1,84 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.cxdx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.cxdx.ClientCxDxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.app.cxdx.IClientCxDxSessionData; +import org.jdiameter.common.api.app.cxdx.CxDxSessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IClientCxDxSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ClientCxDxSession.class); + setCxDxSessionState(CxDxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..3237cadd2 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java @@ -0,0 +1,329 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.gx; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.gx.ClientGxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.gx.IClientGxSessionData; +import org.jdiameter.common.api.app.gx.ClientGxSessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientGxSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientGxSessionDataReplicatedImpl.class); + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + private static final String TXTIMER_ID = "TXTIMER_ID"; + private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; + private static final String BUFFER = "BUFFER"; + private static final String GRA = "GRA"; + private static final String GDDFH = "GDDFH"; + private static final String GCCFH = "GCCFH"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientGxSession.class); + setClientGxSessionState(ClientGxSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ClientGxSessionState getClientGxSessionState() { + if (exists()) { + return (ClientGxSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientGxSessionState(ClientGxSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTxTimerId() { + if (exists()) { + return (Serializable) getNode().get(TXTIMER_ID); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerId(Serializable txTimerId) { + if (exists()) { + getNode().put(TXTIMER_ID, txTimerId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getTxTimerRequest() { + if (exists()) { + + byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate Tx Timer Request from buffer."); + return null; + } + } + else { + return null; + } + + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerRequest(Request txTimerRequest) { + if (exists()) { + if (txTimerRequest != null) { + + try { + byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); + getNode().put(TXTIMER_REQUEST, data); + } + catch (ParseException e) { + logger.error("Unable to encode Tx Timer Request to buffer."); + } + } + else { + getNode().remove(TXTIMER_REQUEST); + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + @Override + public int getGatheredRequestedAction() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GRA)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredRequestedAction(int gatheredRequestedAction) { + if (exists()) { + getNode().put(GRA, gatheredRequestedAction); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredCCFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GCCFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredCCFH(int gatheredCCFH) { + if (exists()) { + getNode().put(GCCFH, gatheredCCFH); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredDDFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GDDFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredDDFH(int gatheredDDFH) { + if (exists()) { + getNode().put(GDDFH, gatheredDDFH); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java new file mode 100644 index 000000000..287236b1f --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java @@ -0,0 +1,249 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.rf; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.rf.ClientRfSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.rf.IClientRfSessionData; +import org.jdiameter.common.api.app.rf.ClientRfSessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRfSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientRfSessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String BUFFER = "BUFFER"; + private static final String TS_TIMERID = "TS_TIMERID"; + private static final String DESTINATION_HOST = "DESTINATION_HOST"; + private static final String DESTINATION_REALM = "DESTINATION_REALM"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientRfSession.class); + setClientRfSessionState(ClientRfSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public ClientRfSessionState getClientRfSessionState() { + if (exists()) { + return (ClientRfSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientRfSessionState(ClientRfSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationHost() + */ + @Override + public String getDestinationHost() { + if (exists()) { + return (String) getNode().get(DESTINATION_HOST); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationHost(java.lang.String) + */ + @Override + public void setDestinationHost(String destinationHost) { + if (exists()) { + getNode().put(DESTINATION_HOST, destinationHost); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationRealm() + */ + @Override + public String getDestinationRealm() { + if (exists()) { + return (String) getNode().get(DESTINATION_REALM); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationRealm(java.lang.String) + */ + @Override + public void setDestinationRealm(String destinationRealm) { + if (exists()) { + getNode().put(DESTINATION_REALM, destinationRealm); + } + else { + throw new IllegalStateException(); + } + } +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java new file mode 100644 index 000000000..7a7fc9978 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java @@ -0,0 +1,326 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.ro; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.api.ro.ClientRoSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.client.impl.app.ro.IClientRoSessionData; +import org.jdiameter.common.api.app.ro.ClientRoSessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRoSessionData { + + private static final Logger logger = LoggerFactory.getLogger(ClientRoSessionDataReplicatedImpl.class); + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + private static final String TXTIMER_ID = "TXTIMER_ID"; + private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; + private static final String BUFFER = "BUFFER"; + private static final String GRA = "GRA"; + private static final String GDDFH = "GDDFH"; + private static final String GCCFH = "GCCFH"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientRoSession.class); + setClientRoSessionState(ClientRoSessionState.IDLE); + } + + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ClientRoSessionState getClientRoSessionState() { + if (exists()) { + return (ClientRoSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientRoSessionState(ClientRoSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTxTimerId() { + if (exists()) { + return (Serializable) getNode().get(TXTIMER_ID); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerId(Serializable txTimerId) { + if (exists()) { + getNode().put(TXTIMER_ID, txTimerId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getTxTimerRequest() { + if (exists()) { + byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate Tx Timer Request from buffer."); + return null; + } + } + else { + return null; + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTxTimerRequest(Request txTimerRequest) { + if (exists()) { + if (txTimerRequest != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); + getNode().put(TXTIMER_REQUEST, data); + } + catch (ParseException e) { + logger.error("Unable to encode Tx Timer Request to buffer."); + } + } + else { + getNode().remove(TXTIMER_REQUEST); + } + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } + + @Override + public int getGatheredRequestedAction() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GRA)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredRequestedAction(int gatheredRequestedAction) { + if (exists()) { + getNode().put(GRA, gatheredRequestedAction); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredCCFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GCCFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredCCFH(int gatheredCCFH) { + if (exists()) { + getNode().put(GCCFH, gatheredCCFH); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public int getGatheredDDFH() { + if (exists()) { + return toPrimitive((Integer) getNode().get(GDDFH)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setGatheredDDFH(int gatheredDDFH) { + if (exists()) { + getNode().put(GDDFH, gatheredDDFH); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..a014cd505 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java @@ -0,0 +1,141 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.rx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.rx.ClientRxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.app.rx.IClientRxSessionData; +import org.jdiameter.common.api.app.rx.ClientRxSessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRxSessionData { + + private static final String EVENT_BASED = "EVENT_BASED"; + private static final String REQUEST_TYPE = "REQUEST_TYPE"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientRxSession.class); + setClientRxSessionState(ClientRxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + + @Override + public boolean isEventBased() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + } else { + throw new IllegalStateException(); + } + } + + @Override + public void setEventBased(boolean isEventBased) { + if (exists()) { + getNode().put(EVENT_BASED, isEventBased); + } else { + throw new IllegalStateException(); + } + } + + @Override + public boolean isRequestTypeSet() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + } else { + throw new IllegalStateException(); + } + } + + @Override + public void setRequestTypeSet(boolean requestTypeSet) { + if (exists()) { + getNode().put(REQUEST_TYPE, requestTypeSet); + } else { + throw new IllegalStateException(); + } + } + + @Override + public ClientRxSessionState getClientRxSessionState() { + if (exists()) { + return (ClientRxSessionState) getNode().get(STATE); + } else { + throw new IllegalStateException(); + } + } + + @Override + public void setClientRxSessionState(ClientRxSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } else { + throw new IllegalStateException(); + } + } +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java new file mode 100644 index 000000000..6ac0e588c --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java @@ -0,0 +1,61 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.client.s13; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.s13.ClientS13Session; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.impl.app.s13.IClientS13SessionData; +import org.jdiameter.common.api.app.s13.S13SessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ClientS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IClientS13SessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ClientS13Session.class); + setS13SessionState(S13SessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ClientS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java new file mode 100644 index 000000000..509d3875e --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java @@ -0,0 +1,81 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.client.sh; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.sh.ClientShSession; +import org.jdiameter.client.impl.app.sh.IShClientSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ShClientSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShClientSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ClientShSession.class); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ShClientSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java new file mode 100644 index 000000000..67359a8c4 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java @@ -0,0 +1,132 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.common.api.app.IAppSessionData; +import org.restcomm.cache.MobicentsCache; +import org.restcomm.cluster.MobicentsCluster; +import org.restcomm.cluster.cache.ClusteredCacheData; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class AppSessionDataReplicatedImpl extends ClusteredCacheData implements IAppSessionData { + + protected static final String SID = "SID"; + protected static final String APID = "APID"; + protected static final String SIFACE = "SIFACE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + */ + public AppSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + } + + public AppSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + public static void setAppSessionIface(ClusteredCacheData ccd, Class iface) { + //Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); + //n.put(SIFACE, iface); + ccd.getMobicentsCache().getJBossCache() + .getNode(ccd.getNodeFqn()) + .put(SIFACE, iface); + } + + public static Class getAppSessionIface(MobicentsCache mcCache, String sessionId) { + //Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); + //return (Class) n.get(SIFACE); + return (Class) mcCache.getJBossCache() + .getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)) + .get(SIFACE); + } + + @Override + public String getSessionId() { + return (String) super.getNodeFqn().getLastElement(); + } + + @Override + public void setApplicationId(ApplicationId applicationId) { + if (exists()) { + getNode().put(APID, applicationId); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public ApplicationId getApplicationId() { + if (exists()) { + return (ApplicationId) getNode().get(APID); + } + else { + throw new IllegalStateException(); + } + } + + // Some util methods for handling primitives + + protected boolean toPrimitive(Boolean b, boolean _default) { + return b == null ? _default : b; + } + + protected int toPrimitive(Integer i) { + return i == null ? NON_INITIALIZED : i; + } + + protected long toPrimitive(Long l) { + return l == null ? NON_INITIALIZED : l; + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java new file mode 100644 index 000000000..c051a2d83 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.acc; + +import org.jdiameter.api.acc.ClientAccSession; +import org.jdiameter.api.acc.ServerAccSession; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.acc.IAccSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.acc.ClientAccSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.acc.ServerAccSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class AccReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public AccReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IAccSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientAccSession.class)) { + ClientAccSessionDataReplicatedImpl data = + new ClientAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerAccSession.class)) { + ServerAccSessionDataReplicatedImpl data = new ServerAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java new file mode 100644 index 000000000..583c4139e --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java @@ -0,0 +1,92 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.auth; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.auth.ClientAuthSession; +import org.jdiameter.api.auth.ServerAuthSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.auth.IAuthSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.auth.ClientAuthSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.auth.ServerAuthSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class AuthReplicatedSessionDataFactory implements IAppSessionDataFactory { + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public AuthReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IAuthSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientAuthSession.class)) { + ClientAuthSessionDataReplicatedImpl data = new ClientAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + else if (clazz.equals(ServerAuthSession.class)) { + ServerAuthSessionDataReplicatedImpl data = new ServerAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java new file mode 100644 index 000000000..893620001 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.cca; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.cca.ClientCCASession; +import org.jdiameter.api.cca.ServerCCASession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.cca.ICCASessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.cca.ClientCCASessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.cca.ServerCCASessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class CCAReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public CCAReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public ICCASessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientCCASession.class)) { + ClientCCASessionDataReplicatedImpl data = + new ClientCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerCCASession.class)) { + ServerCCASessionDataReplicatedImpl data = new ServerCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java new file mode 100644 index 000000000..bfbda64ae --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java @@ -0,0 +1,95 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.cxdx; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.cxdx.ClientCxDxSession; +import org.jdiameter.api.cxdx.ServerCxDxSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.cxdx.ClientCxDxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.cxdx.ServerCxDxSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class CxDxReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public CxDxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public ICxDxSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientCxDxSession.class)) { + ClientCxDxSessionDataReplicatedImpl data = + new ClientCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerCxDxSession.class)) { + ServerCxDxSessionDataReplicatedImpl data = + new ServerCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..9922e5b89 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java @@ -0,0 +1,179 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.cxdx; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.common.api.app.cxdx.CxDxSessionState; +import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public abstract class CxDxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements ICxDxSessionData { + + private static final Logger logger = LoggerFactory.getLogger(CxDxSessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String BUFFER = "BUFFER"; + private static final String TS_TIMERID = "TS_TIMERID"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setCxDxSessionState(org.jdiameter.common.api.app.cxdx.CxDxSessionState) + */ + @Override + public void setCxDxSessionState(CxDxSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getCxDxSessionState() + */ + @Override + public CxDxSessionState getCxDxSessionState() { + if (exists()) { + return (CxDxSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java new file mode 100644 index 000000000..1a66a51cf --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.gx; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.gx.ClientGxSession; +import org.jdiameter.api.gx.ServerGxSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.gx.IGxSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.gx.ClientGxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.gx.ServerGxSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class GxReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public GxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IGxSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientGxSession.class)) { + ClientGxSessionDataReplicatedImpl data = + new ClientGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerGxSession.class)) { + ServerGxSessionDataReplicatedImpl data = new ServerGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java new file mode 100644 index 000000000..951908d0a --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.rf; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.rf.ClientRfSession; +import org.jdiameter.api.rf.ServerRfSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.rf.IRfSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.rf.ClientRfSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.rf.ServerRfSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class RfReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public RfReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IRfSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientRfSession.class)) { + ClientRfSessionDataReplicatedImpl data = + new ClientRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerRfSession.class)) { + ServerRfSessionDataReplicatedImpl data = new ServerRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java new file mode 100644 index 000000000..a3f4f4e64 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.ro; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.ro.ClientRoSession; +import org.jdiameter.api.ro.ServerRoSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.ro.IRoSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.ro.ClientRoSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.ro.ServerRoSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class RoReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public RoReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IRoSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientRoSession.class)) { + ClientRoSessionDataReplicatedImpl data = + new ClientRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerRoSession.class)) { + ServerRoSessionDataReplicatedImpl data = new ServerRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java new file mode 100644 index 000000000..d7704e58b --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java @@ -0,0 +1,94 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.rx; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.rx.ClientRxSession; +import org.jdiameter.api.rx.ServerRxSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.rx.IRxSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.rx.ClientRxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.rx.ServerRxSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class RxReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public RxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IRxSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientRxSession.class)) { + ClientRxSessionDataReplicatedImpl data = + new ClientRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerRxSession.class)) { + ServerRxSessionDataReplicatedImpl data = new ServerRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java new file mode 100644 index 000000000..3c0291153 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java @@ -0,0 +1,72 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.common.s13; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.s13.ClientS13Session; +import org.jdiameter.api.s13.ServerS13Session; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.s13.IS13SessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.s13.ClientS13SessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.s13.ServerS13SessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class S13ReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public S13ReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) + */ + @Override + public IS13SessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientS13Session.class)) { + ClientS13SessionDataReplicatedImpl data = + new ClientS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + else if (clazz.equals(ServerS13Session.class)) { + ServerS13SessionDataReplicatedImpl data = + new ServerS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java new file mode 100644 index 000000000..65020e8a7 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java @@ -0,0 +1,156 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.common.s13; + +import java.io.Serializable; +import java.nio.ByteBuffer; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.AvpDataException; +import org.jdiameter.api.Request; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.api.parser.ParseException; +import org.jdiameter.common.api.app.s13.IS13SessionData; +import org.jdiameter.common.api.app.s13.S13SessionState; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public abstract class S13SessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IS13SessionData { + + private static final Logger logger = LoggerFactory.getLogger(S13SessionDataReplicatedImpl.class); + + private static final String STATE = "STATE"; + private static final String BUFFER = "BUFFER"; + private static final String TS_TIMERID = "TS_TIMERID"; + + private IMessageParser messageParser; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster); + this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#setS13SessionState(org.jdiameter.common.api.app.s13.S13SessionState) + */ + @Override + public void setS13SessionState(S13SessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#getS13SessionState() + */ + @Override + public S13SessionState getS13SessionState() { + if (exists()) { + return (S13SessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#getTsTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.s13.IS13SessionData#setTsTimerId(java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tid) { + if (exists()) { + getNode().put(TS_TIMERID, tid); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Request getBuffer() { + byte[] data = (byte[]) getNode().get(BUFFER); + if (data != null) { + try { + return this.messageParser.createMessage(ByteBuffer.wrap(data)); + } + catch (AvpDataException e) { + logger.error("Unable to recreate message from buffer."); + return null; + } + } + else { + return null; + } + } + + @Override + public void setBuffer(Request buffer) { + if (buffer != null) { + try { + byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); + getNode().put(BUFFER, data); + } + catch (ParseException e) { + logger.error("Unable to encode message to buffer."); + } + } + else { + getNode().remove(BUFFER); + } + } +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java new file mode 100644 index 000000000..bab353670 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java @@ -0,0 +1,93 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.common.sh; + +import org.jdiameter.api.app.AppSession; +import org.jdiameter.api.sh.ClientShSession; +import org.jdiameter.api.sh.ServerShSession; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.sh.IShSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.client.sh.ShClientSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.mobicents.diameter.impl.ha.server.sh.ShServerSessionDataReplicatedImpl; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ShReplicatedSessionDataFactory implements IAppSessionDataFactory { + + private ReplicatedSessionDatasource replicatedSessionDataSource; + private MobicentsCluster mobicentsCluster; + + /** + * @param replicatedSessionDataSource + */ + public ShReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? + super(); + this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; + this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData (java.lang.Class, java.lang.String) + */ + @Override + public IShSessionData getAppSessionData(Class clazz, String sessionId) { + if (clazz.equals(ClientShSession.class)) { + ShClientSessionDataReplicatedImpl data = new ShClientSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + else if (clazz.equals(ServerShSession.class)) { + ShServerSessionDataReplicatedImpl data = new ShServerSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); + return data; + } + throw new IllegalArgumentException(); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java new file mode 100644 index 000000000..6656e615f --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java @@ -0,0 +1,354 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.data; + +import java.util.HashMap; + +import javax.transaction.TransactionManager; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.BaseSession; +import org.jdiameter.api.IllegalDiameterStateException; +import org.jdiameter.api.NetworkReqListener; +import org.jdiameter.api.app.AppSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.client.api.ISessionFactory; +import org.jdiameter.common.api.app.IAppSessionData; +import org.jdiameter.common.api.app.IAppSessionDataFactory; +import org.jdiameter.common.api.app.IAppSessionFactory; +import org.jdiameter.common.api.app.acc.IAccSessionData; +import org.jdiameter.common.api.app.auth.IAuthSessionData; +import org.jdiameter.common.api.app.cca.ICCASessionData; +import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; +import org.jdiameter.common.api.app.gx.IGxSessionData; +import org.jdiameter.common.api.app.rf.IRfSessionData; +import org.jdiameter.common.api.app.ro.IRoSessionData; +import org.jdiameter.common.api.app.rx.IRxSessionData; +import org.jdiameter.common.api.app.s13.IS13SessionData; +import org.jdiameter.common.api.app.sh.IShSessionData; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.jdiameter.common.impl.data.LocalDataSource; +import org.restcomm.cache.MobicentsCache; +import org.restcomm.cluster.DataRemovalListener; +import org.restcomm.cluster.DefaultMobicentsCluster; +import org.restcomm.cluster.MobicentsCluster; +import org.restcomm.cluster.election.DefaultClusterElector; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.common.acc.AccReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.auth.AuthReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.cca.CCAReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.cxdx.CxDxReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.gx.GxReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.rf.RfReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.ro.RoReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.rx.RxReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.s13.S13ReplicatedSessionDataFactory; +import org.mobicents.diameter.impl.ha.common.sh.ShReplicatedSessionDataFactory; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Replicated datasource implementation for {@link ISessionDatasource} + * + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +public class ReplicatedSessionDatasource implements ISessionDatasource, DataRemovalListener { + + private static final Logger logger = LoggerFactory.getLogger(ReplicatedSessionDatasource.class); + public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-jbc.xml"; + private IContainer container; + private ISessionDatasource localDataSource; + + private DefaultMobicentsCluster mobicentsCluster; + private boolean localMode; + + // provided by impl, no way to change that, no conf! :) + protected HashMap, IAppSessionDataFactory> appSessionDataFactories = + new HashMap, IAppSessionDataFactory>(); + + // Constants + // ---------------------------------------------------------------- + public static final String SESSIONS = "/diameter/appsessions"; + public static final Fqn SESSIONS_FQN = Fqn.fromString(SESSIONS); + + public ReplicatedSessionDatasource(IContainer container) { + this(container, new LocalDataSource(), ReplicatedSessionDatasource.class.getClassLoader().getResource(CLUSTER_DS_DEFAULT_FILE) == null ? + "config/" + CLUSTER_DS_DEFAULT_FILE : CLUSTER_DS_DEFAULT_FILE); + } + + public ReplicatedSessionDatasource(IContainer container, ISessionDatasource localDataSource, String cacheConfigFilename) { + super(); + this.localDataSource = localDataSource; + + MobicentsCache mcCache = new MobicentsCache(cacheConfigFilename); + TransactionManager txMgr = null; + try { + Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); + Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); + txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); + } + catch (Exception e) { + logger.debug("Could not fetch TxMgr. Not using one.", e); + // let's not have Tx Manager than... + } + + this.mobicentsCluster = new DefaultMobicentsCluster(mcCache, txMgr, new DefaultClusterElector()); + this.mobicentsCluster.addDataRemovalListener(this); // register, so we know WHEN some other node removes session. + this.mobicentsCluster.startCluster(); + + this.container = container; + // this is coded, its tied to specific impl of SessionDatasource + appSessionDataFactories.put(IAuthSessionData.class, new AuthReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IAccSessionData.class, new AccReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(ICCASessionData.class, new CCAReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IRoSessionData.class, new RoReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IRfSessionData.class, new RfReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IShSessionData.class, new ShReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(ICxDxSessionData.class, new CxDxReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IGxSessionData.class, new GxReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IRxSessionData.class, new RxReplicatedSessionDataFactory(this)); + appSessionDataFactories.put(IS13SessionData.class, new S13ReplicatedSessionDataFactory(this)); + + } + + @Override + public boolean exists(String sessionId) { + return this.localDataSource.exists(sessionId) ? true : this.existReplicated(sessionId); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#addSession(org.jdiameter .api.BaseSession) + */ + @Override + public void addSession(BaseSession session) { + // Simple as is, if its replicated, it will be already there :) + this.localDataSource.addSession(session); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#getSession(java.lang.String ) + */ + @Override + public BaseSession getSession(String sessionId) { + if (this.localDataSource.exists(sessionId)) { + return this.localDataSource.getSession(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + this.makeLocal(sessionId); + return this.localDataSource.getSession(sessionId); + } + + return null; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#getSessionListener(java .lang.String) + */ + @Override + public NetworkReqListener getSessionListener(String sessionId) { + if (this.localDataSource.exists(sessionId)) { + return this.localDataSource.getSessionListener(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + this.makeLocal(sessionId); + return this.localDataSource.getSessionListener(sessionId); + } + + return null; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSession(java.lang .String) + */ + @Override + public void removeSession(String sessionId) { + logger.debug("removeSession({}) in Local DataSource", sessionId); + + if (this.localDataSource.exists(sessionId)) { + this.localDataSource.removeSession(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + // FIXME: remove node. + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSessionListener( java.lang.String) + */ + @Override + public NetworkReqListener removeSessionListener(String sessionId) { + if (this.localDataSource.exists(sessionId)) { + return this.localDataSource.removeSessionListener(sessionId); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + // does not make much sense ;[ + this.makeLocal(sessionId); + return this.localDataSource.removeSessionListener(sessionId); + } + + return null; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.ha.ISessionDatasource#setSessionListener(java .lang.String, org.jdiameter.api.NetworkReqListener) + */ + @Override + public void setSessionListener(String sessionId, NetworkReqListener data) { + if (this.localDataSource.exists(sessionId)) { + this.localDataSource.setSessionListener(sessionId, data); + } + else if (!this.localMode && this.existReplicated(sessionId)) { + // does not make much sense ;[ + this.makeLocal(sessionId); + this.localDataSource.setSessionListener(sessionId, data); + } + } + + @Override + public void start() { + mobicentsCluster.getMobicentsCache().startCache(); + localMode = mobicentsCluster.getMobicentsCache().isLocalMode(); + } + + @Override + public void stop() { + mobicentsCluster.getMobicentsCache().stopCache(); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.data.ISessionDatasource#isClustered() + */ + @Override + public boolean isClustered() { + return !localMode; + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.data.ISessionDatasource#getDataFactory(java. lang.Class) + */ + @Override + public IAppSessionDataFactory getDataFactory(Class x) { + return this.appSessionDataFactories.get(x); + } + + // remove lst; + + public MobicentsCluster getMobicentsCluster() { + return this.mobicentsCluster; + } + + @Override + public void dataRemoved(Fqn sessionFqn) { + String sessionId = (String) sessionFqn.getLastElement(); + this.localDataSource.removeSession(sessionId); + } + + @Override + public Fqn getBaseFqn() { + return SESSIONS_FQN; + } + + /** + * @param sessionId + * @return + */ + private boolean existReplicated(String sessionId) { + if (!this.localMode && this.mobicentsCluster.getMobicentsCache().getJBossCache().getNode(Fqn.fromRelativeElements(SESSIONS_FQN, sessionId)) != null) { + return true; + } + return false; + } + + /** + * @param sessionId + */ + private void makeLocal(String sessionId) { + try { + // this is APP session, always + Class appSessionInterfaceClass = + AppSessionDataReplicatedImpl.getAppSessionIface(this.mobicentsCluster.getMobicentsCache(), sessionId); + // get factory; + // FIXME: make it a field? + IAppSessionFactory fct = ((ISessionFactory) this.container.getSessionFactory()).getAppSessionFactory(appSessionInterfaceClass); + if (fct == null) { + logger.warn("Session with id:{}, is in replicated data source, but no Application Session Factory for:{}.", sessionId, appSessionInterfaceClass); + return; + } + else { + BaseSession session = fct.getSession(sessionId, appSessionInterfaceClass); + this.localDataSource.addSession(session); + // hmmm + this.localDataSource.setSessionListener(sessionId, (NetworkReqListener) session); + return; + } + } + catch (IllegalDiameterStateException e) { + if (logger.isErrorEnabled()) { + logger.error("Failed to obtain factory from stack..."); + } + } + } + + // ------- local getter + + public IContainer getContainer() { + return this.container; + } +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java new file mode 100644 index 000000000..4543a3c3a --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java @@ -0,0 +1,191 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.acc; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.acc.ServerAccSession; +import org.jdiameter.common.api.app.acc.ServerAccSessionState; +import org.jdiameter.server.impl.app.acc.IServerAccSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAccSessionData { + + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + private static final String TS_TIMEOUT = "TS_TIMEOUT"; + private static final String TS_TIMERID = "TS_TIMERID"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerAccSession.class); + setServerAccSessionState(ServerAccSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerAccSessionState getServerAccSessionState() { + if (exists()) { + return (ServerAccSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerAccSessionState(ServerAccSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimeout(long value) { + if (exists()) { + getNode().put(TS_TIMEOUT, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public long getTsTimeout() { + if (exists()) { + return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimerId(Serializable value) { + if (exists()) { + getNode().put(TS_TIMERID, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java new file mode 100644 index 000000000..f7073e36d --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java @@ -0,0 +1,191 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.auth; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.auth.ServerAuthSession; +import org.jdiameter.common.api.app.auth.ServerAuthSessionState; +import org.jdiameter.server.impl.app.auth.IServerAuthSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAuthSessionData { + + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + private static final String TS_TIMEOUT = "TS_TIMEOUT"; + private static final String TS_TIMERID = "TS_TIMERID"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerAuthSession.class); + setServerAuthSessionState(ServerAuthSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerAuthSessionState getServerAuthSessionState() { + if (exists()) { + return (ServerAuthSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerAuthSessionState(ServerAuthSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimeout(long value) { + if (exists()) { + getNode().put(TS_TIMEOUT, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public long getTsTimeout() { + if (exists()) { + return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public void setTsTimerId(Serializable value) { + if (exists()) { + getNode().put(TS_TIMERID, value); + } + else { + throw new IllegalStateException(); + } + } + + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java new file mode 100644 index 000000000..c7e879b81 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java @@ -0,0 +1,180 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.cca; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.cca.ServerCCASession; +import org.jdiameter.common.api.app.cca.ServerCCASessionState; +import org.jdiameter.server.impl.app.cca.IServerCCASessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerCCASessionData { + + private static final String TCCID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerCCASession.class); + setServerCCASessionState(ServerCCASessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerCCASessionState getServerCCASessionState() { + if (exists()) { + return (ServerCCASessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerCCASessionState(ServerCCASessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTccTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TCCID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTccTimerId() { + if (exists()) { + return (Serializable) getNode().get(TCCID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..721008b01 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java @@ -0,0 +1,84 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.cxdx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.cxdx.ServerCxDxSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.common.api.app.cxdx.CxDxSessionState; +import org.jdiameter.server.impl.app.cxdx.IServerCxDxSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IServerCxDxSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ServerCxDxSession.class); + setCxDxSessionState(CxDxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..d59f82634 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java @@ -0,0 +1,182 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.gx; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.gx.ServerGxSession; +import org.jdiameter.common.api.app.gx.ServerGxSessionState; +import org.jdiameter.server.impl.app.gx.IServerGxSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerGxSessionData { + + private static final String TCCID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerGxSession.class); + setServerGxSessionState(ServerGxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerGxSessionState getServerGxSessionState() { + if (exists()) { + return (ServerGxSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerGxSessionState(ServerGxSessionState state) { + + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTccTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TCCID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTccTimerId() { + if (exists()) { + return (Serializable) getNode().get(TCCID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java new file mode 100644 index 000000000..c4d95e083 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java @@ -0,0 +1,211 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.rf; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.rf.ServerRfSession; +import org.jdiameter.common.api.app.rf.ServerRfSessionState; +import org.jdiameter.server.impl.app.rf.IServerRfSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRfSessionData { + + private static final String TS_TIMERID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + private static final String TS_TIMEOUT = "TS_TIMEOUT"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerRfSession.class); + setServerRfSessionState(ServerRfSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerRfSessionState getServerRfSessionState() { + if (exists()) { + return (ServerRfSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerRfSessionState(ServerRfSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTsTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TS_TIMERID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTsTimerId() { + if (exists()) { + return (Serializable) getNode().get(TS_TIMERID); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#getTsTimeout() + */ + @Override + public long getTsTimeout() { + if (exists()) { + return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#setTsTimeout(long) + */ + @Override + public void setTsTimeout(long l) { + if (exists()) { + getNode().put(TS_TIMEOUT, l); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java new file mode 100644 index 000000000..0cfddabc8 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java @@ -0,0 +1,180 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.ro; + +import java.io.Serializable; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.ro.ServerRoSession; +import org.jdiameter.common.api.app.ro.ServerRoSessionState; +import org.jdiameter.server.impl.app.ro.IServerRoSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRoSessionData { + + private static final String TCCID = "TCCID"; + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerRoSession.class); + setServerRoSessionState(ServerRoSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerRoSessionState getServerRoSessionState() { + if (exists()) { + return (ServerRoSessionState) getNode().get(STATE); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerRoSessionState(ServerRoSessionState state) { + if (exists()) { + getNode().put(STATE, state); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) + */ + @Override + public void setTccTimerId(Serializable tccTimerId) { + if (exists()) { + getNode().put(TCCID, tccTimerId); + } + else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() + */ + @Override + public Serializable getTccTimerId() { + if (exists()) { + return (Serializable) getNode().get(TCCID); + } + else { + throw new IllegalStateException(); + } + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java new file mode 100644 index 000000000..8e12227a3 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java @@ -0,0 +1,144 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.rx; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.rx.ServerRxSession; +import org.jdiameter.common.api.app.rx.ServerRxSessionState; +import org.jdiameter.server.impl.app.rx.IServerRxSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRxSessionData { + + private static final String STATELESS = "STATELESS"; + private static final String STATE = "STATE"; + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerRxSession.class); + setServerRxSessionState(ServerRxSessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() + */ + @Override + public boolean isStateless() { + if (exists()) { + return toPrimitive((Boolean) getNode().get(STATELESS), true); + } else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) + */ + @Override + public void setStateless(boolean stateless) { + if (exists()) { + getNode().put(STATELESS, stateless); + } else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() + */ + @Override + public ServerRxSessionState getServerRxSessionState() { + if (exists()) { + return (ServerRxSessionState) getNode().get(STATE); + } else { + throw new IllegalStateException(); + } + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState + * (org.jdiameter.common.api.app.cca.ServerCCASessionState) + */ + @Override + public void setServerRxSessionState(ServerRxSessionState state) { + + if (exists()) { + getNode().put(STATE, state); + } else { + throw new IllegalStateException(); + } + + } +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java new file mode 100644 index 000000000..fab5ef951 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java @@ -0,0 +1,61 @@ +/* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + */ + +package org.mobicents.diameter.impl.ha.server.s13; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.s13.ServerS13Session; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.common.api.app.s13.S13SessionState; +import org.jdiameter.server.impl.app.s13.IServerS13SessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ServerS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IServerS13SessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqn, mobicentsCluster, container); + + if (super.create()) { + setAppSessionIface(this, ServerS13Session.class); + setS13SessionState(S13SessionState.IDLE); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ServerS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java new file mode 100644 index 000000000..c8837f09d --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java @@ -0,0 +1,81 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.server.sh; + +import org.jboss.cache.Fqn; +import org.jdiameter.api.sh.ServerShSession; +import org.jdiameter.server.impl.app.sh.IShServerSessionData; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; + +/** + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ShServerSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShServerSessionData { + + /** + * @param nodeFqn + * @param mobicentsCluster + * @param iface + */ + public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { + super(nodeFqn, mobicentsCluster); + + if (super.create()) { + setAppSessionIface(this, ServerShSession.class); + } + } + + /** + * @param sessionId + * @param mobicentsCluster + * @param iface + */ + public ShServerSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { + this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + } + +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java new file mode 100644 index 000000000..a8e9db7bf --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java @@ -0,0 +1,77 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.timer; + +import java.io.Serializable; + +import org.restcomm.timers.PeriodicScheduleStrategy; +import org.restcomm.timers.TimerTaskData; + +/** + * Diameter timer task data holder. + * + * @author Alexandre Mendonca + * @author Bartosz Baranowski + */ +final class DiameterTimerTaskData extends TimerTaskData { + + private static final long serialVersionUID = 8774218122384404225L; + + // data we need to recreate timer task + private String sessionId; + private String timerName; + + DiameterTimerTaskData(Serializable id, long delay, String sessionId, String timerName) { + super(id, System.currentTimeMillis() + delay, -1, PeriodicScheduleStrategy.withFixedDelay); + this.sessionId = sessionId; + this.timerName = timerName; + } + + public String getSessionId() { + return sessionId; + } + + public String getTimerName() { + return timerName; + } +} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java new file mode 100644 index 000000000..3b06ac1f9 --- /dev/null +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java @@ -0,0 +1,147 @@ + /* + * TeleStax, Open Source Cloud Communications + * Copyright 2011-2016, TeleStax Inc. and individual contributors + * by the @authors tag. + * + * This program is free software: you can redistribute it and/or modify + * under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation; either version 3 of + * the License, or (at your option) any later version. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see + * + * This file incorporates work covered by the following copyright and + * permission notice: + * + * JBoss, Home of Professional Open Source + * Copyright 2007-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.diameter.impl.ha.timer; + +import java.io.Serializable; + +import org.jdiameter.api.BaseSession; +import org.jdiameter.client.api.IContainer; +import org.jdiameter.common.api.data.ISessionDatasource; +import org.jdiameter.common.api.timer.ITimerFacility; +import org.jdiameter.common.impl.app.AppSessionImpl; +import org.restcomm.cluster.MobicentsCluster; +import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; +import org.restcomm.timers.FaultTolerantScheduler; +import org.restcomm.timers.TimerTask; +import org.restcomm.timers.TimerTaskData; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Replicated implementation of {@link ITimerFacility} + * + * @author Bartosz Baranowski + * @author Alexandre Mendonca + */ +public class ReplicatedTimerFacilityImpl implements ITimerFacility { + + private static final Logger logger = LoggerFactory.getLogger(ReplicatedTimerFacilityImpl.class); + + private ISessionDatasource sessionDataSource; + private TimerTaskFactory taskFactory; + private FaultTolerantScheduler ftScheduler; + + public ReplicatedTimerFacilityImpl(IContainer container) { + super(); + this.sessionDataSource = container.getAssemblerFacility().getComponentInstance(ISessionDatasource.class); + this.taskFactory = new TimerTaskFactory(); + MobicentsCluster cluster = ((ReplicatedSessionDatasource) this.sessionDataSource).getMobicentsCluster(); + this.ftScheduler = new FaultTolerantScheduler("DiameterTimer", 5, cluster, (byte) 12, null, this.taskFactory); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.timer.ITimerFacility#cancel(java.io.Serializable) + */ + @Override + public void cancel(Serializable id) { + logger.debug("Cancelling timer with id {}", id); + this.ftScheduler.cancel(id); + } + + /* + * (non-Javadoc) + * + * @see org.jdiameter.common.api.timer.ITimerFacility#schedule(java.lang.String, java.lang.String, long) + */ + @Override + public Serializable schedule(String sessionId, String timerName, long miliseconds) throws IllegalArgumentException { + String id = sessionId + "/" + timerName; + logger.debug("Scheduling timer with id {}", id); + + if (this.ftScheduler.getTimerTaskData(id) != null) { + throw new IllegalArgumentException("Timer already running: " + id); + } + + DiameterTimerTaskData data = new DiameterTimerTaskData(id, miliseconds, sessionId, timerName); + TimerTask tt = this.taskFactory.newTimerTask(data); + ftScheduler.schedule(tt); + return id; + } + + private final class TimerTaskFactory implements org.restcomm.timers.TimerTaskFactory { + + @Override + public TimerTask newTimerTask(TimerTaskData data) { + return new DiameterTimerTask(data); + } + } + + private final class DiameterTimerTask extends TimerTask { + + DiameterTimerTask(TimerTaskData data) { + super(data); + } + + @Override + public void runTask() { + try { + DiameterTimerTaskData data = (DiameterTimerTaskData) getData(); + BaseSession bSession = sessionDataSource.getSession(data.getSessionId()); + if (bSession == null || !bSession.isAppSession()) { + // FIXME: error ? + return; + } + else { + AppSessionImpl impl = (AppSessionImpl) bSession; + impl.onTimer(data.getTimerName()); + } + } + catch (Exception e) { + logger.error("Failure executing timer task", e); + } + } + } + +} From 21aa5321adc50b6048dc282249f4516f9e42d727 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Wed, 19 Apr 2017 12:57:36 +0300 Subject: [PATCH 48/75] Switch from double-module to single-module for diameter-ha-impl. --- core/jdiameter-ha/api/pom.xml | 4 ++++ core/jdiameter-ha/pom.xml | 28 +++++++++++++++++----------- core/mux/jar/pom.xml | 3 ++- core/mux/pom.xml | 11 ++++++++--- 4 files changed, 31 insertions(+), 15 deletions(-) diff --git a/core/jdiameter-ha/api/pom.xml b/core/jdiameter-ha/api/pom.xml index b6bf52432..51d6903f9 100644 --- a/core/jdiameter-ha/api/pom.xml +++ b/core/jdiameter-ha/api/pom.xml @@ -21,6 +21,7 @@ + + org.restcomm.cluster diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index 6a01551c5..7c3711655 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -17,15 +17,17 @@ api + impl + + false- -> ha.impl jboss5 @@ -38,7 +40,7 @@ wildfly - + true- -> ha.impl wildfly @@ -48,17 +50,18 @@ impl-wildfly + --> - - 1.15.26 - + - 8.2.4.Final - 3.3.0.Final + + 3.0.0-SNAPSHOT @@ -74,6 +77,7 @@ ${project.version} + + org.restcomm.cluster core - ${restcomm.cluster.version} + ${cluster.version} org.restcomm.cluster cache - ${restcomm.cluster.version} + ${cluster.version} org.restcomm.cluster timers - ${restcomm.cluster.version} + ${cluster.version} diff --git a/core/mux/jar/pom.xml b/core/mux/jar/pom.xml index c2f3fad47..4b560dce7 100644 --- a/core/mux/jar/pom.xml +++ b/core/mux/jar/pom.xml @@ -47,7 +47,8 @@ org.mobicents.diameter - jdiameter-ha-impl-${ha.impl} + + jdiameter-ha-impl diff --git a/core/mux/pom.xml b/core/mux/pom.xml index 9a4d01a2c..f7c487384 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -39,26 +39,30 @@ jboss5 + + false- -> ha.impl jboss5 + --> sar-jboss-5 wildfly + + true- -> ha.impl wildfly + --> sar-wildfly @@ -84,7 +88,8 @@ ${project.groupId} - jdiameter-ha-impl-${ha.impl} + + jdiameter-ha-impl ${project.version} From c4e429b9be9802797f72491b56b71c57a1f51874 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 21 Apr 2017 13:24:19 +0300 Subject: [PATCH 49/75] Creating single module jdiameter-ha-impl. Removing modules for jboss5 and wildfly. --- core/jdiameter-ha/impl-jboss5/pom.xml | 52 --- .../ClientAccSessionDataReplicatedImpl.java | 260 ------------- .../ClientAuthSessionDataReplicatedImpl.java | 243 ------------ .../ClientCCASessionDataReplicatedImpl.java | 327 ---------------- .../ClientCxDxSessionDataReplicatedImpl.java | 84 ----- .../gx/ClientGxSessionDataReplicatedImpl.java | 329 ---------------- .../rf/ClientRfSessionDataReplicatedImpl.java | 249 ------------ .../ro/ClientRoSessionDataReplicatedImpl.java | 326 ---------------- .../rx/ClientRxSessionDataReplicatedImpl.java | 141 ------- .../ClientS13SessionDataReplicatedImpl.java | 61 --- .../sh/ShClientSessionDataReplicatedImpl.java | 81 ---- .../common/AppSessionDataReplicatedImpl.java | 132 ------- .../acc/AccReplicatedSessionDataFactory.java | 94 ----- .../AuthReplicatedSessionDataFactory.java | 92 ----- .../cca/CCAReplicatedSessionDataFactory.java | 94 ----- .../CxDxReplicatedSessionDataFactory.java | 95 ----- .../cxdx/CxDxSessionDataReplicatedImpl.java | 179 --------- .../gx/GxReplicatedSessionDataFactory.java | 94 ----- .../rf/RfReplicatedSessionDataFactory.java | 94 ----- .../ro/RoReplicatedSessionDataFactory.java | 94 ----- .../rx/RxReplicatedSessionDataFactory.java | 94 ----- .../s13/S13ReplicatedSessionDataFactory.java | 72 ---- .../s13/S13SessionDataReplicatedImpl.java | 156 -------- .../sh/ShReplicatedSessionDataFactory.java | 93 ----- .../ha/data/ReplicatedSessionDatasource.java | 354 ----------------- .../ServerAccSessionDataReplicatedImpl.java | 191 ---------- .../ServerAuthSessionDataReplicatedImpl.java | 191 ---------- .../ServerCCASessionDataReplicatedImpl.java | 180 --------- .../ServerCxDxSessionDataReplicatedImpl.java | 84 ----- .../gx/ServerGxSessionDataReplicatedImpl.java | 182 --------- .../rf/ServerRfSessionDataReplicatedImpl.java | 211 ----------- .../ro/ServerRoSessionDataReplicatedImpl.java | 180 --------- .../rx/ServerRxSessionDataReplicatedImpl.java | 144 ------- .../ServerS13SessionDataReplicatedImpl.java | 61 --- .../sh/ShServerSessionDataReplicatedImpl.java | 81 ---- .../impl/ha/timer/DiameterTimerTaskData.java | 77 ---- .../ha/timer/ReplicatedTimerFacilityImpl.java | 147 -------- core/jdiameter-ha/impl-wildfly/pom.xml | 54 --- .../ClientAccSessionDataReplicatedImpl.java | 260 ------------- .../ClientAuthSessionDataReplicatedImpl.java | 243 ------------ .../ClientCCASessionDataReplicatedImpl.java | 327 ---------------- .../ClientCxDxSessionDataReplicatedImpl.java | 84 ----- .../gx/ClientGxSessionDataReplicatedImpl.java | 329 ---------------- .../rf/ClientRfSessionDataReplicatedImpl.java | 249 ------------ .../ro/ClientRoSessionDataReplicatedImpl.java | 326 ---------------- .../rx/ClientRxSessionDataReplicatedImpl.java | 141 ------- .../ClientS13SessionDataReplicatedImpl.java | 61 --- .../sh/ShClientSessionDataReplicatedImpl.java | 81 ---- .../common/AppSessionDataReplicatedImpl.java | 132 ------- .../acc/AccReplicatedSessionDataFactory.java | 94 ----- .../AuthReplicatedSessionDataFactory.java | 92 ----- .../cca/CCAReplicatedSessionDataFactory.java | 94 ----- .../CxDxReplicatedSessionDataFactory.java | 95 ----- .../cxdx/CxDxSessionDataReplicatedImpl.java | 179 --------- .../gx/GxReplicatedSessionDataFactory.java | 94 ----- .../rf/RfReplicatedSessionDataFactory.java | 94 ----- .../ro/RoReplicatedSessionDataFactory.java | 94 ----- .../rx/RxReplicatedSessionDataFactory.java | 94 ----- .../s13/S13ReplicatedSessionDataFactory.java | 72 ---- .../s13/S13SessionDataReplicatedImpl.java | 156 -------- .../sh/ShReplicatedSessionDataFactory.java | 93 ----- .../ha/data/ReplicatedSessionDatasource.java | 356 ------------------ .../ServerAccSessionDataReplicatedImpl.java | 191 ---------- .../ServerAuthSessionDataReplicatedImpl.java | 191 ---------- .../ServerCCASessionDataReplicatedImpl.java | 180 --------- .../ServerCxDxSessionDataReplicatedImpl.java | 84 ----- .../gx/ServerGxSessionDataReplicatedImpl.java | 182 --------- .../rf/ServerRfSessionDataReplicatedImpl.java | 211 ----------- .../ro/ServerRoSessionDataReplicatedImpl.java | 180 --------- .../rx/ServerRxSessionDataReplicatedImpl.java | 144 ------- .../ServerS13SessionDataReplicatedImpl.java | 61 --- .../sh/ShServerSessionDataReplicatedImpl.java | 81 ---- .../impl/ha/timer/DiameterTimerTaskData.java | 77 ---- .../ha/timer/ReplicatedTimerFacilityImpl.java | 147 -------- .../ClientAccSessionDataReplicatedImpl.java | 39 +- .../ClientAuthSessionDataReplicatedImpl.java | 35 +- .../ClientCCASessionDataReplicatedImpl.java | 57 +-- .../ClientCxDxSessionDataReplicatedImpl.java | 17 +- .../gx/ClientGxSessionDataReplicatedImpl.java | 57 +-- .../rf/ClientRfSessionDataReplicatedImpl.java | 39 +- .../ro/ClientRoSessionDataReplicatedImpl.java | 57 +-- .../rx/ClientRxSessionDataReplicatedImpl.java | 29 +- .../ClientS13SessionDataReplicatedImpl.java | 17 +- .../sh/ShClientSessionDataReplicatedImpl.java | 15 +- .../common/AppSessionDataReplicatedImpl.java | 36 +- .../cxdx/CxDxSessionDataReplicatedImpl.java | 24 +- .../s13/S13SessionDataReplicatedImpl.java | 24 +- .../ha/data/ReplicatedSessionDatasource.java | 29 +- .../ServerAccSessionDataReplicatedImpl.java | 31 +- .../ServerAuthSessionDataReplicatedImpl.java | 31 +- .../ServerCCASessionDataReplicatedImpl.java | 27 +- .../ServerCxDxSessionDataReplicatedImpl.java | 17 +- .../gx/ServerGxSessionDataReplicatedImpl.java | 27 +- .../rf/ServerRfSessionDataReplicatedImpl.java | 31 +- .../ro/ServerRoSessionDataReplicatedImpl.java | 27 +- .../rx/ServerRxSessionDataReplicatedImpl.java | 23 +- .../ServerS13SessionDataReplicatedImpl.java | 17 +- .../sh/ShServerSessionDataReplicatedImpl.java | 15 +- 98 files changed, 383 insertions(+), 11580 deletions(-) delete mode 100644 core/jdiameter-ha/impl-jboss5/pom.xml delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java delete mode 100644 core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/pom.xml delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java delete mode 100644 core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java diff --git a/core/jdiameter-ha/impl-jboss5/pom.xml b/core/jdiameter-ha/impl-jboss5/pom.xml deleted file mode 100644 index da451f5e7..000000000 --- a/core/jdiameter-ha/impl-jboss5/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - - org.mobicents.diameter - jdiameter-ha-parent - 1.7.0-SNAPSHOT - ../pom.xml - - - jdiameter-ha-impl-jboss5 - - Restcomm :: Diameter Stack HA :: ${project.artifactId} - - - - ${project.groupId} - jdiameter-ha-api - ${project.version} - - - - org.mobicents.diameter - jdiameter-impl - - - - - org.jboss.logging - jboss-logging-log4j - provided - - - - - org.jboss.cluster - jboss-ha-server-cache-jbc - - - - org.mobicents.cluster - cache - - - - org.mobicents.cluster - timers - - - - diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java deleted file mode 100644 index 0b2b71df6..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java +++ /dev/null @@ -1,260 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.acc; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.acc.ClientAccSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.acc.IClientAccSessionData; -import org.jdiameter.common.api.app.acc.ClientAccSessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAccSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientAccSessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String INTERIM_TIMERID = "INTERIM_TIMERID"; - private static final String DEST_HOST = "DEST_HOST"; - private static final String DEST_REALM = "DEST_REALM"; - private static final String BUFFER = "BUFFER"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientAccSession.class); - setClientAccSessionState(ClientAccSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setClientAccSessionState - * (org.jdiameter.common.api.app.acc.ClientAccSessionState) - */ - @Override - public void setClientAccSessionState(ClientAccSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getClientAccSessionState() - */ - @Override - public ClientAccSessionState getClientAccSessionState() { - if (exists()) { - return (ClientAccSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setInterimTimerId(java.io.Serializable) - */ - @Override - public void setInterimTimerId(Serializable tid) { - if (exists()) { - getNode().put(INTERIM_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getInterimTimerId() - */ - @Override - public Serializable getInterimTimerId() { - if (exists()) { - return (Serializable) getNode().get(INTERIM_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationHost(java.lang.String) - */ - @Override - public void setDestinationHost(String destHost) { - if (exists()) { - getNode().put(DEST_HOST, destHost); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationHost() - */ - @Override - public String getDestinationHost() { - if (exists()) { - return (String) getNode().get(DEST_HOST); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationRealm(java.lang.String) - */ - @Override - public void setDestinationRealm(String destRealm) { - if (exists()) { - getNode().put(DEST_REALM, destRealm); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationRealm() - */ - @Override - public String getDestinationRealm() { - if (exists()) { - return (String) getNode().get(DEST_REALM); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java deleted file mode 100644 index 67dce12ae..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java +++ /dev/null @@ -1,243 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.auth; - -import java.io.Serializable; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.auth.ClientAuthSession; -import org.jdiameter.client.impl.app.auth.IClientAuthSessionData; -import org.jdiameter.common.api.app.auth.ClientAuthSessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAuthSessionData { - - private static final String STATE = "STATE"; - private static final String DESTINATION_HOST = "DESTINATION_HOST"; - private static final String DESTINATION_REALM = "DESTINATION_REALM"; - private static final String STATELESS = "STATELESS"; - private static final String TS_TIMERID = "TS_TIMERID"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientAuthSession.class); - setClientAuthSessionState(ClientAuthSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setClientAuthSessionState(org.jdiameter.common.api.app.auth. - * ClientAuthSessionState) - */ - @Override - public void setClientAuthSessionState(ClientAuthSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getClientAuthSessionState() - */ - @Override - public ClientAuthSessionState getClientAuthSessionState() { - if (exists()) { - return (ClientAuthSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setStateless(boolean) - */ - @Override - public void setStateless(boolean b) { - if (exists()) { - getNode().put(STATELESS, b); - } - else { - throw new IllegalStateException(); - } - - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationHost() - */ - @Override - public String getDestinationHost() { - if (exists()) { - return (String) getNode().get(DESTINATION_HOST); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationHost(java.lang.String) - */ - @Override - public void setDestinationHost(String host) { - if (exists()) { - getNode().put(DESTINATION_HOST, host); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationRealm() - */ - @Override - public String getDestinationRealm() { - if (exists()) { - return (String) getNode().get(DESTINATION_REALM); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationRealm(java.lang.String) - */ - @Override - public void setDestinationRealm(String realm) { - if (exists()) { - getNode().put(DESTINATION_REALM, realm); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java deleted file mode 100644 index f0bb81db0..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java +++ /dev/null @@ -1,327 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.cca; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.cca.ClientCCASession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.cca.IClientCCASessionData; -import org.jdiameter.common.api.app.cca.ClientCCASessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientCCASessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientCCASessionDataReplicatedImpl.class); - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - private static final String TXTIMER_ID = "TXTIMER_ID"; - private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; - private static final String BUFFER = "BUFFER"; - private static final String GRA = "GRA"; - private static final String GDDFH = "GDDFH"; - private static final String GCCFH = "GCCFH"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientCCASession.class); - setClientCCASessionState(ClientCCASessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ClientCCASessionState getClientCCASessionState() { - if (exists()) { - return (ClientCCASessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientCCASessionState(ClientCCASessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTxTimerId() { - if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerId(Serializable txTimerId) { - if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getTxTimerRequest() { - if (exists()) { - - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate Tx Timer Request from buffer."); - return null; - } - } - else { - return null; - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerRequest(Request txTimerRequest) { - if (exists()) { - if (txTimerRequest != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); - } - catch (ParseException e) { - logger.error("Unable to encode Tx Timer Request to buffer."); - } - } - else { - getNode().remove(TXTIMER_REQUEST); - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - @Override - public int getGatheredRequestedAction() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredRequestedAction(int gatheredRequestedAction) { - if (exists()) { - getNode().put(GRA, gatheredRequestedAction); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredCCFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredCCFH(int gatheredCCFH) { - if (exists()) { - getNode().put(GCCFH, gatheredCCFH); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredDDFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredDDFH(int gatheredDDFH) { - if (exists()) { - getNode().put(GDDFH, gatheredDDFH); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java deleted file mode 100644 index 2ce7d8f29..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,84 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.cxdx; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.cxdx.ClientCxDxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.impl.app.cxdx.IClientCxDxSessionData; -import org.jdiameter.common.api.app.cxdx.CxDxSessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IClientCxDxSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ClientCxDxSession.class); - setCxDxSessionState(CxDxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java deleted file mode 100644 index bb9761e41..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,329 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.gx; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.gx.ClientGxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.gx.IClientGxSessionData; -import org.jdiameter.common.api.app.gx.ClientGxSessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientGxSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientGxSessionDataReplicatedImpl.class); - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - private static final String TXTIMER_ID = "TXTIMER_ID"; - private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; - private static final String BUFFER = "BUFFER"; - private static final String GRA = "GRA"; - private static final String GDDFH = "GDDFH"; - private static final String GCCFH = "GCCFH"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientGxSession.class); - setClientGxSessionState(ClientGxSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ClientGxSessionState getClientGxSessionState() { - if (exists()) { - return (ClientGxSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientGxSessionState(ClientGxSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTxTimerId() { - if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerId(Serializable txTimerId) { - if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getTxTimerRequest() { - if (exists()) { - - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate Tx Timer Request from buffer."); - return null; - } - } - else { - return null; - } - - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerRequest(Request txTimerRequest) { - if (exists()) { - if (txTimerRequest != null) { - - try { - byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); - } - catch (ParseException e) { - logger.error("Unable to encode Tx Timer Request to buffer."); - } - } - else { - getNode().remove(TXTIMER_REQUEST); - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - @Override - public int getGatheredRequestedAction() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredRequestedAction(int gatheredRequestedAction) { - if (exists()) { - getNode().put(GRA, gatheredRequestedAction); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredCCFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredCCFH(int gatheredCCFH) { - if (exists()) { - getNode().put(GCCFH, gatheredCCFH); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredDDFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredDDFH(int gatheredDDFH) { - if (exists()) { - getNode().put(GDDFH, gatheredDDFH); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java deleted file mode 100644 index ab9a92c68..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java +++ /dev/null @@ -1,249 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.rf; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.rf.ClientRfSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.rf.IClientRfSessionData; -import org.jdiameter.common.api.app.rf.ClientRfSessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRfSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientRfSessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String BUFFER = "BUFFER"; - private static final String TS_TIMERID = "TS_TIMERID"; - private static final String DESTINATION_HOST = "DESTINATION_HOST"; - private static final String DESTINATION_REALM = "DESTINATION_REALM"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientRfSession.class); - setClientRfSessionState(ClientRfSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public ClientRfSessionState getClientRfSessionState() { - if (exists()) { - return (ClientRfSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientRfSessionState(ClientRfSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationHost() - */ - @Override - public String getDestinationHost() { - if (exists()) { - return (String) getNode().get(DESTINATION_HOST); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationHost(java.lang.String) - */ - @Override - public void setDestinationHost(String destinationHost) { - if (exists()) { - getNode().put(DESTINATION_HOST, destinationHost); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationRealm() - */ - @Override - public String getDestinationRealm() { - if (exists()) { - return (String) getNode().get(DESTINATION_REALM); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationRealm(java.lang.String) - */ - @Override - public void setDestinationRealm(String destinationRealm) { - if (exists()) { - getNode().put(DESTINATION_REALM, destinationRealm); - } - else { - throw new IllegalStateException(); - } - } -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java deleted file mode 100644 index f1a150ac0..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java +++ /dev/null @@ -1,326 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.ro; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.ro.ClientRoSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.ro.IClientRoSessionData; -import org.jdiameter.common.api.app.ro.ClientRoSessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRoSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientRoSessionDataReplicatedImpl.class); - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - private static final String TXTIMER_ID = "TXTIMER_ID"; - private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; - private static final String BUFFER = "BUFFER"; - private static final String GRA = "GRA"; - private static final String GDDFH = "GDDFH"; - private static final String GCCFH = "GCCFH"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientRoSession.class); - setClientRoSessionState(ClientRoSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ClientRoSessionState getClientRoSessionState() { - if (exists()) { - return (ClientRoSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientRoSessionState(ClientRoSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTxTimerId() { - if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerId(Serializable txTimerId) { - if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getTxTimerRequest() { - if (exists()) { - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate Tx Timer Request from buffer."); - return null; - } - } - else { - return null; - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerRequest(Request txTimerRequest) { - if (exists()) { - if (txTimerRequest != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); - } - catch (ParseException e) { - logger.error("Unable to encode Tx Timer Request to buffer."); - } - } - else { - getNode().remove(TXTIMER_REQUEST); - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - @Override - public int getGatheredRequestedAction() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredRequestedAction(int gatheredRequestedAction) { - if (exists()) { - getNode().put(GRA, gatheredRequestedAction); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredCCFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredCCFH(int gatheredCCFH) { - if (exists()) { - getNode().put(GCCFH, gatheredCCFH); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredDDFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredDDFH(int gatheredDDFH) { - if (exists()) { - getNode().put(GDDFH, gatheredDDFH); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java deleted file mode 100644 index 74ca87c46..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,141 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.rx; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.rx.ClientRxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.impl.app.rx.IClientRxSessionData; -import org.jdiameter.common.api.app.rx.ClientRxSessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRxSessionData { - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientRxSession.class); - setClientRxSessionState(ClientRxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } else { - throw new IllegalStateException(); - } - } - - @Override - public ClientRxSessionState getClientRxSessionState() { - if (exists()) { - return (ClientRxSessionState) getNode().get(STATE); - } else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientRxSessionState(ClientRxSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } else { - throw new IllegalStateException(); - } - } -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java deleted file mode 100644 index 52a7d935e..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.client.s13; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.s13.ClientS13Session; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.impl.app.s13.IClientS13SessionData; -import org.jdiameter.common.api.app.s13.S13SessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IClientS13SessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ClientS13Session.class); - setS13SessionState(S13SessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java deleted file mode 100644 index 8172f55cd..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java +++ /dev/null @@ -1,81 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.sh; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.sh.ClientShSession; -import org.jdiameter.client.impl.app.sh.IShClientSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ShClientSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShClientSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientShSession.class); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ShClientSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java deleted file mode 100644 index 97a7d9e69..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java +++ /dev/null @@ -1,132 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.ApplicationId; -import org.jdiameter.api.app.AppSession; -import org.jdiameter.common.api.app.IAppSessionData; -import org.mobicents.cache.MobicentsCache; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.cluster.cache.ClusteredCacheData; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class AppSessionDataReplicatedImpl extends ClusteredCacheData implements IAppSessionData { - - protected static final String SID = "SID"; - protected static final String APID = "APID"; - protected static final String SIFACE = "SIFACE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - */ - public AppSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - } - - public AppSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - public static void setAppSessionIface(ClusteredCacheData ccd, Class iface) { - //Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); - //n.put(SIFACE, iface); - ccd.getMobicentsCache().getJBossCache() - .getNode(ccd.getNodeFqn()) - .put(SIFACE, iface); - } - - public static Class getAppSessionIface(MobicentsCache mcCache, String sessionId) { - //Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); - //return (Class) n.get(SIFACE); - return (Class) mcCache.getJBossCache() - .getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)) - .get(SIFACE); - } - - @Override - public String getSessionId() { - return (String) super.getNodeFqn().getLastElement(); - } - - @Override - public void setApplicationId(ApplicationId applicationId) { - if (exists()) { - getNode().put(APID, applicationId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ApplicationId getApplicationId() { - if (exists()) { - return (ApplicationId) getNode().get(APID); - } - else { - throw new IllegalStateException(); - } - } - - // Some util methods for handling primitives - - protected boolean toPrimitive(Boolean b, boolean _default) { - return b == null ? _default : b; - } - - protected int toPrimitive(Integer i) { - return i == null ? NON_INITIALIZED : i; - } - - protected long toPrimitive(Long l) { - return l == null ? NON_INITIALIZED : l; - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java deleted file mode 100644 index 6efc94304..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.acc; - -import org.jdiameter.api.acc.ClientAccSession; -import org.jdiameter.api.acc.ServerAccSession; -import org.jdiameter.api.app.AppSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.acc.IAccSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.acc.ClientAccSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.acc.ServerAccSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class AccReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public AccReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IAccSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientAccSession.class)) { - ClientAccSessionDataReplicatedImpl data = - new ClientAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerAccSession.class)) { - ServerAccSessionDataReplicatedImpl data = new ServerAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java deleted file mode 100644 index 9f5e73296..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java +++ /dev/null @@ -1,92 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.auth; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.auth.ClientAuthSession; -import org.jdiameter.api.auth.ServerAuthSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.auth.IAuthSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.auth.ClientAuthSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.auth.ServerAuthSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class AuthReplicatedSessionDataFactory implements IAppSessionDataFactory { - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public AuthReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IAuthSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientAuthSession.class)) { - ClientAuthSessionDataReplicatedImpl data = new ClientAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - else if (clazz.equals(ServerAuthSession.class)) { - ServerAuthSessionDataReplicatedImpl data = new ServerAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java deleted file mode 100644 index b603fe779..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.cca; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.cca.ClientCCASession; -import org.jdiameter.api.cca.ServerCCASession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.cca.ICCASessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.cca.ClientCCASessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.cca.ServerCCASessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class CCAReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public CCAReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public ICCASessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientCCASession.class)) { - ClientCCASessionDataReplicatedImpl data = - new ClientCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerCCASession.class)) { - ServerCCASessionDataReplicatedImpl data = new ServerCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java deleted file mode 100644 index 62ea766ca..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java +++ /dev/null @@ -1,95 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.cxdx; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.cxdx.ClientCxDxSession; -import org.jdiameter.api.cxdx.ServerCxDxSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.cxdx.ClientCxDxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.cxdx.ServerCxDxSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class CxDxReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public CxDxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public ICxDxSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientCxDxSession.class)) { - ClientCxDxSessionDataReplicatedImpl data = - new ClientCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerCxDxSession.class)) { - ServerCxDxSessionDataReplicatedImpl data = - new ServerCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java deleted file mode 100644 index 6a167ab19..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,179 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.cxdx; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.common.api.app.cxdx.CxDxSessionState; -import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public abstract class CxDxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements ICxDxSessionData { - - private static final Logger logger = LoggerFactory.getLogger(CxDxSessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String BUFFER = "BUFFER"; - private static final String TS_TIMERID = "TS_TIMERID"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setCxDxSessionState(org.jdiameter.common.api.app.cxdx.CxDxSessionState) - */ - @Override - public void setCxDxSessionState(CxDxSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getCxDxSessionState() - */ - @Override - public CxDxSessionState getCxDxSessionState() { - if (exists()) { - return (CxDxSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java deleted file mode 100644 index 7729b240e..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.gx; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.gx.ClientGxSession; -import org.jdiameter.api.gx.ServerGxSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.gx.IGxSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.gx.ClientGxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.gx.ServerGxSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class GxReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public GxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IGxSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientGxSession.class)) { - ClientGxSessionDataReplicatedImpl data = - new ClientGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerGxSession.class)) { - ServerGxSessionDataReplicatedImpl data = new ServerGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java deleted file mode 100644 index a4b96f384..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.rf; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.rf.ClientRfSession; -import org.jdiameter.api.rf.ServerRfSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.rf.IRfSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.rf.ClientRfSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.rf.ServerRfSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class RfReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public RfReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IRfSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientRfSession.class)) { - ClientRfSessionDataReplicatedImpl data = - new ClientRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerRfSession.class)) { - ServerRfSessionDataReplicatedImpl data = new ServerRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java deleted file mode 100644 index d9ccb6bad..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.ro; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.ro.ClientRoSession; -import org.jdiameter.api.ro.ServerRoSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.ro.IRoSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.ro.ClientRoSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.ro.ServerRoSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class RoReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public RoReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IRoSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientRoSession.class)) { - ClientRoSessionDataReplicatedImpl data = - new ClientRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerRoSession.class)) { - ServerRoSessionDataReplicatedImpl data = new ServerRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java deleted file mode 100644 index 726a12a73..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.rx; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.rx.ClientRxSession; -import org.jdiameter.api.rx.ServerRxSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.rx.IRxSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.rx.ClientRxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.rx.ServerRxSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class RxReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public RxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IRxSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientRxSession.class)) { - ClientRxSessionDataReplicatedImpl data = - new ClientRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerRxSession.class)) { - ServerRxSessionDataReplicatedImpl data = new ServerRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java deleted file mode 100644 index 8fb1cda2e..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.common.s13; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.s13.ClientS13Session; -import org.jdiameter.api.s13.ServerS13Session; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.s13.IS13SessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.s13.ClientS13SessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.s13.ServerS13SessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class S13ReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public S13ReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IS13SessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientS13Session.class)) { - ClientS13SessionDataReplicatedImpl data = - new ClientS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerS13Session.class)) { - ServerS13SessionDataReplicatedImpl data = - new ServerS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java deleted file mode 100644 index e75ad3194..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.common.s13; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.common.api.app.s13.IS13SessionData; -import org.jdiameter.common.api.app.s13.S13SessionState; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public abstract class S13SessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IS13SessionData { - - private static final Logger logger = LoggerFactory.getLogger(S13SessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String BUFFER = "BUFFER"; - private static final String TS_TIMERID = "TS_TIMERID"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#setS13SessionState(org.jdiameter.common.api.app.s13.S13SessionState) - */ - @Override - public void setS13SessionState(S13SessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#getS13SessionState() - */ - @Override - public S13SessionState getS13SessionState() { - if (exists()) { - return (S13SessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java deleted file mode 100644 index c01890200..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java +++ /dev/null @@ -1,93 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.sh; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.sh.ClientShSession; -import org.jdiameter.api.sh.ServerShSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.sh.IShSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.sh.ShClientSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.sh.ShServerSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ShReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public ShReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData (java.lang.Class, java.lang.String) - */ - @Override - public IShSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientShSession.class)) { - ShClientSessionDataReplicatedImpl data = new ShClientSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - else if (clazz.equals(ServerShSession.class)) { - ShServerSessionDataReplicatedImpl data = new ShServerSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java deleted file mode 100644 index 6958f457d..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java +++ /dev/null @@ -1,354 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.data; - -import java.util.HashMap; - -import javax.transaction.TransactionManager; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.BaseSession; -import org.jdiameter.api.IllegalDiameterStateException; -import org.jdiameter.api.NetworkReqListener; -import org.jdiameter.api.app.AppSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.ISessionFactory; -import org.jdiameter.common.api.app.IAppSessionData; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.IAppSessionFactory; -import org.jdiameter.common.api.app.acc.IAccSessionData; -import org.jdiameter.common.api.app.auth.IAuthSessionData; -import org.jdiameter.common.api.app.cca.ICCASessionData; -import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; -import org.jdiameter.common.api.app.gx.IGxSessionData; -import org.jdiameter.common.api.app.rf.IRfSessionData; -import org.jdiameter.common.api.app.ro.IRoSessionData; -import org.jdiameter.common.api.app.rx.IRxSessionData; -import org.jdiameter.common.api.app.s13.IS13SessionData; -import org.jdiameter.common.api.app.sh.IShSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.jdiameter.common.impl.data.LocalDataSource; -import org.mobicents.cache.MobicentsCache; -import org.mobicents.cluster.DataRemovalListener; -import org.mobicents.cluster.DefaultMobicentsCluster; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.cluster.election.DefaultClusterElector; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.common.acc.AccReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.auth.AuthReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.cca.CCAReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.cxdx.CxDxReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.gx.GxReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.rf.RfReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.ro.RoReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.rx.RxReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.s13.S13ReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.sh.ShReplicatedSessionDataFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Replicated datasource implementation for {@link ISessionDatasource} - * - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ -public class ReplicatedSessionDatasource implements ISessionDatasource, DataRemovalListener { - - private static final Logger logger = LoggerFactory.getLogger(ReplicatedSessionDatasource.class); - public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-jbc.xml"; - private IContainer container; - private ISessionDatasource localDataSource; - - private DefaultMobicentsCluster mobicentsCluster; - private boolean localMode; - - // provided by impl, no way to change that, no conf! :) - protected HashMap, IAppSessionDataFactory> appSessionDataFactories = - new HashMap, IAppSessionDataFactory>(); - - // Constants - // ---------------------------------------------------------------- - public static final String SESSIONS = "/diameter/appsessions"; - public static final Fqn SESSIONS_FQN = Fqn.fromString(SESSIONS); - - public ReplicatedSessionDatasource(IContainer container) { - this(container, new LocalDataSource(), ReplicatedSessionDatasource.class.getClassLoader().getResource(CLUSTER_DS_DEFAULT_FILE) == null ? - "config/" + CLUSTER_DS_DEFAULT_FILE : CLUSTER_DS_DEFAULT_FILE); - } - - public ReplicatedSessionDatasource(IContainer container, ISessionDatasource localDataSource, String cacheConfigFilename) { - super(); - this.localDataSource = localDataSource; - - MobicentsCache mcCache = new MobicentsCache(cacheConfigFilename); - TransactionManager txMgr = null; - try { - Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); - Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); - txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); - } - catch (Exception e) { - logger.debug("Could not fetch TxMgr. Not using one.", e); - // let's not have Tx Manager than... - } - - this.mobicentsCluster = new DefaultMobicentsCluster(mcCache, txMgr, new DefaultClusterElector()); - this.mobicentsCluster.addDataRemovalListener(this); // register, so we know WHEN some other node removes session. - this.mobicentsCluster.startCluster(); - - this.container = container; - // this is coded, its tied to specific impl of SessionDatasource - appSessionDataFactories.put(IAuthSessionData.class, new AuthReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IAccSessionData.class, new AccReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(ICCASessionData.class, new CCAReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IRoSessionData.class, new RoReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IRfSessionData.class, new RfReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IShSessionData.class, new ShReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(ICxDxSessionData.class, new CxDxReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IGxSessionData.class, new GxReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IRxSessionData.class, new RxReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IS13SessionData.class, new S13ReplicatedSessionDataFactory(this)); - - } - - @Override - public boolean exists(String sessionId) { - return this.localDataSource.exists(sessionId) ? true : this.existReplicated(sessionId); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#addSession(org.jdiameter .api.BaseSession) - */ - @Override - public void addSession(BaseSession session) { - // Simple as is, if its replicated, it will be already there :) - this.localDataSource.addSession(session); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#getSession(java.lang.String ) - */ - @Override - public BaseSession getSession(String sessionId) { - if (this.localDataSource.exists(sessionId)) { - return this.localDataSource.getSession(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - this.makeLocal(sessionId); - return this.localDataSource.getSession(sessionId); - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#getSessionListener(java .lang.String) - */ - @Override - public NetworkReqListener getSessionListener(String sessionId) { - if (this.localDataSource.exists(sessionId)) { - return this.localDataSource.getSessionListener(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - this.makeLocal(sessionId); - return this.localDataSource.getSessionListener(sessionId); - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSession(java.lang .String) - */ - @Override - public void removeSession(String sessionId) { - logger.debug("removeSession({}) in Local DataSource", sessionId); - - if (this.localDataSource.exists(sessionId)) { - this.localDataSource.removeSession(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - // FIXME: remove node. - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSessionListener( java.lang.String) - */ - @Override - public NetworkReqListener removeSessionListener(String sessionId) { - if (this.localDataSource.exists(sessionId)) { - return this.localDataSource.removeSessionListener(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - // does not make much sense ;[ - this.makeLocal(sessionId); - return this.localDataSource.removeSessionListener(sessionId); - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#setSessionListener(java .lang.String, org.jdiameter.api.NetworkReqListener) - */ - @Override - public void setSessionListener(String sessionId, NetworkReqListener data) { - if (this.localDataSource.exists(sessionId)) { - this.localDataSource.setSessionListener(sessionId, data); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - // does not make much sense ;[ - this.makeLocal(sessionId); - this.localDataSource.setSessionListener(sessionId, data); - } - } - - @Override - public void start() { - mobicentsCluster.getMobicentsCache().startCache(); - localMode = mobicentsCluster.getMobicentsCache().isLocalMode(); - } - - @Override - public void stop() { - mobicentsCluster.getMobicentsCache().stopCache(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.data.ISessionDatasource#isClustered() - */ - @Override - public boolean isClustered() { - return !localMode; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.data.ISessionDatasource#getDataFactory(java. lang.Class) - */ - @Override - public IAppSessionDataFactory getDataFactory(Class x) { - return this.appSessionDataFactories.get(x); - } - - // remove lst; - - public MobicentsCluster getMobicentsCluster() { - return this.mobicentsCluster; - } - - @Override - public void dataRemoved(Fqn sessionFqn) { - String sessionId = (String) sessionFqn.getLastElement(); - this.localDataSource.removeSession(sessionId); - } - - @Override - public Fqn getBaseFqn() { - return SESSIONS_FQN; - } - - /** - * @param sessionId - * @return - */ - private boolean existReplicated(String sessionId) { - if (!this.localMode && this.mobicentsCluster.getMobicentsCache().getJBossCache().getNode(Fqn.fromRelativeElements(SESSIONS_FQN, sessionId)) != null) { - return true; - } - return false; - } - - /** - * @param sessionId - */ - private void makeLocal(String sessionId) { - try { - // this is APP session, always - Class appSessionInterfaceClass = - AppSessionDataReplicatedImpl.getAppSessionIface(this.mobicentsCluster.getMobicentsCache(), sessionId); - // get factory; - // FIXME: make it a field? - IAppSessionFactory fct = ((ISessionFactory) this.container.getSessionFactory()).getAppSessionFactory(appSessionInterfaceClass); - if (fct == null) { - logger.warn("Session with id:{}, is in replicated data source, but no Application Session Factory for:{}.", sessionId, appSessionInterfaceClass); - return; - } - else { - BaseSession session = fct.getSession(sessionId, appSessionInterfaceClass); - this.localDataSource.addSession(session); - // hmmm - this.localDataSource.setSessionListener(sessionId, (NetworkReqListener) session); - return; - } - } - catch (IllegalDiameterStateException e) { - if (logger.isErrorEnabled()) { - logger.error("Failed to obtain factory from stack..."); - } - } - } - - // ------- local getter - - public IContainer getContainer() { - return this.container; - } -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java deleted file mode 100644 index 0a20e90fe..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java +++ /dev/null @@ -1,191 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.acc; - -import java.io.Serializable; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.acc.ServerAccSession; -import org.jdiameter.common.api.app.acc.ServerAccSessionState; -import org.jdiameter.server.impl.app.acc.IServerAccSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAccSessionData { - - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - private static final String TS_TIMEOUT = "TS_TIMEOUT"; - private static final String TS_TIMERID = "TS_TIMERID"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerAccSession.class); - setServerAccSessionState(ServerAccSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerAccSessionState getServerAccSessionState() { - if (exists()) { - return (ServerAccSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerAccSessionState(ServerAccSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimeout(long value) { - if (exists()) { - getNode().put(TS_TIMEOUT, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public long getTsTimeout() { - if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimerId(Serializable value) { - if (exists()) { - getNode().put(TS_TIMERID, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java deleted file mode 100644 index b49d2bc8c..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java +++ /dev/null @@ -1,191 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.auth; - -import java.io.Serializable; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.auth.ServerAuthSession; -import org.jdiameter.common.api.app.auth.ServerAuthSessionState; -import org.jdiameter.server.impl.app.auth.IServerAuthSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAuthSessionData { - - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - private static final String TS_TIMEOUT = "TS_TIMEOUT"; - private static final String TS_TIMERID = "TS_TIMERID"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerAuthSession.class); - setServerAuthSessionState(ServerAuthSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerAuthSessionState getServerAuthSessionState() { - if (exists()) { - return (ServerAuthSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerAuthSessionState(ServerAuthSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimeout(long value) { - if (exists()) { - getNode().put(TS_TIMEOUT, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public long getTsTimeout() { - if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimerId(Serializable value) { - if (exists()) { - getNode().put(TS_TIMERID, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java deleted file mode 100644 index d6c691fb3..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java +++ /dev/null @@ -1,180 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.cca; - -import java.io.Serializable; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.cca.ServerCCASession; -import org.jdiameter.common.api.app.cca.ServerCCASessionState; -import org.jdiameter.server.impl.app.cca.IServerCCASessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerCCASessionData { - - private static final String TCCID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerCCASession.class); - setServerCCASessionState(ServerCCASessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerCCASessionState getServerCCASessionState() { - if (exists()) { - return (ServerCCASessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerCCASessionState(ServerCCASessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTccTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TCCID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTccTimerId() { - if (exists()) { - return (Serializable) getNode().get(TCCID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java deleted file mode 100644 index 370d1b26b..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,84 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.cxdx; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.cxdx.ServerCxDxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.common.api.app.cxdx.CxDxSessionState; -import org.jdiameter.server.impl.app.cxdx.IServerCxDxSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IServerCxDxSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ServerCxDxSession.class); - setCxDxSessionState(CxDxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java deleted file mode 100644 index 7405e4060..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,182 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.gx; - -import java.io.Serializable; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.gx.ServerGxSession; -import org.jdiameter.common.api.app.gx.ServerGxSessionState; -import org.jdiameter.server.impl.app.gx.IServerGxSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerGxSessionData { - - private static final String TCCID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerGxSession.class); - setServerGxSessionState(ServerGxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerGxSessionState getServerGxSessionState() { - if (exists()) { - return (ServerGxSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerGxSessionState(ServerGxSessionState state) { - - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTccTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TCCID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTccTimerId() { - if (exists()) { - return (Serializable) getNode().get(TCCID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java deleted file mode 100644 index 18ff9f6f4..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java +++ /dev/null @@ -1,211 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.rf; - -import java.io.Serializable; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.rf.ServerRfSession; -import org.jdiameter.common.api.app.rf.ServerRfSessionState; -import org.jdiameter.server.impl.app.rf.IServerRfSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRfSessionData { - - private static final String TS_TIMERID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - private static final String TS_TIMEOUT = "TS_TIMEOUT"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerRfSession.class); - setServerRfSessionState(ServerRfSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerRfSessionState getServerRfSessionState() { - if (exists()) { - return (ServerRfSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerRfSessionState(ServerRfSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TS_TIMERID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#getTsTimeout() - */ - @Override - public long getTsTimeout() { - if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#setTsTimeout(long) - */ - @Override - public void setTsTimeout(long l) { - if (exists()) { - getNode().put(TS_TIMEOUT, l); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java deleted file mode 100644 index 20217710f..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java +++ /dev/null @@ -1,180 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.ro; - -import java.io.Serializable; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.ro.ServerRoSession; -import org.jdiameter.common.api.app.ro.ServerRoSessionState; -import org.jdiameter.server.impl.app.ro.IServerRoSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRoSessionData { - - private static final String TCCID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerRoSession.class); - setServerRoSessionState(ServerRoSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerRoSessionState getServerRoSessionState() { - if (exists()) { - return (ServerRoSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerRoSessionState(ServerRoSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTccTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TCCID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTccTimerId() { - if (exists()) { - return (Serializable) getNode().get(TCCID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java deleted file mode 100644 index 5a2f1460d..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,144 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.rx; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.rx.ServerRxSession; -import org.jdiameter.common.api.app.rx.ServerRxSessionState; -import org.jdiameter.server.impl.app.rx.IServerRxSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRxSessionData { - - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerRxSession.class); - setServerRxSessionState(ServerRxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerRxSessionState getServerRxSessionState() { - if (exists()) { - return (ServerRxSessionState) getNode().get(STATE); - } else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerRxSessionState(ServerRxSessionState state) { - - if (exists()) { - getNode().put(STATE, state); - } else { - throw new IllegalStateException(); - } - - } -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java deleted file mode 100644 index ce344e407..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.server.s13; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.s13.ServerS13Session; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.common.api.app.s13.S13SessionState; -import org.jdiameter.server.impl.app.s13.IServerS13SessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IServerS13SessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ServerS13Session.class); - setS13SessionState(S13SessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java deleted file mode 100644 index b41789c99..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java +++ /dev/null @@ -1,81 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.sh; - -import org.jboss.cache.Fqn; -import org.jdiameter.api.sh.ServerShSession; -import org.jdiameter.server.impl.app.sh.IShServerSessionData; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ShServerSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShServerSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerShSession.class); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ShServerSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java deleted file mode 100644 index 919d748b0..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java +++ /dev/null @@ -1,77 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.timer; - -import java.io.Serializable; - -import org.mobicents.timers.PeriodicScheduleStrategy; -import org.mobicents.timers.TimerTaskData; - -/** - * Diameter timer task data holder. - * - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ -final class DiameterTimerTaskData extends TimerTaskData { - - private static final long serialVersionUID = 8774218122384404225L; - - // data we need to recreate timer task - private String sessionId; - private String timerName; - - DiameterTimerTaskData(Serializable id, long delay, String sessionId, String timerName) { - super(id, System.currentTimeMillis() + delay, -1, PeriodicScheduleStrategy.withFixedDelay); - this.sessionId = sessionId; - this.timerName = timerName; - } - - public String getSessionId() { - return sessionId; - } - - public String getTimerName() { - return timerName; - } -} diff --git a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java b/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java deleted file mode 100644 index 9f4a92242..000000000 --- a/core/jdiameter-ha/impl-jboss5/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java +++ /dev/null @@ -1,147 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.timer; - -import java.io.Serializable; - -import org.jdiameter.api.BaseSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.jdiameter.common.api.timer.ITimerFacility; -import org.jdiameter.common.impl.app.AppSessionImpl; -import org.mobicents.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.timers.FaultTolerantScheduler; -import org.mobicents.timers.TimerTask; -import org.mobicents.timers.TimerTaskData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Replicated implementation of {@link ITimerFacility} - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ReplicatedTimerFacilityImpl implements ITimerFacility { - - private static final Logger logger = LoggerFactory.getLogger(ReplicatedTimerFacilityImpl.class); - - private ISessionDatasource sessionDataSource; - private TimerTaskFactory taskFactory; - private FaultTolerantScheduler ftScheduler; - - public ReplicatedTimerFacilityImpl(IContainer container) { - super(); - this.sessionDataSource = container.getAssemblerFacility().getComponentInstance(ISessionDatasource.class); - this.taskFactory = new TimerTaskFactory(); - MobicentsCluster cluster = ((ReplicatedSessionDatasource) this.sessionDataSource).getMobicentsCluster(); - this.ftScheduler = new FaultTolerantScheduler("DiameterTimer", 5, cluster, (byte) 12, null, this.taskFactory); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.timer.ITimerFacility#cancel(java.io.Serializable) - */ - @Override - public void cancel(Serializable id) { - logger.debug("Cancelling timer with id {}", id); - this.ftScheduler.cancel(id); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.timer.ITimerFacility#schedule(java.lang.String, java.lang.String, long) - */ - @Override - public Serializable schedule(String sessionId, String timerName, long miliseconds) throws IllegalArgumentException { - String id = sessionId + "/" + timerName; - logger.debug("Scheduling timer with id {}", id); - - if (this.ftScheduler.getTimerTaskData(id) != null) { - throw new IllegalArgumentException("Timer already running: " + id); - } - - DiameterTimerTaskData data = new DiameterTimerTaskData(id, miliseconds, sessionId, timerName); - TimerTask tt = this.taskFactory.newTimerTask(data); - ftScheduler.schedule(tt); - return id; - } - - private final class TimerTaskFactory implements org.mobicents.timers.TimerTaskFactory { - - @Override - public TimerTask newTimerTask(TimerTaskData data) { - return new DiameterTimerTask(data); - } - } - - private final class DiameterTimerTask extends TimerTask { - - DiameterTimerTask(TimerTaskData data) { - super(data); - } - - @Override - public void runTask() { - try { - DiameterTimerTaskData data = (DiameterTimerTaskData) getData(); - BaseSession bSession = sessionDataSource.getSession(data.getSessionId()); - if (bSession == null || !bSession.isAppSession()) { - // FIXME: error ? - return; - } - else { - AppSessionImpl impl = (AppSessionImpl) bSession; - impl.onTimer(data.getTimerName()); - } - } - catch (Exception e) { - logger.error("Failure executing timer task", e); - } - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/pom.xml b/core/jdiameter-ha/impl-wildfly/pom.xml deleted file mode 100644 index 74a55d071..000000000 --- a/core/jdiameter-ha/impl-wildfly/pom.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - 4.0.0 - - - org.mobicents.diameter - jdiameter-ha-parent - 1.7.0-SNAPSHOT - ../pom.xml - - - jdiameter-ha-impl-wildfly - - Restcomm :: Diameter Stack HA :: ${project.artifactId} - - - - ${project.groupId} - jdiameter-ha-api - ${project.version} - - - - org.mobicents.diameter - jdiameter-impl - - - - - org.jboss.logging - jboss-logging - - - - org.infinispan - infinispan-core - - - org.infinispan - infinispan-tree - - - - org.restcomm.cluster - cache - - - - org.restcomm.cluster - timers - - - - diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java deleted file mode 100644 index 17ea70d27..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java +++ /dev/null @@ -1,260 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.acc; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.acc.ClientAccSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.acc.IClientAccSessionData; -import org.jdiameter.common.api.app.acc.ClientAccSessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAccSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientAccSessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String INTERIM_TIMERID = "INTERIM_TIMERID"; - private static final String DEST_HOST = "DEST_HOST"; - private static final String DEST_REALM = "DEST_REALM"; - private static final String BUFFER = "BUFFER"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientAccSession.class); - setClientAccSessionState(ClientAccSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setClientAccSessionState - * (org.jdiameter.common.api.app.acc.ClientAccSessionState) - */ - @Override - public void setClientAccSessionState(ClientAccSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getClientAccSessionState() - */ - @Override - public ClientAccSessionState getClientAccSessionState() { - if (exists()) { - return (ClientAccSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setInterimTimerId(java.io.Serializable) - */ - @Override - public void setInterimTimerId(Serializable tid) { - if (exists()) { - getNode().put(INTERIM_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getInterimTimerId() - */ - @Override - public Serializable getInterimTimerId() { - if (exists()) { - return (Serializable) getNode().get(INTERIM_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationHost(java.lang.String) - */ - @Override - public void setDestinationHost(String destHost) { - if (exists()) { - getNode().put(DEST_HOST, destHost); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationHost() - */ - @Override - public String getDestinationHost() { - if (exists()) { - return (String) getNode().get(DEST_HOST); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#setDestinationRealm(java.lang.String) - */ - @Override - public void setDestinationRealm(String destRealm) { - if (exists()) { - getNode().put(DEST_REALM, destRealm); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.acc.IClientAccSessionData#getDestinationRealm() - */ - @Override - public String getDestinationRealm() { - if (exists()) { - return (String) getNode().get(DEST_REALM); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java deleted file mode 100644 index def90f47d..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java +++ /dev/null @@ -1,243 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.auth; - -import java.io.Serializable; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.auth.ClientAuthSession; -import org.jdiameter.client.impl.app.auth.IClientAuthSessionData; -import org.jdiameter.common.api.app.auth.ClientAuthSessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientAuthSessionData { - - private static final String STATE = "STATE"; - private static final String DESTINATION_HOST = "DESTINATION_HOST"; - private static final String DESTINATION_REALM = "DESTINATION_REALM"; - private static final String STATELESS = "STATELESS"; - private static final String TS_TIMERID = "TS_TIMERID"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientAuthSession.class); - setClientAuthSessionState(ClientAuthSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setClientAuthSessionState(org.jdiameter.common.api.app.auth. - * ClientAuthSessionState) - */ - @Override - public void setClientAuthSessionState(ClientAuthSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getClientAuthSessionState() - */ - @Override - public ClientAuthSessionState getClientAuthSessionState() { - if (exists()) { - return (ClientAuthSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setStateless(boolean) - */ - @Override - public void setStateless(boolean b) { - if (exists()) { - getNode().put(STATELESS, b); - } - else { - throw new IllegalStateException(); - } - - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationHost() - */ - @Override - public String getDestinationHost() { - if (exists()) { - return (String) getNode().get(DESTINATION_HOST); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationHost(java.lang.String) - */ - @Override - public void setDestinationHost(String host) { - if (exists()) { - getNode().put(DESTINATION_HOST, host); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getDestinationRealm() - */ - @Override - public String getDestinationRealm() { - if (exists()) { - return (String) getNode().get(DESTINATION_REALM); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setDestinationRealm(java.lang.String) - */ - @Override - public void setDestinationRealm(String realm) { - if (exists()) { - getNode().put(DESTINATION_REALM, realm); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.auth.IClientAuthSessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java deleted file mode 100644 index 429a37979..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java +++ /dev/null @@ -1,327 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.cca; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.cca.ClientCCASession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.cca.IClientCCASessionData; -import org.jdiameter.common.api.app.cca.ClientCCASessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientCCASessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientCCASessionDataReplicatedImpl.class); - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - private static final String TXTIMER_ID = "TXTIMER_ID"; - private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; - private static final String BUFFER = "BUFFER"; - private static final String GRA = "GRA"; - private static final String GDDFH = "GDDFH"; - private static final String GCCFH = "GCCFH"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientCCASession.class); - setClientCCASessionState(ClientCCASessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ClientCCASessionState getClientCCASessionState() { - if (exists()) { - return (ClientCCASessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientCCASessionState(ClientCCASessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTxTimerId() { - if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerId(Serializable txTimerId) { - if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getTxTimerRequest() { - if (exists()) { - - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate Tx Timer Request from buffer."); - return null; - } - } - else { - return null; - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerRequest(Request txTimerRequest) { - if (exists()) { - if (txTimerRequest != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); - } - catch (ParseException e) { - logger.error("Unable to encode Tx Timer Request to buffer."); - } - } - else { - getNode().remove(TXTIMER_REQUEST); - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - @Override - public int getGatheredRequestedAction() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredRequestedAction(int gatheredRequestedAction) { - if (exists()) { - getNode().put(GRA, gatheredRequestedAction); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredCCFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredCCFH(int gatheredCCFH) { - if (exists()) { - getNode().put(GCCFH, gatheredCCFH); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredDDFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredDDFH(int gatheredDDFH) { - if (exists()) { - getNode().put(GDDFH, gatheredDDFH); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java deleted file mode 100644 index 1dc099d2c..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,84 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.cxdx; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.cxdx.ClientCxDxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.impl.app.cxdx.IClientCxDxSessionData; -import org.jdiameter.common.api.app.cxdx.CxDxSessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IClientCxDxSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ClientCxDxSession.class); - setCxDxSessionState(CxDxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java deleted file mode 100644 index 162498e6b..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,329 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.gx; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.gx.ClientGxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.gx.IClientGxSessionData; -import org.jdiameter.common.api.app.gx.ClientGxSessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientGxSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientGxSessionDataReplicatedImpl.class); - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - private static final String TXTIMER_ID = "TXTIMER_ID"; - private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; - private static final String BUFFER = "BUFFER"; - private static final String GRA = "GRA"; - private static final String GDDFH = "GDDFH"; - private static final String GCCFH = "GCCFH"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientGxSession.class); - setClientGxSessionState(ClientGxSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ClientGxSessionState getClientGxSessionState() { - if (exists()) { - return (ClientGxSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientGxSessionState(ClientGxSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTxTimerId() { - if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerId(Serializable txTimerId) { - if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getTxTimerRequest() { - if (exists()) { - - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate Tx Timer Request from buffer."); - return null; - } - } - else { - return null; - } - - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerRequest(Request txTimerRequest) { - if (exists()) { - if (txTimerRequest != null) { - - try { - byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); - } - catch (ParseException e) { - logger.error("Unable to encode Tx Timer Request to buffer."); - } - } - else { - getNode().remove(TXTIMER_REQUEST); - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - @Override - public int getGatheredRequestedAction() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredRequestedAction(int gatheredRequestedAction) { - if (exists()) { - getNode().put(GRA, gatheredRequestedAction); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredCCFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredCCFH(int gatheredCCFH) { - if (exists()) { - getNode().put(GCCFH, gatheredCCFH); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredDDFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredDDFH(int gatheredDDFH) { - if (exists()) { - getNode().put(GDDFH, gatheredDDFH); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java deleted file mode 100644 index a64773d30..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java +++ /dev/null @@ -1,249 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.rf; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.rf.ClientRfSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.rf.IClientRfSessionData; -import org.jdiameter.common.api.app.rf.ClientRfSessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRfSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientRfSessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String BUFFER = "BUFFER"; - private static final String TS_TIMERID = "TS_TIMERID"; - private static final String DESTINATION_HOST = "DESTINATION_HOST"; - private static final String DESTINATION_REALM = "DESTINATION_REALM"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientRfSession.class); - setClientRfSessionState(ClientRfSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public ClientRfSessionState getClientRfSessionState() { - if (exists()) { - return (ClientRfSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientRfSessionState(ClientRfSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationHost() - */ - @Override - public String getDestinationHost() { - if (exists()) { - return (String) getNode().get(DESTINATION_HOST); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationHost(java.lang.String) - */ - @Override - public void setDestinationHost(String destinationHost) { - if (exists()) { - getNode().put(DESTINATION_HOST, destinationHost); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#getDestinationRealm() - */ - @Override - public String getDestinationRealm() { - if (exists()) { - return (String) getNode().get(DESTINATION_REALM); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.client.impl.app.rf.IClientRfSessionData#setDestinationRealm(java.lang.String) - */ - @Override - public void setDestinationRealm(String destinationRealm) { - if (exists()) { - getNode().put(DESTINATION_REALM, destinationRealm); - } - else { - throw new IllegalStateException(); - } - } -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java deleted file mode 100644 index 5118b4931..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java +++ /dev/null @@ -1,326 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.ro; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.api.ro.ClientRoSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.client.impl.app.ro.IClientRoSessionData; -import org.jdiameter.common.api.app.ro.ClientRoSessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRoSessionData { - - private static final Logger logger = LoggerFactory.getLogger(ClientRoSessionDataReplicatedImpl.class); - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - private static final String TXTIMER_ID = "TXTIMER_ID"; - private static final String TXTIMER_REQUEST = "TXTIMER_REQUEST"; - private static final String BUFFER = "BUFFER"; - private static final String GRA = "GRA"; - private static final String GDDFH = "GDDFH"; - private static final String GCCFH = "GCCFH"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientRoSession.class); - setClientRoSessionState(ClientRoSessionState.IDLE); - } - - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ClientRoSessionState getClientRoSessionState() { - if (exists()) { - return (ClientRoSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientRoSessionState(ClientRoSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTxTimerId() { - if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerId(Serializable txTimerId) { - if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getTxTimerRequest() { - if (exists()) { - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate Tx Timer Request from buffer."); - return null; - } - } - else { - return null; - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTxTimerRequest(Request txTimerRequest) { - if (exists()) { - if (txTimerRequest != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); - } - catch (ParseException e) { - logger.error("Unable to encode Tx Timer Request to buffer."); - } - } - else { - getNode().remove(TXTIMER_REQUEST); - } - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } - - @Override - public int getGatheredRequestedAction() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredRequestedAction(int gatheredRequestedAction) { - if (exists()) { - getNode().put(GRA, gatheredRequestedAction); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredCCFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredCCFH(int gatheredCCFH) { - if (exists()) { - getNode().put(GCCFH, gatheredCCFH); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public int getGatheredDDFH() { - if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setGatheredDDFH(int gatheredDDFH) { - if (exists()) { - getNode().put(GDDFH, gatheredDDFH); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java deleted file mode 100644 index 58f574133..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,141 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.rx; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.rx.ClientRxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.impl.app.rx.IClientRxSessionData; -import org.jdiameter.common.api.app.rx.ClientRxSessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IClientRxSessionData { - - private static final String EVENT_BASED = "EVENT_BASED"; - private static final String REQUEST_TYPE = "REQUEST_TYPE"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientRxSession.class); - setClientRxSessionState(ClientRxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - - @Override - public boolean isEventBased() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); - } else { - throw new IllegalStateException(); - } - } - - @Override - public void setEventBased(boolean isEventBased) { - if (exists()) { - getNode().put(EVENT_BASED, isEventBased); - } else { - throw new IllegalStateException(); - } - } - - @Override - public boolean isRequestTypeSet() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); - } else { - throw new IllegalStateException(); - } - } - - @Override - public void setRequestTypeSet(boolean requestTypeSet) { - if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); - } else { - throw new IllegalStateException(); - } - } - - @Override - public ClientRxSessionState getClientRxSessionState() { - if (exists()) { - return (ClientRxSessionState) getNode().get(STATE); - } else { - throw new IllegalStateException(); - } - } - - @Override - public void setClientRxSessionState(ClientRxSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } else { - throw new IllegalStateException(); - } - } -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java deleted file mode 100644 index e12d80d81..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.client.s13; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.s13.ClientS13Session; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.impl.app.s13.IClientS13SessionData; -import org.jdiameter.common.api.app.s13.S13SessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ClientS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IClientS13SessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ClientS13Session.class); - setS13SessionState(S13SessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ClientS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java deleted file mode 100644 index f2edc2f54..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java +++ /dev/null @@ -1,81 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.client.sh; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.sh.ClientShSession; -import org.jdiameter.client.impl.app.sh.IShClientSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ShClientSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShClientSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ClientShSession.class); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ShClientSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java deleted file mode 100644 index 8b1cfc279..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java +++ /dev/null @@ -1,132 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.ApplicationId; -import org.jdiameter.api.app.AppSession; -import org.jdiameter.common.api.app.IAppSessionData; -import org.restcomm.cache.MobicentsCache; -import org.restcomm.cluster.MobicentsCluster; -import org.restcomm.cluster.cache.ClusteredCacheData; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class AppSessionDataReplicatedImpl extends ClusteredCacheData implements IAppSessionData { - - protected static final String SID = "SID"; - protected static final String APID = "APID"; - protected static final String SIFACE = "SIFACE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - */ - public AppSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - } - - public AppSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - public static void setAppSessionIface(ClusteredCacheData ccd, Class iface) { - //Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); - //n.put(SIFACE, iface); - ccd.getMobicentsCache().getJBossCache() - .getNode(ccd.getNodeFqn()) - .put(SIFACE, iface); - } - - public static Class getAppSessionIface(MobicentsCache mcCache, String sessionId) { - //Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); - //return (Class) n.get(SIFACE); - return (Class) mcCache.getJBossCache() - .getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)) - .get(SIFACE); - } - - @Override - public String getSessionId() { - return (String) super.getNodeFqn().getLastElement(); - } - - @Override - public void setApplicationId(ApplicationId applicationId) { - if (exists()) { - getNode().put(APID, applicationId); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public ApplicationId getApplicationId() { - if (exists()) { - return (ApplicationId) getNode().get(APID); - } - else { - throw new IllegalStateException(); - } - } - - // Some util methods for handling primitives - - protected boolean toPrimitive(Boolean b, boolean _default) { - return b == null ? _default : b; - } - - protected int toPrimitive(Integer i) { - return i == null ? NON_INITIALIZED : i; - } - - protected long toPrimitive(Long l) { - return l == null ? NON_INITIALIZED : l; - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java deleted file mode 100644 index c051a2d83..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/acc/AccReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.acc; - -import org.jdiameter.api.acc.ClientAccSession; -import org.jdiameter.api.acc.ServerAccSession; -import org.jdiameter.api.app.AppSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.acc.IAccSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.acc.ClientAccSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.acc.ServerAccSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class AccReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public AccReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IAccSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientAccSession.class)) { - ClientAccSessionDataReplicatedImpl data = - new ClientAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerAccSession.class)) { - ServerAccSessionDataReplicatedImpl data = new ServerAccSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java deleted file mode 100644 index 583c4139e..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/auth/AuthReplicatedSessionDataFactory.java +++ /dev/null @@ -1,92 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.auth; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.auth.ClientAuthSession; -import org.jdiameter.api.auth.ServerAuthSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.auth.IAuthSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.auth.ClientAuthSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.auth.ServerAuthSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class AuthReplicatedSessionDataFactory implements IAppSessionDataFactory { - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public AuthReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IAuthSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientAuthSession.class)) { - ClientAuthSessionDataReplicatedImpl data = new ClientAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - else if (clazz.equals(ServerAuthSession.class)) { - ServerAuthSessionDataReplicatedImpl data = new ServerAuthSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java deleted file mode 100644 index 893620001..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cca/CCAReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.cca; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.cca.ClientCCASession; -import org.jdiameter.api.cca.ServerCCASession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.cca.ICCASessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.cca.ClientCCASessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.cca.ServerCCASessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class CCAReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public CCAReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public ICCASessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientCCASession.class)) { - ClientCCASessionDataReplicatedImpl data = - new ClientCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerCCASession.class)) { - ServerCCASessionDataReplicatedImpl data = new ServerCCASessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java deleted file mode 100644 index bfbda64ae..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxReplicatedSessionDataFactory.java +++ /dev/null @@ -1,95 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.cxdx; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.cxdx.ClientCxDxSession; -import org.jdiameter.api.cxdx.ServerCxDxSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.cxdx.ClientCxDxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.cxdx.ServerCxDxSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class CxDxReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public CxDxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public ICxDxSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientCxDxSession.class)) { - ClientCxDxSessionDataReplicatedImpl data = - new ClientCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerCxDxSession.class)) { - ServerCxDxSessionDataReplicatedImpl data = - new ServerCxDxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java deleted file mode 100644 index a42a38562..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,179 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.cxdx; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.common.api.app.cxdx.CxDxSessionState; -import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public abstract class CxDxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements ICxDxSessionData { - - private static final Logger logger = LoggerFactory.getLogger(CxDxSessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String BUFFER = "BUFFER"; - private static final String TS_TIMERID = "TS_TIMERID"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setCxDxSessionState(org.jdiameter.common.api.app.cxdx.CxDxSessionState) - */ - @Override - public void setCxDxSessionState(CxDxSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getCxDxSessionState() - */ - @Override - public CxDxSessionState getCxDxSessionState() { - if (exists()) { - return (CxDxSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.cxdx.ICxDxSessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java deleted file mode 100644 index 1a66a51cf..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/gx/GxReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.gx; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.gx.ClientGxSession; -import org.jdiameter.api.gx.ServerGxSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.gx.IGxSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.gx.ClientGxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.gx.ServerGxSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class GxReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public GxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IGxSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientGxSession.class)) { - ClientGxSessionDataReplicatedImpl data = - new ClientGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerGxSession.class)) { - ServerGxSessionDataReplicatedImpl data = new ServerGxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java deleted file mode 100644 index 951908d0a..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rf/RfReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.rf; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.rf.ClientRfSession; -import org.jdiameter.api.rf.ServerRfSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.rf.IRfSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.rf.ClientRfSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.rf.ServerRfSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class RfReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public RfReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IRfSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientRfSession.class)) { - ClientRfSessionDataReplicatedImpl data = - new ClientRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerRfSession.class)) { - ServerRfSessionDataReplicatedImpl data = new ServerRfSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java deleted file mode 100644 index a3f4f4e64..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/ro/RoReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.ro; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.ro.ClientRoSession; -import org.jdiameter.api.ro.ServerRoSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.ro.IRoSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.ro.ClientRoSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.ro.ServerRoSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class RoReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public RoReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IRoSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientRoSession.class)) { - ClientRoSessionDataReplicatedImpl data = - new ClientRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerRoSession.class)) { - ServerRoSessionDataReplicatedImpl data = new ServerRoSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java deleted file mode 100644 index d7704e58b..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/rx/RxReplicatedSessionDataFactory.java +++ /dev/null @@ -1,94 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.rx; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.rx.ClientRxSession; -import org.jdiameter.api.rx.ServerRxSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.rx.IRxSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.rx.ClientRxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.rx.ServerRxSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class RxReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public RxReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IRxSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientRxSession.class)) { - ClientRxSessionDataReplicatedImpl data = - new ClientRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerRxSession.class)) { - ServerRxSessionDataReplicatedImpl data = new ServerRxSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java deleted file mode 100644 index 3c0291153..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13ReplicatedSessionDataFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.common.s13; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.s13.ClientS13Session; -import org.jdiameter.api.s13.ServerS13Session; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.s13.IS13SessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.s13.ClientS13SessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.s13.ServerS13SessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class S13ReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public S13ReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData(java.lang.Class, java.lang.String) - */ - @Override - public IS13SessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientS13Session.class)) { - ClientS13SessionDataReplicatedImpl data = - new ClientS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - else if (clazz.equals(ServerS13Session.class)) { - ServerS13SessionDataReplicatedImpl data = - new ServerS13SessionDataReplicatedImpl(sessionId, this.mobicentsCluster, this.replicatedSessionDataSource.getContainer()); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java deleted file mode 100644 index d868756e4..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java +++ /dev/null @@ -1,156 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.common.s13; - -import java.io.Serializable; -import java.nio.ByteBuffer; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.AvpDataException; -import org.jdiameter.api.Request; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.IMessage; -import org.jdiameter.client.api.parser.IMessageParser; -import org.jdiameter.client.api.parser.ParseException; -import org.jdiameter.common.api.app.s13.IS13SessionData; -import org.jdiameter.common.api.app.s13.S13SessionState; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public abstract class S13SessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IS13SessionData { - - private static final Logger logger = LoggerFactory.getLogger(S13SessionDataReplicatedImpl.class); - - private static final String STATE = "STATE"; - private static final String BUFFER = "BUFFER"; - private static final String TS_TIMERID = "TS_TIMERID"; - - private IMessageParser messageParser; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); - this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#setS13SessionState(org.jdiameter.common.api.app.s13.S13SessionState) - */ - @Override - public void setS13SessionState(S13SessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#getS13SessionState() - */ - @Override - public S13SessionState getS13SessionState() { - if (exists()) { - return (S13SessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#getTsTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.s13.IS13SessionData#setTsTimerId(java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tid) { - if (exists()) { - getNode().put(TS_TIMERID, tid); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); - if (data != null) { - try { - return this.messageParser.createMessage(ByteBuffer.wrap(data)); - } - catch (AvpDataException e) { - logger.error("Unable to recreate message from buffer."); - return null; - } - } - else { - return null; - } - } - - @Override - public void setBuffer(Request buffer) { - if (buffer != null) { - try { - byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); - } - catch (ParseException e) { - logger.error("Unable to encode message to buffer."); - } - } - else { - getNode().remove(BUFFER); - } - } -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java deleted file mode 100644 index bab353670..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/common/sh/ShReplicatedSessionDataFactory.java +++ /dev/null @@ -1,93 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.common.sh; - -import org.jdiameter.api.app.AppSession; -import org.jdiameter.api.sh.ClientShSession; -import org.jdiameter.api.sh.ServerShSession; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.sh.IShSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.client.sh.ShClientSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.mobicents.diameter.impl.ha.server.sh.ShServerSessionDataReplicatedImpl; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ShReplicatedSessionDataFactory implements IAppSessionDataFactory { - - private ReplicatedSessionDatasource replicatedSessionDataSource; - private MobicentsCluster mobicentsCluster; - - /** - * @param replicatedSessionDataSource - */ - public ShReplicatedSessionDataFactory(ISessionDatasource replicatedSessionDataSource) { // Is this ok? - super(); - this.replicatedSessionDataSource = (ReplicatedSessionDatasource) replicatedSessionDataSource; - this.mobicentsCluster = this.replicatedSessionDataSource.getMobicentsCluster(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.app.IAppSessionDataFactory#getAppSessionData (java.lang.Class, java.lang.String) - */ - @Override - public IShSessionData getAppSessionData(Class clazz, String sessionId) { - if (clazz.equals(ClientShSession.class)) { - ShClientSessionDataReplicatedImpl data = new ShClientSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - else if (clazz.equals(ServerShSession.class)) { - ShServerSessionDataReplicatedImpl data = new ShServerSessionDataReplicatedImpl(sessionId, this.mobicentsCluster); - return data; - } - throw new IllegalArgumentException(); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java deleted file mode 100644 index fa52ea2a9..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java +++ /dev/null @@ -1,356 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.data; - -import java.util.HashMap; - -import javax.transaction.TransactionManager; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.BaseSession; -import org.jdiameter.api.IllegalDiameterStateException; -import org.jdiameter.api.NetworkReqListener; -import org.jdiameter.api.app.AppSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.client.api.ISessionFactory; -import org.jdiameter.common.api.app.IAppSessionData; -import org.jdiameter.common.api.app.IAppSessionDataFactory; -import org.jdiameter.common.api.app.IAppSessionFactory; -import org.jdiameter.common.api.app.acc.IAccSessionData; -import org.jdiameter.common.api.app.auth.IAuthSessionData; -import org.jdiameter.common.api.app.cca.ICCASessionData; -import org.jdiameter.common.api.app.cxdx.ICxDxSessionData; -import org.jdiameter.common.api.app.gx.IGxSessionData; -import org.jdiameter.common.api.app.rf.IRfSessionData; -import org.jdiameter.common.api.app.ro.IRoSessionData; -import org.jdiameter.common.api.app.rx.IRxSessionData; -import org.jdiameter.common.api.app.s13.IS13SessionData; -import org.jdiameter.common.api.app.sh.IShSessionData; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.jdiameter.common.impl.data.LocalDataSource; -import org.restcomm.cache.MobicentsCache; -import org.restcomm.cluster.DataRemovalListener; -import org.restcomm.cluster.DefaultMobicentsCluster; -import org.restcomm.cluster.MobicentsCluster; -import org.restcomm.cluster.election.DefaultClusterElector; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.common.acc.AccReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.auth.AuthReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.cca.CCAReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.cxdx.CxDxReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.gx.GxReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.rf.RfReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.ro.RoReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.rx.RxReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.s13.S13ReplicatedSessionDataFactory; -import org.mobicents.diameter.impl.ha.common.sh.ShReplicatedSessionDataFactory; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Replicated datasource implementation for {@link ISessionDatasource} - * - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ -public class ReplicatedSessionDatasource implements ISessionDatasource, DataRemovalListener { - - private static final Logger logger = LoggerFactory.getLogger(ReplicatedSessionDatasource.class); - public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-infinispan.xml"; - private IContainer container; - private ISessionDatasource localDataSource; - - private DefaultMobicentsCluster mobicentsCluster; - private boolean localMode; - - // provided by impl, no way to change that, no conf! :) - protected HashMap, IAppSessionDataFactory> appSessionDataFactories = - new HashMap, IAppSessionDataFactory>(); - - // Constants - // ---------------------------------------------------------------- - public static final String SESSIONS = "/diameter/appsessions"; - public static final Fqn SESSIONS_FQN = Fqn.fromString(SESSIONS); - - public ReplicatedSessionDatasource(IContainer container) { - this(container, new LocalDataSource(), ReplicatedSessionDatasource.class.getClassLoader().getResource(CLUSTER_DS_DEFAULT_FILE) == null ? - "config/" + CLUSTER_DS_DEFAULT_FILE : CLUSTER_DS_DEFAULT_FILE); - } - - public ReplicatedSessionDatasource(IContainer container, ISessionDatasource localDataSource, String cacheConfigFilename) { - super(); - this.localDataSource = localDataSource; - - MobicentsCache mcCache = null; - TransactionManager txMgr = null; - try { - mcCache = new MobicentsCache(cacheConfigFilename); - //Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); - //Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); - //txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); - txMgr = mcCache.getJBossCache().getCache().getAdvancedCache().getTransactionManager(); - } - catch (Exception e) { - logger.debug("Could not fetch TxMgr. Not using one.", e); - // let's not have Tx Manager than... - } - - this.mobicentsCluster = new DefaultMobicentsCluster(mcCache, txMgr, new DefaultClusterElector()); - this.mobicentsCluster.addDataRemovalListener(this); // register, so we know WHEN some other node removes session. - this.mobicentsCluster.startCluster(); - - this.container = container; - // this is coded, its tied to specific impl of SessionDatasource - appSessionDataFactories.put(IAuthSessionData.class, new AuthReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IAccSessionData.class, new AccReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(ICCASessionData.class, new CCAReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IRoSessionData.class, new RoReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IRfSessionData.class, new RfReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IShSessionData.class, new ShReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(ICxDxSessionData.class, new CxDxReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IGxSessionData.class, new GxReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IRxSessionData.class, new RxReplicatedSessionDataFactory(this)); - appSessionDataFactories.put(IS13SessionData.class, new S13ReplicatedSessionDataFactory(this)); - - } - - @Override - public boolean exists(String sessionId) { - return this.localDataSource.exists(sessionId) ? true : this.existReplicated(sessionId); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#addSession(org.jdiameter .api.BaseSession) - */ - @Override - public void addSession(BaseSession session) { - // Simple as is, if its replicated, it will be already there :) - this.localDataSource.addSession(session); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#getSession(java.lang.String ) - */ - @Override - public BaseSession getSession(String sessionId) { - if (this.localDataSource.exists(sessionId)) { - return this.localDataSource.getSession(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - this.makeLocal(sessionId); - return this.localDataSource.getSession(sessionId); - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#getSessionListener(java .lang.String) - */ - @Override - public NetworkReqListener getSessionListener(String sessionId) { - if (this.localDataSource.exists(sessionId)) { - return this.localDataSource.getSessionListener(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - this.makeLocal(sessionId); - return this.localDataSource.getSessionListener(sessionId); - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSession(java.lang .String) - */ - @Override - public void removeSession(String sessionId) { - logger.debug("removeSession({}) in Local DataSource", sessionId); - - if (this.localDataSource.exists(sessionId)) { - this.localDataSource.removeSession(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - // FIXME: remove node. - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#removeSessionListener( java.lang.String) - */ - @Override - public NetworkReqListener removeSessionListener(String sessionId) { - if (this.localDataSource.exists(sessionId)) { - return this.localDataSource.removeSessionListener(sessionId); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - // does not make much sense ;[ - this.makeLocal(sessionId); - return this.localDataSource.removeSessionListener(sessionId); - } - - return null; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.ha.ISessionDatasource#setSessionListener(java .lang.String, org.jdiameter.api.NetworkReqListener) - */ - @Override - public void setSessionListener(String sessionId, NetworkReqListener data) { - if (this.localDataSource.exists(sessionId)) { - this.localDataSource.setSessionListener(sessionId, data); - } - else if (!this.localMode && this.existReplicated(sessionId)) { - // does not make much sense ;[ - this.makeLocal(sessionId); - this.localDataSource.setSessionListener(sessionId, data); - } - } - - @Override - public void start() { - mobicentsCluster.getMobicentsCache().startCache(); - localMode = mobicentsCluster.getMobicentsCache().isLocalMode(); - } - - @Override - public void stop() { - mobicentsCluster.getMobicentsCache().stopCache(); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.data.ISessionDatasource#isClustered() - */ - @Override - public boolean isClustered() { - return !localMode; - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.data.ISessionDatasource#getDataFactory(java. lang.Class) - */ - @Override - public IAppSessionDataFactory getDataFactory(Class x) { - return this.appSessionDataFactories.get(x); - } - - // remove lst; - - public MobicentsCluster getMobicentsCluster() { - return this.mobicentsCluster; - } - - @Override - public void dataRemoved(Fqn sessionFqn) { - String sessionId = (String) sessionFqn.getLastElement(); - this.localDataSource.removeSession(sessionId); - } - - @Override - public Fqn getBaseFqn() { - return SESSIONS_FQN; - } - - /** - * @param sessionId - * @return - */ - private boolean existReplicated(String sessionId) { - if (!this.localMode && this.mobicentsCluster.getMobicentsCache().getJBossCache().getNode(Fqn.fromRelativeElements(SESSIONS_FQN, sessionId)) != null) { - return true; - } - return false; - } - - /** - * @param sessionId - */ - private void makeLocal(String sessionId) { - try { - // this is APP session, always - Class appSessionInterfaceClass = - AppSessionDataReplicatedImpl.getAppSessionIface(this.mobicentsCluster.getMobicentsCache(), sessionId); - // get factory; - // FIXME: make it a field? - IAppSessionFactory fct = ((ISessionFactory) this.container.getSessionFactory()).getAppSessionFactory(appSessionInterfaceClass); - if (fct == null) { - logger.warn("Session with id:{}, is in replicated data source, but no Application Session Factory for:{}.", sessionId, appSessionInterfaceClass); - return; - } - else { - BaseSession session = fct.getSession(sessionId, appSessionInterfaceClass); - this.localDataSource.addSession(session); - // hmmm - this.localDataSource.setSessionListener(sessionId, (NetworkReqListener) session); - return; - } - } - catch (IllegalDiameterStateException e) { - if (logger.isErrorEnabled()) { - logger.error("Failed to obtain factory from stack..."); - } - } - } - - // ------- local getter - - public IContainer getContainer() { - return this.container; - } -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java deleted file mode 100644 index f17f4c111..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java +++ /dev/null @@ -1,191 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.acc; - -import java.io.Serializable; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.acc.ServerAccSession; -import org.jdiameter.common.api.app.acc.ServerAccSessionState; -import org.jdiameter.server.impl.app.acc.IServerAccSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerAccSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAccSessionData { - - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - private static final String TS_TIMEOUT = "TS_TIMEOUT"; - private static final String TS_TIMERID = "TS_TIMERID"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerAccSession.class); - setServerAccSessionState(ServerAccSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerAccSessionState getServerAccSessionState() { - if (exists()) { - return (ServerAccSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerAccSessionState(ServerAccSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimeout(long value) { - if (exists()) { - getNode().put(TS_TIMEOUT, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public long getTsTimeout() { - if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimerId(Serializable value) { - if (exists()) { - getNode().put(TS_TIMERID, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java deleted file mode 100644 index 15c81a2ea..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java +++ /dev/null @@ -1,191 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.auth; - -import java.io.Serializable; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.auth.ServerAuthSession; -import org.jdiameter.common.api.app.auth.ServerAuthSessionState; -import org.jdiameter.server.impl.app.auth.IServerAuthSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerAuthSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerAuthSessionData { - - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - private static final String TS_TIMEOUT = "TS_TIMEOUT"; - private static final String TS_TIMERID = "TS_TIMERID"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerAuthSession.class); - setServerAuthSessionState(ServerAuthSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerAuthSessionState getServerAuthSessionState() { - if (exists()) { - return (ServerAuthSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerAuthSessionState(ServerAuthSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimeout(long value) { - if (exists()) { - getNode().put(TS_TIMEOUT, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public long getTsTimeout() { - if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public void setTsTimerId(Serializable value) { - if (exists()) { - getNode().put(TS_TIMERID, value); - } - else { - throw new IllegalStateException(); - } - } - - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java deleted file mode 100644 index 69331ccbb..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java +++ /dev/null @@ -1,180 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.cca; - -import java.io.Serializable; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.cca.ServerCCASession; -import org.jdiameter.common.api.app.cca.ServerCCASessionState; -import org.jdiameter.server.impl.app.cca.IServerCCASessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerCCASessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerCCASessionData { - - private static final String TCCID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerCCASession.class); - setServerCCASessionState(ServerCCASessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerCCASessionState getServerCCASessionState() { - if (exists()) { - return (ServerCCASessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerCCASessionState(ServerCCASessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTccTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TCCID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTccTimerId() { - if (exists()) { - return (Serializable) getNode().get(TCCID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java deleted file mode 100644 index 2c04bab24..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,84 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.cxdx; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.cxdx.ServerCxDxSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.common.api.app.cxdx.CxDxSessionState; -import org.jdiameter.server.impl.app.cxdx.IServerCxDxSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.cxdx.CxDxSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IServerCxDxSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ServerCxDxSession.class); - setCxDxSessionState(CxDxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java deleted file mode 100644 index 98a65a3b5..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,182 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.gx; - -import java.io.Serializable; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.gx.ServerGxSession; -import org.jdiameter.common.api.app.gx.ServerGxSessionState; -import org.jdiameter.server.impl.app.gx.IServerGxSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerGxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerGxSessionData { - - private static final String TCCID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerGxSession.class); - setServerGxSessionState(ServerGxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerGxSessionState getServerGxSessionState() { - if (exists()) { - return (ServerGxSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerGxSessionState(ServerGxSessionState state) { - - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTccTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TCCID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTccTimerId() { - if (exists()) { - return (Serializable) getNode().get(TCCID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java deleted file mode 100644 index a69033545..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java +++ /dev/null @@ -1,211 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.rf; - -import java.io.Serializable; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.rf.ServerRfSession; -import org.jdiameter.common.api.app.rf.ServerRfSessionState; -import org.jdiameter.server.impl.app.rf.IServerRfSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerRfSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRfSessionData { - - private static final String TS_TIMERID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - private static final String TS_TIMEOUT = "TS_TIMEOUT"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerRfSession.class); - setServerRfSessionState(ServerRfSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerRfSessionState getServerRfSessionState() { - if (exists()) { - return (ServerRfSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerRfSessionState(ServerRfSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTsTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TS_TIMERID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTsTimerId() { - if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#getTsTimeout() - */ - @Override - public long getTsTimeout() { - if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.rf.IServerRfSessionData#setTsTimeout(long) - */ - @Override - public void setTsTimeout(long l) { - if (exists()) { - getNode().put(TS_TIMEOUT, l); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java deleted file mode 100644 index 035b584fe..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java +++ /dev/null @@ -1,180 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.ro; - -import java.io.Serializable; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.ro.ServerRoSession; -import org.jdiameter.common.api.app.ro.ServerRoSessionState; -import org.jdiameter.server.impl.app.ro.IServerRoSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerRoSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRoSessionData { - - private static final String TCCID = "TCCID"; - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerRoSession.class); - setServerRoSessionState(ServerRoSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerRoSessionState getServerRoSessionState() { - if (exists()) { - return (ServerRoSessionState) getNode().get(STATE); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerRoSessionState(ServerRoSessionState state) { - if (exists()) { - getNode().put(STATE, state); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setTccTimerId (java.io.Serializable) - */ - @Override - public void setTccTimerId(Serializable tccTimerId) { - if (exists()) { - getNode().put(TCCID, tccTimerId); - } - else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#getTccTimerId() - */ - @Override - public Serializable getTccTimerId() { - if (exists()) { - return (Serializable) getNode().get(TCCID); - } - else { - throw new IllegalStateException(); - } - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java deleted file mode 100644 index 91cc69b3b..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java +++ /dev/null @@ -1,144 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.rx; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.rx.ServerRxSession; -import org.jdiameter.common.api.app.rx.ServerRxSessionState; -import org.jdiameter.server.impl.app.rx.IServerRxSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerRxSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IServerRxSessionData { - - private static final String STATELESS = "STATELESS"; - private static final String STATE = "STATE"; - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerRxSession.class); - setServerRxSessionState(ServerRxSessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#isStateless() - */ - @Override - public boolean isStateless() { - if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); - } else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData#setStateless( boolean) - */ - @Override - public void setStateless(boolean stateless) { - if (exists()) { - getNode().put(STATELESS, stateless); - } else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# getServerCCASessionState() - */ - @Override - public ServerRxSessionState getServerRxSessionState() { - if (exists()) { - return (ServerRxSessionState) getNode().get(STATE); - } else { - throw new IllegalStateException(); - } - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.server.impl.app.cca.IServerCCASessionData# setServerCCASessionState - * (org.jdiameter.common.api.app.cca.ServerCCASessionState) - */ - @Override - public void setServerRxSessionState(ServerRxSessionState state) { - - if (exists()) { - getNode().put(STATE, state); - } else { - throw new IllegalStateException(); - } - - } -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java deleted file mode 100644 index a588334c7..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - */ - -package org.mobicents.diameter.impl.ha.server.s13; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.s13.ServerS13Session; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.common.api.app.s13.S13SessionState; -import org.jdiameter.server.impl.app.s13.IServerS13SessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.s13.S13SessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ServerS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IServerS13SessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); - - if (super.create()) { - setAppSessionIface(this, ServerS13Session.class); - setS13SessionState(S13SessionState.IDLE); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ServerS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java deleted file mode 100644 index 648932a38..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java +++ /dev/null @@ -1,81 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.server.sh; - -import org.infinispan.tree.Fqn; -import org.jdiameter.api.sh.ServerShSession; -import org.jdiameter.server.impl.app.sh.IShServerSessionData; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.common.AppSessionDataReplicatedImpl; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; - -/** - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ShServerSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShServerSessionData { - - /** - * @param nodeFqn - * @param mobicentsCluster - * @param iface - */ - public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); - - if (super.create()) { - setAppSessionIface(this, ServerShSession.class); - } - } - - /** - * @param sessionId - * @param mobicentsCluster - * @param iface - */ - public ShServerSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); - } - -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java deleted file mode 100644 index a8e9db7bf..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/DiameterTimerTaskData.java +++ /dev/null @@ -1,77 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.timer; - -import java.io.Serializable; - -import org.restcomm.timers.PeriodicScheduleStrategy; -import org.restcomm.timers.TimerTaskData; - -/** - * Diameter timer task data holder. - * - * @author Alexandre Mendonca - * @author Bartosz Baranowski - */ -final class DiameterTimerTaskData extends TimerTaskData { - - private static final long serialVersionUID = 8774218122384404225L; - - // data we need to recreate timer task - private String sessionId; - private String timerName; - - DiameterTimerTaskData(Serializable id, long delay, String sessionId, String timerName) { - super(id, System.currentTimeMillis() + delay, -1, PeriodicScheduleStrategy.withFixedDelay); - this.sessionId = sessionId; - this.timerName = timerName; - } - - public String getSessionId() { - return sessionId; - } - - public String getTimerName() { - return timerName; - } -} diff --git a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java b/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java deleted file mode 100644 index 3b06ac1f9..000000000 --- a/core/jdiameter-ha/impl-wildfly/src/main/java/org/mobicents/diameter/impl/ha/timer/ReplicatedTimerFacilityImpl.java +++ /dev/null @@ -1,147 +0,0 @@ - /* - * TeleStax, Open Source Cloud Communications - * Copyright 2011-2016, TeleStax Inc. and individual contributors - * by the @authors tag. - * - * This program is free software: you can redistribute it and/or modify - * under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation; either version 3 of - * the License, or (at your option) any later version. - * - * 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 Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see - * - * This file incorporates work covered by the following copyright and - * permission notice: - * - * JBoss, Home of Professional Open Source - * Copyright 2007-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.diameter.impl.ha.timer; - -import java.io.Serializable; - -import org.jdiameter.api.BaseSession; -import org.jdiameter.client.api.IContainer; -import org.jdiameter.common.api.data.ISessionDatasource; -import org.jdiameter.common.api.timer.ITimerFacility; -import org.jdiameter.common.impl.app.AppSessionImpl; -import org.restcomm.cluster.MobicentsCluster; -import org.mobicents.diameter.impl.ha.data.ReplicatedSessionDatasource; -import org.restcomm.timers.FaultTolerantScheduler; -import org.restcomm.timers.TimerTask; -import org.restcomm.timers.TimerTaskData; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Replicated implementation of {@link ITimerFacility} - * - * @author Bartosz Baranowski - * @author Alexandre Mendonca - */ -public class ReplicatedTimerFacilityImpl implements ITimerFacility { - - private static final Logger logger = LoggerFactory.getLogger(ReplicatedTimerFacilityImpl.class); - - private ISessionDatasource sessionDataSource; - private TimerTaskFactory taskFactory; - private FaultTolerantScheduler ftScheduler; - - public ReplicatedTimerFacilityImpl(IContainer container) { - super(); - this.sessionDataSource = container.getAssemblerFacility().getComponentInstance(ISessionDatasource.class); - this.taskFactory = new TimerTaskFactory(); - MobicentsCluster cluster = ((ReplicatedSessionDatasource) this.sessionDataSource).getMobicentsCluster(); - this.ftScheduler = new FaultTolerantScheduler("DiameterTimer", 5, cluster, (byte) 12, null, this.taskFactory); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.timer.ITimerFacility#cancel(java.io.Serializable) - */ - @Override - public void cancel(Serializable id) { - logger.debug("Cancelling timer with id {}", id); - this.ftScheduler.cancel(id); - } - - /* - * (non-Javadoc) - * - * @see org.jdiameter.common.api.timer.ITimerFacility#schedule(java.lang.String, java.lang.String, long) - */ - @Override - public Serializable schedule(String sessionId, String timerName, long miliseconds) throws IllegalArgumentException { - String id = sessionId + "/" + timerName; - logger.debug("Scheduling timer with id {}", id); - - if (this.ftScheduler.getTimerTaskData(id) != null) { - throw new IllegalArgumentException("Timer already running: " + id); - } - - DiameterTimerTaskData data = new DiameterTimerTaskData(id, miliseconds, sessionId, timerName); - TimerTask tt = this.taskFactory.newTimerTask(data); - ftScheduler.schedule(tt); - return id; - } - - private final class TimerTaskFactory implements org.restcomm.timers.TimerTaskFactory { - - @Override - public TimerTask newTimerTask(TimerTaskData data) { - return new DiameterTimerTask(data); - } - } - - private final class DiameterTimerTask extends TimerTask { - - DiameterTimerTask(TimerTaskData data) { - super(data); - } - - @Override - public void runTask() { - try { - DiameterTimerTaskData data = (DiameterTimerTaskData) getData(); - BaseSession bSession = sessionDataSource.getSession(data.getSessionId()); - if (bSession == null || !bSession.isAppSession()) { - // FIXME: error ? - return; - } - else { - AppSessionImpl impl = (AppSessionImpl) bSession; - impl.onTimer(data.getTimerName()); - } - } - catch (Exception e) { - logger.error("Failure executing timer task", e); - } - } - } - -} diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java index 8f120a4c7..72abe060a 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/acc/ClientAccSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.acc.ClientAccSession; @@ -79,12 +79,12 @@ public class ClientAccSessionDataReplicatedImpl extends AppSessionDataReplicated private IMessageParser messageParser; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public ClientAccSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientAccSession.class); @@ -97,10 +97,13 @@ public ClientAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobic /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } /* @@ -112,7 +115,7 @@ public ClientAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mob @Override public void setClientAccSessionState(ClientAccSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -127,7 +130,7 @@ public void setClientAccSessionState(ClientAccSessionState state) { @Override public ClientAccSessionState getClientAccSessionState() { if (exists()) { - return (ClientAccSessionState) getNode().get(STATE); + return (ClientAccSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -142,7 +145,7 @@ public ClientAccSessionState getClientAccSessionState() { @Override public void setInterimTimerId(Serializable tid) { if (exists()) { - getNode().put(INTERIM_TIMERID, tid); + putNodeValue(INTERIM_TIMERID, tid); } else { throw new IllegalStateException(); @@ -157,7 +160,7 @@ public void setInterimTimerId(Serializable tid) { @Override public Serializable getInterimTimerId() { if (exists()) { - return (Serializable) getNode().get(INTERIM_TIMERID); + return (Serializable) getNodeValue(INTERIM_TIMERID); } else { throw new IllegalStateException(); @@ -172,7 +175,7 @@ public Serializable getInterimTimerId() { @Override public void setDestinationHost(String destHost) { if (exists()) { - getNode().put(DEST_HOST, destHost); + putNodeValue(DEST_HOST, destHost); } else { throw new IllegalStateException(); @@ -187,7 +190,7 @@ public void setDestinationHost(String destHost) { @Override public String getDestinationHost() { if (exists()) { - return (String) getNode().get(DEST_HOST); + return (String) getNodeValue(DEST_HOST); } else { throw new IllegalStateException(); @@ -202,7 +205,7 @@ public String getDestinationHost() { @Override public void setDestinationRealm(String destRealm) { if (exists()) { - getNode().put(DEST_REALM, destRealm); + putNodeValue(DEST_REALM, destRealm); } else { throw new IllegalStateException(); @@ -217,7 +220,7 @@ public void setDestinationRealm(String destRealm) { @Override public String getDestinationRealm() { if (exists()) { - return (String) getNode().get(DEST_REALM); + return (String) getNodeValue(DEST_REALM); } else { throw new IllegalStateException(); @@ -226,7 +229,7 @@ public String getDestinationRealm() { @Override public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); + byte[] data = (byte[]) getNodeValue(BUFFER); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -246,14 +249,14 @@ public void setBuffer(Request buffer) { if (buffer != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); + putNodeValue(BUFFER, data); } catch (ParseException e) { logger.error("Unable to encode message to buffer."); } } else { - getNode().remove(BUFFER); + removeNodeValue(BUFFER); } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java index 385b93ff0..43120a750 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/auth/ClientAuthSessionDataReplicatedImpl.java @@ -44,7 +44,7 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.auth.ClientAuthSession; import org.jdiameter.client.impl.app.auth.IClientAuthSessionData; import org.jdiameter.common.api.app.auth.ClientAuthSessionState; @@ -66,12 +66,11 @@ public class ClientAuthSessionDataReplicatedImpl extends AppSessionDataReplicate private static final String TS_TIMERID = "TS_TIMERID"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ClientAuthSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientAuthSession.class); @@ -82,10 +81,12 @@ public ClientAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobi /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ClientAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -97,7 +98,7 @@ public ClientAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mo @Override public void setClientAuthSessionState(ClientAuthSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -112,7 +113,7 @@ public void setClientAuthSessionState(ClientAuthSessionState state) { @Override public ClientAuthSessionState getClientAuthSessionState() { if (exists()) { - return (ClientAuthSessionState) getNode().get(STATE); + return (ClientAuthSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -127,7 +128,7 @@ public ClientAuthSessionState getClientAuthSessionState() { @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); @@ -142,7 +143,7 @@ public boolean isStateless() { @Override public void setStateless(boolean b) { if (exists()) { - getNode().put(STATELESS, b); + putNodeValue(STATELESS, b); } else { throw new IllegalStateException(); @@ -158,7 +159,7 @@ public void setStateless(boolean b) { @Override public String getDestinationHost() { if (exists()) { - return (String) getNode().get(DESTINATION_HOST); + return (String) getNodeValue(DESTINATION_HOST); } else { throw new IllegalStateException(); @@ -173,7 +174,7 @@ public String getDestinationHost() { @Override public void setDestinationHost(String host) { if (exists()) { - getNode().put(DESTINATION_HOST, host); + putNodeValue(DESTINATION_HOST, host); } else { throw new IllegalStateException(); @@ -188,7 +189,7 @@ public void setDestinationHost(String host) { @Override public String getDestinationRealm() { if (exists()) { - return (String) getNode().get(DESTINATION_REALM); + return (String) getNodeValue(DESTINATION_REALM); } else { throw new IllegalStateException(); @@ -203,7 +204,7 @@ public String getDestinationRealm() { @Override public void setDestinationRealm(String realm) { if (exists()) { - getNode().put(DESTINATION_REALM, realm); + putNodeValue(DESTINATION_REALM, realm); } else { throw new IllegalStateException(); @@ -218,7 +219,7 @@ public void setDestinationRealm(String realm) { @Override public Serializable getTsTimerId() { if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); + return (Serializable) getNodeValue(TS_TIMERID); } else { throw new IllegalStateException(); @@ -233,7 +234,7 @@ public Serializable getTsTimerId() { @Override public void setTsTimerId(Serializable tid) { if (exists()) { - getNode().put(TS_TIMERID, tid); + putNodeValue(TS_TIMERID, tid); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java index 7b3178c36..eced8d49c 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cca/ClientCCASessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.cca.ClientCCASession; @@ -83,12 +83,12 @@ public class ClientCCASessionDataReplicatedImpl extends AppSessionDataReplicated private IMessageParser messageParser; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public ClientCCASessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientCCASession.class); @@ -101,16 +101,19 @@ public ClientCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobic /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } @Override public boolean isEventBased() { if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + return toPrimitive((Boolean) getNodeValue(EVENT_BASED), true); } else { throw new IllegalStateException(); @@ -120,7 +123,7 @@ public boolean isEventBased() { @Override public void setEventBased(boolean isEventBased) { if (exists()) { - getNode().put(EVENT_BASED, isEventBased); + putNodeValue(EVENT_BASED, isEventBased); } else { throw new IllegalStateException(); @@ -130,7 +133,7 @@ public void setEventBased(boolean isEventBased) { @Override public boolean isRequestTypeSet() { if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + return toPrimitive((Boolean) getNodeValue(REQUEST_TYPE), false); } else { throw new IllegalStateException(); @@ -140,7 +143,7 @@ public boolean isRequestTypeSet() { @Override public void setRequestTypeSet(boolean requestTypeSet) { if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); + putNodeValue(REQUEST_TYPE, requestTypeSet); } else { throw new IllegalStateException(); @@ -150,7 +153,7 @@ public void setRequestTypeSet(boolean requestTypeSet) { @Override public ClientCCASessionState getClientCCASessionState() { if (exists()) { - return (ClientCCASessionState) getNode().get(STATE); + return (ClientCCASessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -160,7 +163,7 @@ public ClientCCASessionState getClientCCASessionState() { @Override public void setClientCCASessionState(ClientCCASessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -170,7 +173,7 @@ public void setClientCCASessionState(ClientCCASessionState state) { @Override public Serializable getTxTimerId() { if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); + return (Serializable) getNodeValue(TXTIMER_ID); } else { throw new IllegalStateException(); @@ -180,7 +183,7 @@ public Serializable getTxTimerId() { @Override public void setTxTimerId(Serializable txTimerId) { if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); + putNodeValue(TXTIMER_ID, txTimerId); } else { throw new IllegalStateException(); @@ -191,7 +194,7 @@ public void setTxTimerId(Serializable txTimerId) { public Request getTxTimerRequest() { if (exists()) { - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + byte[] data = (byte[]) getNodeValue(TXTIMER_REQUEST); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -216,14 +219,14 @@ public void setTxTimerRequest(Request txTimerRequest) { if (txTimerRequest != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); + putNodeValue(TXTIMER_REQUEST, data); } catch (ParseException e) { logger.error("Unable to encode Tx Timer Request to buffer."); } } else { - getNode().remove(TXTIMER_REQUEST); + removeNodeValue(TXTIMER_REQUEST); } } else { @@ -233,7 +236,7 @@ public void setTxTimerRequest(Request txTimerRequest) { @Override public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); + byte[] data = (byte[]) getNodeValue(BUFFER); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -253,21 +256,21 @@ public void setBuffer(Request buffer) { if (buffer != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); + putNodeValue(BUFFER, data); } catch (ParseException e) { logger.error("Unable to encode message to buffer."); } } else { - getNode().remove(BUFFER); + removeNodeValue(BUFFER); } } @Override public int getGatheredRequestedAction() { if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); + return toPrimitive((Integer) getNodeValue(GRA)); } else { throw new IllegalStateException(); @@ -277,7 +280,7 @@ public int getGatheredRequestedAction() { @Override public void setGatheredRequestedAction(int gatheredRequestedAction) { if (exists()) { - getNode().put(GRA, gatheredRequestedAction); + putNodeValue(GRA, gatheredRequestedAction); } else { throw new IllegalStateException(); @@ -287,7 +290,7 @@ public void setGatheredRequestedAction(int gatheredRequestedAction) { @Override public int getGatheredCCFH() { if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); + return toPrimitive((Integer) getNodeValue(GCCFH)); } else { throw new IllegalStateException(); @@ -297,7 +300,7 @@ public int getGatheredCCFH() { @Override public void setGatheredCCFH(int gatheredCCFH) { if (exists()) { - getNode().put(GCCFH, gatheredCCFH); + putNodeValue(GCCFH, gatheredCCFH); } else { throw new IllegalStateException(); @@ -307,7 +310,7 @@ public void setGatheredCCFH(int gatheredCCFH) { @Override public int getGatheredDDFH() { if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); + return toPrimitive((Integer) getNodeValue(GDDFH)); } else { throw new IllegalStateException(); @@ -317,7 +320,7 @@ public int getGatheredDDFH() { @Override public void setGatheredDDFH(int gatheredDDFH) { if (exists()) { - getNode().put(GDDFH, gatheredDDFH); + putNodeValue(GDDFH, gatheredDDFH); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java index b14e10625..886894b9e 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/cxdx/ClientCxDxSessionDataReplicatedImpl.java @@ -42,7 +42,7 @@ package org.mobicents.diameter.impl.ha.client.cxdx; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.cxdx.ClientCxDxSession; import org.jdiameter.client.api.IContainer; import org.jdiameter.client.impl.app.cxdx.IClientCxDxSessionData; @@ -59,12 +59,12 @@ public class ClientCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IClientCxDxSessionData { /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); + public ClientCxDxSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster, container); if (super.create()) { setAppSessionIface(this, ClientCxDxSession.class); @@ -75,10 +75,13 @@ public ClientCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobi /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java index 3237cadd2..177276119 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/gx/ClientGxSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.gx.ClientGxSession; @@ -83,12 +83,12 @@ public class ClientGxSessionDataReplicatedImpl extends AppSessionDataReplicatedI private IMessageParser messageParser; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public ClientGxSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientGxSession.class); @@ -101,16 +101,19 @@ public ClientGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } @Override public boolean isEventBased() { if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + return toPrimitive((Boolean) getNodeValue(EVENT_BASED), true); } else { throw new IllegalStateException(); @@ -120,7 +123,7 @@ public boolean isEventBased() { @Override public void setEventBased(boolean isEventBased) { if (exists()) { - getNode().put(EVENT_BASED, isEventBased); + putNodeValue(EVENT_BASED, isEventBased); } else { throw new IllegalStateException(); @@ -130,7 +133,7 @@ public void setEventBased(boolean isEventBased) { @Override public boolean isRequestTypeSet() { if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + return toPrimitive((Boolean) getNodeValue(REQUEST_TYPE), false); } else { throw new IllegalStateException(); @@ -140,7 +143,7 @@ public boolean isRequestTypeSet() { @Override public void setRequestTypeSet(boolean requestTypeSet) { if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); + putNodeValue(REQUEST_TYPE, requestTypeSet); } else { throw new IllegalStateException(); @@ -150,7 +153,7 @@ public void setRequestTypeSet(boolean requestTypeSet) { @Override public ClientGxSessionState getClientGxSessionState() { if (exists()) { - return (ClientGxSessionState) getNode().get(STATE); + return (ClientGxSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -160,7 +163,7 @@ public ClientGxSessionState getClientGxSessionState() { @Override public void setClientGxSessionState(ClientGxSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -170,7 +173,7 @@ public void setClientGxSessionState(ClientGxSessionState state) { @Override public Serializable getTxTimerId() { if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); + return (Serializable) getNodeValue(TXTIMER_ID); } else { throw new IllegalStateException(); @@ -180,7 +183,7 @@ public Serializable getTxTimerId() { @Override public void setTxTimerId(Serializable txTimerId) { if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); + putNodeValue(TXTIMER_ID, txTimerId); } else { throw new IllegalStateException(); @@ -191,7 +194,7 @@ public void setTxTimerId(Serializable txTimerId) { public Request getTxTimerRequest() { if (exists()) { - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + byte[] data = (byte[]) getNodeValue(TXTIMER_REQUEST); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -218,14 +221,14 @@ public void setTxTimerRequest(Request txTimerRequest) { try { byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); + putNodeValue(TXTIMER_REQUEST, data); } catch (ParseException e) { logger.error("Unable to encode Tx Timer Request to buffer."); } } else { - getNode().remove(TXTIMER_REQUEST); + removeNodeValue(TXTIMER_REQUEST); } } else { @@ -235,7 +238,7 @@ public void setTxTimerRequest(Request txTimerRequest) { @Override public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); + byte[] data = (byte[]) getNodeValue(BUFFER); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -255,21 +258,21 @@ public void setBuffer(Request buffer) { if (buffer != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); + putNodeValue(BUFFER, data); } catch (ParseException e) { logger.error("Unable to encode message to buffer."); } } else { - getNode().remove(BUFFER); + removeNodeValue(BUFFER); } } @Override public int getGatheredRequestedAction() { if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); + return toPrimitive((Integer) getNodeValue(GRA)); } else { throw new IllegalStateException(); @@ -279,7 +282,7 @@ public int getGatheredRequestedAction() { @Override public void setGatheredRequestedAction(int gatheredRequestedAction) { if (exists()) { - getNode().put(GRA, gatheredRequestedAction); + putNodeValue(GRA, gatheredRequestedAction); } else { throw new IllegalStateException(); @@ -289,7 +292,7 @@ public void setGatheredRequestedAction(int gatheredRequestedAction) { @Override public int getGatheredCCFH() { if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); + return toPrimitive((Integer) getNodeValue(GCCFH)); } else { throw new IllegalStateException(); @@ -299,7 +302,7 @@ public int getGatheredCCFH() { @Override public void setGatheredCCFH(int gatheredCCFH) { if (exists()) { - getNode().put(GCCFH, gatheredCCFH); + putNodeValue(GCCFH, gatheredCCFH); } else { throw new IllegalStateException(); @@ -309,7 +312,7 @@ public void setGatheredCCFH(int gatheredCCFH) { @Override public int getGatheredDDFH() { if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); + return toPrimitive((Integer) getNodeValue(GDDFH)); } else { throw new IllegalStateException(); @@ -319,7 +322,7 @@ public int getGatheredDDFH() { @Override public void setGatheredDDFH(int gatheredDDFH) { if (exists()) { - getNode().put(GDDFH, gatheredDDFH); + putNodeValue(GDDFH, gatheredDDFH); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java index 287236b1f..32cf7dd0d 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rf/ClientRfSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.rf.ClientRfSession; @@ -79,12 +79,12 @@ public class ClientRfSessionDataReplicatedImpl extends AppSessionDataReplicatedI private IMessageParser messageParser; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public ClientRfSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientRfSession.class); @@ -97,16 +97,19 @@ public ClientRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } @Override public ClientRfSessionState getClientRfSessionState() { if (exists()) { - return (ClientRfSessionState) getNode().get(STATE); + return (ClientRfSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -116,7 +119,7 @@ public ClientRfSessionState getClientRfSessionState() { @Override public void setClientRfSessionState(ClientRfSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -125,7 +128,7 @@ public void setClientRfSessionState(ClientRfSessionState state) { @Override public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); + byte[] data = (byte[]) getNodeValue(BUFFER); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -146,14 +149,14 @@ public void setBuffer(Request buffer) { try { byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); + putNodeValue(BUFFER, data); } catch (ParseException e) { logger.error("Unable to encode message to buffer."); } } else { - getNode().remove(BUFFER); + removeNodeValue(BUFFER); } } @@ -165,7 +168,7 @@ public void setBuffer(Request buffer) { @Override public Serializable getTsTimerId() { if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); + return (Serializable) getNodeValue(TS_TIMERID); } else { throw new IllegalStateException(); @@ -180,7 +183,7 @@ public Serializable getTsTimerId() { @Override public void setTsTimerId(Serializable tid) { if (exists()) { - getNode().put(TS_TIMERID, tid); + putNodeValue(TS_TIMERID, tid); } else { throw new IllegalStateException(); @@ -195,7 +198,7 @@ public void setTsTimerId(Serializable tid) { @Override public String getDestinationHost() { if (exists()) { - return (String) getNode().get(DESTINATION_HOST); + return (String) getNodeValue(DESTINATION_HOST); } else { throw new IllegalStateException(); @@ -210,7 +213,7 @@ public String getDestinationHost() { @Override public void setDestinationHost(String destinationHost) { if (exists()) { - getNode().put(DESTINATION_HOST, destinationHost); + putNodeValue(DESTINATION_HOST, destinationHost); } else { throw new IllegalStateException(); @@ -225,7 +228,7 @@ public void setDestinationHost(String destinationHost) { @Override public String getDestinationRealm() { if (exists()) { - return (String) getNode().get(DESTINATION_REALM); + return (String) getNodeValue(DESTINATION_REALM); } else { throw new IllegalStateException(); @@ -240,7 +243,7 @@ public String getDestinationRealm() { @Override public void setDestinationRealm(String destinationRealm) { if (exists()) { - getNode().put(DESTINATION_REALM, destinationRealm); + putNodeValue(DESTINATION_REALM, destinationRealm); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java index 7a7fc9978..87486bdff 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/ro/ClientRoSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.api.ro.ClientRoSession; @@ -83,12 +83,12 @@ public class ClientRoSessionDataReplicatedImpl extends AppSessionDataReplicatedI private IMessageParser messageParser; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public ClientRoSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientRoSession.class); @@ -101,16 +101,19 @@ public ClientRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } @Override public boolean isEventBased() { if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + return toPrimitive((Boolean) getNodeValue(EVENT_BASED), true); } else { throw new IllegalStateException(); @@ -120,7 +123,7 @@ public boolean isEventBased() { @Override public void setEventBased(boolean isEventBased) { if (exists()) { - getNode().put(EVENT_BASED, isEventBased); + putNodeValue(EVENT_BASED, isEventBased); } else { throw new IllegalStateException(); @@ -130,7 +133,7 @@ public void setEventBased(boolean isEventBased) { @Override public boolean isRequestTypeSet() { if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + return toPrimitive((Boolean) getNodeValue(REQUEST_TYPE), false); } else { throw new IllegalStateException(); @@ -140,7 +143,7 @@ public boolean isRequestTypeSet() { @Override public void setRequestTypeSet(boolean requestTypeSet) { if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); + putNodeValue(REQUEST_TYPE, requestTypeSet); } else { throw new IllegalStateException(); @@ -150,7 +153,7 @@ public void setRequestTypeSet(boolean requestTypeSet) { @Override public ClientRoSessionState getClientRoSessionState() { if (exists()) { - return (ClientRoSessionState) getNode().get(STATE); + return (ClientRoSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -160,7 +163,7 @@ public ClientRoSessionState getClientRoSessionState() { @Override public void setClientRoSessionState(ClientRoSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -170,7 +173,7 @@ public void setClientRoSessionState(ClientRoSessionState state) { @Override public Serializable getTxTimerId() { if (exists()) { - return (Serializable) getNode().get(TXTIMER_ID); + return (Serializable) getNodeValue(TXTIMER_ID); } else { throw new IllegalStateException(); @@ -180,7 +183,7 @@ public Serializable getTxTimerId() { @Override public void setTxTimerId(Serializable txTimerId) { if (exists()) { - getNode().put(TXTIMER_ID, txTimerId); + putNodeValue(TXTIMER_ID, txTimerId); } else { throw new IllegalStateException(); @@ -190,7 +193,7 @@ public void setTxTimerId(Serializable txTimerId) { @Override public Request getTxTimerRequest() { if (exists()) { - byte[] data = (byte[]) getNode().get(TXTIMER_REQUEST); + byte[] data = (byte[]) getNodeValue(TXTIMER_REQUEST); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -215,14 +218,14 @@ public void setTxTimerRequest(Request txTimerRequest) { if (txTimerRequest != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) txTimerRequest).array(); - getNode().put(TXTIMER_REQUEST, data); + putNodeValue(TXTIMER_REQUEST, data); } catch (ParseException e) { logger.error("Unable to encode Tx Timer Request to buffer."); } } else { - getNode().remove(TXTIMER_REQUEST); + removeNodeValue(TXTIMER_REQUEST); } } else { @@ -232,7 +235,7 @@ public void setTxTimerRequest(Request txTimerRequest) { @Override public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); + byte[] data = (byte[]) getNodeValue(BUFFER); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -252,21 +255,21 @@ public void setBuffer(Request buffer) { if (buffer != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); + putNodeValue(BUFFER, data); } catch (ParseException e) { logger.error("Unable to encode message to buffer."); } } else { - getNode().remove(BUFFER); + removeNodeValue(BUFFER); } } @Override public int getGatheredRequestedAction() { if (exists()) { - return toPrimitive((Integer) getNode().get(GRA)); + return toPrimitive((Integer) getNodeValue(GRA)); } else { throw new IllegalStateException(); @@ -276,7 +279,7 @@ public int getGatheredRequestedAction() { @Override public void setGatheredRequestedAction(int gatheredRequestedAction) { if (exists()) { - getNode().put(GRA, gatheredRequestedAction); + putNodeValue(GRA, gatheredRequestedAction); } else { throw new IllegalStateException(); @@ -286,7 +289,7 @@ public void setGatheredRequestedAction(int gatheredRequestedAction) { @Override public int getGatheredCCFH() { if (exists()) { - return toPrimitive((Integer) getNode().get(GCCFH)); + return toPrimitive((Integer) getNodeValue(GCCFH)); } else { throw new IllegalStateException(); @@ -296,7 +299,7 @@ public int getGatheredCCFH() { @Override public void setGatheredCCFH(int gatheredCCFH) { if (exists()) { - getNode().put(GCCFH, gatheredCCFH); + putNodeValue(GCCFH, gatheredCCFH); } else { throw new IllegalStateException(); @@ -306,7 +309,7 @@ public void setGatheredCCFH(int gatheredCCFH) { @Override public int getGatheredDDFH() { if (exists()) { - return toPrimitive((Integer) getNode().get(GDDFH)); + return toPrimitive((Integer) getNodeValue(GDDFH)); } else { throw new IllegalStateException(); @@ -316,7 +319,7 @@ public int getGatheredDDFH() { @Override public void setGatheredDDFH(int gatheredDDFH) { if (exists()) { - getNode().put(GDDFH, gatheredDDFH); + putNodeValue(GDDFH, gatheredDDFH); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java index a014cd505..5434b524a 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/rx/ClientRxSessionDataReplicatedImpl.java @@ -42,7 +42,7 @@ package org.mobicents.diameter.impl.ha.client.rx; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.rx.ClientRxSession; import org.jdiameter.client.api.IContainer; import org.jdiameter.client.impl.app.rx.IClientRxSessionData; @@ -63,12 +63,12 @@ public class ClientRxSessionDataReplicatedImpl extends AppSessionDataReplicatedI private static final String STATE = "STATE"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public ClientRxSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientRxSession.class); @@ -79,16 +79,19 @@ public ClientRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } @Override public boolean isEventBased() { if (exists()) { - return toPrimitive((Boolean) getNode().get(EVENT_BASED), true); + return toPrimitive((Boolean) getNodeValue(EVENT_BASED), true); } else { throw new IllegalStateException(); } @@ -97,7 +100,7 @@ public boolean isEventBased() { @Override public void setEventBased(boolean isEventBased) { if (exists()) { - getNode().put(EVENT_BASED, isEventBased); + putNodeValue(EVENT_BASED, isEventBased); } else { throw new IllegalStateException(); } @@ -106,7 +109,7 @@ public void setEventBased(boolean isEventBased) { @Override public boolean isRequestTypeSet() { if (exists()) { - return toPrimitive((Boolean) getNode().get(REQUEST_TYPE), false); + return toPrimitive((Boolean) getNodeValue(REQUEST_TYPE), false); } else { throw new IllegalStateException(); } @@ -115,7 +118,7 @@ public boolean isRequestTypeSet() { @Override public void setRequestTypeSet(boolean requestTypeSet) { if (exists()) { - getNode().put(REQUEST_TYPE, requestTypeSet); + putNodeValue(REQUEST_TYPE, requestTypeSet); } else { throw new IllegalStateException(); } @@ -124,7 +127,7 @@ public void setRequestTypeSet(boolean requestTypeSet) { @Override public ClientRxSessionState getClientRxSessionState() { if (exists()) { - return (ClientRxSessionState) getNode().get(STATE); + return (ClientRxSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); } @@ -133,7 +136,7 @@ public ClientRxSessionState getClientRxSessionState() { @Override public void setClientRxSessionState(ClientRxSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java index 6ac0e588c..4b0d8eaab 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/s13/ClientS13SessionDataReplicatedImpl.java @@ -19,7 +19,7 @@ package org.mobicents.diameter.impl.ha.client.s13; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.s13.ClientS13Session; import org.jdiameter.client.api.IContainer; import org.jdiameter.client.impl.app.s13.IClientS13SessionData; @@ -36,12 +36,12 @@ public class ClientS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IClientS13SessionData { /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); + public ClientS13SessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster, container); if (super.create()) { setAppSessionIface(this, ClientS13Session.class); @@ -52,10 +52,13 @@ public ClientS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobic /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ClientS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java index 509d3875e..d601d3fea 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/client/sh/ShClientSessionDataReplicatedImpl.java @@ -42,7 +42,7 @@ package org.mobicents.diameter.impl.ha.client.sh; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.sh.ClientShSession; import org.jdiameter.client.impl.app.sh.IShClientSessionData; import org.restcomm.cluster.MobicentsCluster; @@ -57,12 +57,11 @@ public class ShClientSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShClientSessionData { /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ShClientSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ClientShSession.class); @@ -72,10 +71,12 @@ public ShClientSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ShClientSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java index 67359a8c4..dceacc77b 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/AppSessionDataReplicatedImpl.java @@ -42,7 +42,7 @@ package org.mobicents.diameter.impl.ha.common; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.ApplicationId; import org.jdiameter.api.app.AppSession; import org.jdiameter.common.api.app.IAppSessionData; @@ -63,42 +63,42 @@ public class AppSessionDataReplicatedImpl extends ClusteredCacheData implements protected static final String SIFACE = "SIFACE"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster */ - public AppSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public AppSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); } public AppSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } public static void setAppSessionIface(ClusteredCacheData ccd, Class iface) { - //Node n = ccd.getMobicentsCache().getJBossCache().getNode(ccd.getNodeFqn()); - //n.put(SIFACE, iface); - ccd.getMobicentsCache().getJBossCache() - .getNode(ccd.getNodeFqn()) - .put(SIFACE, iface); + ccd.getMobicentsCache().putCacheNodeValue(ccd.getNodeFqnWrapper(), SIFACE, iface); } public static Class getAppSessionIface(MobicentsCache mcCache, String sessionId) { - //Node n = mcCache.getJBossCache().getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)); - //return (Class) n.get(SIFACE); - return (Class) mcCache.getJBossCache() - .getNode(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId)) - .get(SIFACE); + @SuppressWarnings("unchecked") + Class value = (Class) mcCache.getCacheNodeValue( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + SIFACE + ); + return value; } @Override public String getSessionId() { - return (String) super.getNodeFqn().getLastElement(); + return (String) super.getNodeFqnLastElement(); } @Override public void setApplicationId(ApplicationId applicationId) { if (exists()) { - getNode().put(APID, applicationId); + putNodeValue(APID, applicationId); } else { throw new IllegalStateException(); @@ -108,7 +108,7 @@ public void setApplicationId(ApplicationId applicationId) { @Override public ApplicationId getApplicationId() { if (exists()) { - return (ApplicationId) getNode().get(APID); + return (ApplicationId) getNodeValue(APID); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java index 9922e5b89..5668a52c0 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/cxdx/CxDxSessionDataReplicatedImpl.java @@ -45,7 +45,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.client.api.IContainer; @@ -75,12 +75,12 @@ public abstract class CxDxSessionDataReplicatedImpl extends AppSessionDataReplic private IMessageParser messageParser; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public CxDxSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); } @@ -92,7 +92,7 @@ public CxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsC @Override public void setCxDxSessionState(CxDxSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -107,7 +107,7 @@ public void setCxDxSessionState(CxDxSessionState state) { @Override public CxDxSessionState getCxDxSessionState() { if (exists()) { - return (CxDxSessionState) getNode().get(STATE); + return (CxDxSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -122,7 +122,7 @@ public CxDxSessionState getCxDxSessionState() { @Override public Serializable getTsTimerId() { if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); + return (Serializable) getNodeValue(TS_TIMERID); } else { throw new IllegalStateException(); @@ -137,7 +137,7 @@ public Serializable getTsTimerId() { @Override public void setTsTimerId(Serializable tid) { if (exists()) { - getNode().put(TS_TIMERID, tid); + putNodeValue(TS_TIMERID, tid); } else { throw new IllegalStateException(); @@ -146,7 +146,7 @@ public void setTsTimerId(Serializable tid) { @Override public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); + byte[] data = (byte[]) getNodeValue(BUFFER); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -166,14 +166,14 @@ public void setBuffer(Request buffer) { if (buffer != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); + putNodeValue(BUFFER, data); } catch (ParseException e) { logger.error("Unable to encode message to buffer."); } } else { - getNode().remove(BUFFER); + removeNodeValue(BUFFER); } } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java index 65020e8a7..d56fe7827 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/common/s13/S13SessionDataReplicatedImpl.java @@ -22,7 +22,7 @@ import java.io.Serializable; import java.nio.ByteBuffer; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.AvpDataException; import org.jdiameter.api.Request; import org.jdiameter.client.api.IContainer; @@ -52,12 +52,12 @@ public abstract class S13SessionDataReplicatedImpl extends AppSessionDataReplica private IMessageParser messageParser; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster); + public S13SessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster); this.messageParser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); } @@ -69,7 +69,7 @@ public S13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCl @Override public void setS13SessionState(S13SessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -84,7 +84,7 @@ public void setS13SessionState(S13SessionState state) { @Override public S13SessionState getS13SessionState() { if (exists()) { - return (S13SessionState) getNode().get(STATE); + return (S13SessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -99,7 +99,7 @@ public S13SessionState getS13SessionState() { @Override public Serializable getTsTimerId() { if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); + return (Serializable) getNodeValue(TS_TIMERID); } else { throw new IllegalStateException(); @@ -114,7 +114,7 @@ public Serializable getTsTimerId() { @Override public void setTsTimerId(Serializable tid) { if (exists()) { - getNode().put(TS_TIMERID, tid); + putNodeValue(TS_TIMERID, tid); } else { throw new IllegalStateException(); @@ -123,7 +123,7 @@ public void setTsTimerId(Serializable tid) { @Override public Request getBuffer() { - byte[] data = (byte[]) getNode().get(BUFFER); + byte[] data = (byte[]) getNodeValue(BUFFER); if (data != null) { try { return this.messageParser.createMessage(ByteBuffer.wrap(data)); @@ -143,14 +143,14 @@ public void setBuffer(Request buffer) { if (buffer != null) { try { byte[] data = this.messageParser.encodeMessage((IMessage) buffer).array(); - getNode().put(BUFFER, data); + putNodeValue(BUFFER, data); } catch (ParseException e) { logger.error("Unable to encode message to buffer."); } } else { - getNode().remove(BUFFER); + removeNodeValue(BUFFER); } } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java index 6656e615f..349c0b195 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java @@ -46,7 +46,6 @@ import javax.transaction.TransactionManager; -import org.jboss.cache.Fqn; import org.jdiameter.api.BaseSession; import org.jdiameter.api.IllegalDiameterStateException; import org.jdiameter.api.NetworkReqListener; @@ -68,6 +67,7 @@ import org.jdiameter.common.api.app.sh.IShSessionData; import org.jdiameter.common.api.data.ISessionDatasource; import org.jdiameter.common.impl.data.LocalDataSource; +import org.restcomm.cache.FqnWrapper; import org.restcomm.cache.MobicentsCache; import org.restcomm.cluster.DataRemovalListener; import org.restcomm.cluster.DefaultMobicentsCluster; @@ -96,7 +96,7 @@ public class ReplicatedSessionDatasource implements ISessionDatasource, DataRemovalListener { private static final Logger logger = LoggerFactory.getLogger(ReplicatedSessionDatasource.class); - public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-jbc.xml"; + public static final String CLUSTER_DS_DEFAULT_FILE = "jdiameter-cache.xml"; private IContainer container; private ISessionDatasource localDataSource; @@ -110,7 +110,7 @@ public class ReplicatedSessionDatasource implements ISessionDatasource, DataRemo // Constants // ---------------------------------------------------------------- public static final String SESSIONS = "/diameter/appsessions"; - public static final Fqn SESSIONS_FQN = Fqn.fromString(SESSIONS); + public static final FqnWrapper SESSIONS_FQN = FqnWrapper.fromStringWrapper(SESSIONS); public ReplicatedSessionDatasource(IContainer container) { this(container, new LocalDataSource(), ReplicatedSessionDatasource.class.getClassLoader().getResource(CLUSTER_DS_DEFAULT_FILE) == null ? @@ -121,14 +121,17 @@ public ReplicatedSessionDatasource(IContainer container, ISessionDatasource loca super(); this.localDataSource = localDataSource; - MobicentsCache mcCache = new MobicentsCache(cacheConfigFilename); + MobicentsCache mcCache = null; TransactionManager txMgr = null; try { - Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); - Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); - txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); - } - catch (Exception e) { + mcCache = new MobicentsCache(cacheConfigFilename); + + // TODO: TxManager + + //Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); + //Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); + //txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); + } catch (Exception e) { logger.debug("Could not fetch TxMgr. Not using one.", e); // let's not have Tx Manager than... } @@ -295,13 +298,13 @@ public MobicentsCluster getMobicentsCluster() { } @Override - public void dataRemoved(Fqn sessionFqn) { + public void dataRemoved(FqnWrapper sessionFqn) { String sessionId = (String) sessionFqn.getLastElement(); this.localDataSource.removeSession(sessionId); } @Override - public Fqn getBaseFqn() { + public FqnWrapper getBaseFqn() { return SESSIONS_FQN; } @@ -310,7 +313,9 @@ public Fqn getBaseFqn() { * @return */ private boolean existReplicated(String sessionId) { - if (!this.localMode && this.mobicentsCluster.getMobicentsCache().getJBossCache().getNode(Fqn.fromRelativeElements(SESSIONS_FQN, sessionId)) != null) { + if (!this.localMode && + this.mobicentsCluster.getMobicentsCache() + .getCacheNode(FqnWrapper.fromRelativeElementsWrapper(SESSIONS_FQN, sessionId)) != null) { return true; } return false; diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java index 4543a3c3a..e1e11c9bc 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/acc/ServerAccSessionDataReplicatedImpl.java @@ -44,7 +44,7 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.acc.ServerAccSession; import org.jdiameter.common.api.app.acc.ServerAccSessionState; import org.jdiameter.server.impl.app.acc.IServerAccSessionData; @@ -65,12 +65,11 @@ public class ServerAccSessionDataReplicatedImpl extends AppSessionDataReplicated private static final String TS_TIMERID = "TS_TIMERID"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ServerAccSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerAccSession.class); @@ -81,10 +80,12 @@ public ServerAccSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobic /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ServerAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -95,7 +96,7 @@ public ServerAccSessionDataReplicatedImpl(String sessionId, MobicentsCluster mob @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); @@ -110,7 +111,7 @@ public boolean isStateless() { @Override public void setStateless(boolean stateless) { if (exists()) { - getNode().put(STATELESS, stateless); + putNodeValue(STATELESS, stateless); } else { throw new IllegalStateException(); @@ -125,7 +126,7 @@ public void setStateless(boolean stateless) { @Override public ServerAccSessionState getServerAccSessionState() { if (exists()) { - return (ServerAccSessionState) getNode().get(STATE); + return (ServerAccSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -141,7 +142,7 @@ public ServerAccSessionState getServerAccSessionState() { @Override public void setServerAccSessionState(ServerAccSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -151,7 +152,7 @@ public void setServerAccSessionState(ServerAccSessionState state) { @Override public void setTsTimeout(long value) { if (exists()) { - getNode().put(TS_TIMEOUT, value); + putNodeValue(TS_TIMEOUT, value); } else { throw new IllegalStateException(); @@ -161,7 +162,7 @@ public void setTsTimeout(long value) { @Override public long getTsTimeout() { if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + return toPrimitive((Long) getNodeValue(TS_TIMEOUT)); } else { throw new IllegalStateException(); @@ -171,7 +172,7 @@ public long getTsTimeout() { @Override public void setTsTimerId(Serializable value) { if (exists()) { - getNode().put(TS_TIMERID, value); + putNodeValue(TS_TIMERID, value); } else { throw new IllegalStateException(); @@ -181,7 +182,7 @@ public void setTsTimerId(Serializable value) { @Override public Serializable getTsTimerId() { if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); + return (Serializable) getNodeValue(TS_TIMERID); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java index f7073e36d..3c25b3351 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/auth/ServerAuthSessionDataReplicatedImpl.java @@ -44,7 +44,7 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.auth.ServerAuthSession; import org.jdiameter.common.api.app.auth.ServerAuthSessionState; import org.jdiameter.server.impl.app.auth.IServerAuthSessionData; @@ -65,12 +65,11 @@ public class ServerAuthSessionDataReplicatedImpl extends AppSessionDataReplicate private static final String TS_TIMERID = "TS_TIMERID"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ServerAuthSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerAuthSession.class); @@ -81,10 +80,12 @@ public ServerAuthSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobi /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ServerAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -95,7 +96,7 @@ public ServerAuthSessionDataReplicatedImpl(String sessionId, MobicentsCluster mo @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); @@ -110,7 +111,7 @@ public boolean isStateless() { @Override public void setStateless(boolean stateless) { if (exists()) { - getNode().put(STATELESS, stateless); + putNodeValue(STATELESS, stateless); } else { throw new IllegalStateException(); @@ -125,7 +126,7 @@ public void setStateless(boolean stateless) { @Override public ServerAuthSessionState getServerAuthSessionState() { if (exists()) { - return (ServerAuthSessionState) getNode().get(STATE); + return (ServerAuthSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -141,7 +142,7 @@ public ServerAuthSessionState getServerAuthSessionState() { @Override public void setServerAuthSessionState(ServerAuthSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -151,7 +152,7 @@ public void setServerAuthSessionState(ServerAuthSessionState state) { @Override public void setTsTimeout(long value) { if (exists()) { - getNode().put(TS_TIMEOUT, value); + putNodeValue(TS_TIMEOUT, value); } else { throw new IllegalStateException(); @@ -161,7 +162,7 @@ public void setTsTimeout(long value) { @Override public long getTsTimeout() { if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + return toPrimitive((Long) getNodeValue(TS_TIMEOUT)); } else { throw new IllegalStateException(); @@ -171,7 +172,7 @@ public long getTsTimeout() { @Override public void setTsTimerId(Serializable value) { if (exists()) { - getNode().put(TS_TIMERID, value); + putNodeValue(TS_TIMERID, value); } else { throw new IllegalStateException(); @@ -181,7 +182,7 @@ public void setTsTimerId(Serializable value) { @Override public Serializable getTsTimerId() { if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); + return (Serializable) getNodeValue(TS_TIMERID); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java index c7e879b81..9ecbefc1f 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cca/ServerCCASessionDataReplicatedImpl.java @@ -44,7 +44,7 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.cca.ServerCCASession; import org.jdiameter.common.api.app.cca.ServerCCASessionState; import org.jdiameter.server.impl.app.cca.IServerCCASessionData; @@ -64,12 +64,11 @@ public class ServerCCASessionDataReplicatedImpl extends AppSessionDataReplicated private static final String STATE = "STATE"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ServerCCASessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerCCASession.class); @@ -80,10 +79,12 @@ public ServerCCASessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobic /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ServerCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -94,7 +95,7 @@ public ServerCCASessionDataReplicatedImpl(String sessionId, MobicentsCluster mob @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); @@ -109,7 +110,7 @@ public boolean isStateless() { @Override public void setStateless(boolean stateless) { if (exists()) { - getNode().put(STATELESS, stateless); + putNodeValue(STATELESS, stateless); } else { throw new IllegalStateException(); @@ -124,7 +125,7 @@ public void setStateless(boolean stateless) { @Override public ServerCCASessionState getServerCCASessionState() { if (exists()) { - return (ServerCCASessionState) getNode().get(STATE); + return (ServerCCASessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -140,7 +141,7 @@ public ServerCCASessionState getServerCCASessionState() { @Override public void setServerCCASessionState(ServerCCASessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -155,7 +156,7 @@ public void setServerCCASessionState(ServerCCASessionState state) { @Override public void setTccTimerId(Serializable tccTimerId) { if (exists()) { - getNode().put(TCCID, tccTimerId); + putNodeValue(TCCID, tccTimerId); } else { throw new IllegalStateException(); @@ -170,7 +171,7 @@ public void setTccTimerId(Serializable tccTimerId) { @Override public Serializable getTccTimerId() { if (exists()) { - return (Serializable) getNode().get(TCCID); + return (Serializable) getNodeValue(TCCID); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java index 721008b01..db3a35979 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/cxdx/ServerCxDxSessionDataReplicatedImpl.java @@ -42,7 +42,7 @@ package org.mobicents.diameter.impl.ha.server.cxdx; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.cxdx.ServerCxDxSession; import org.jdiameter.client.api.IContainer; import org.jdiameter.common.api.app.cxdx.CxDxSessionState; @@ -59,12 +59,12 @@ public class ServerCxDxSessionDataReplicatedImpl extends CxDxSessionDataReplicatedImpl implements IServerCxDxSessionData { /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); + public ServerCxDxSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster, container); if (super.create()) { setAppSessionIface(this, ServerCxDxSession.class); @@ -75,10 +75,13 @@ public ServerCxDxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobi /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ServerCxDxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java index d59f82634..f62ec070a 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/gx/ServerGxSessionDataReplicatedImpl.java @@ -44,7 +44,7 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.gx.ServerGxSession; import org.jdiameter.common.api.app.gx.ServerGxSessionState; import org.jdiameter.server.impl.app.gx.IServerGxSessionData; @@ -64,12 +64,11 @@ public class ServerGxSessionDataReplicatedImpl extends AppSessionDataReplicatedI private static final String STATE = "STATE"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ServerGxSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerGxSession.class); @@ -80,10 +79,12 @@ public ServerGxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ServerGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -94,7 +95,7 @@ public ServerGxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobi @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); @@ -109,7 +110,7 @@ public boolean isStateless() { @Override public void setStateless(boolean stateless) { if (exists()) { - getNode().put(STATELESS, stateless); + putNodeValue(STATELESS, stateless); } else { throw new IllegalStateException(); @@ -124,7 +125,7 @@ public void setStateless(boolean stateless) { @Override public ServerGxSessionState getServerGxSessionState() { if (exists()) { - return (ServerGxSessionState) getNode().get(STATE); + return (ServerGxSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -141,7 +142,7 @@ public ServerGxSessionState getServerGxSessionState() { public void setServerGxSessionState(ServerGxSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -157,7 +158,7 @@ public void setServerGxSessionState(ServerGxSessionState state) { @Override public void setTccTimerId(Serializable tccTimerId) { if (exists()) { - getNode().put(TCCID, tccTimerId); + putNodeValue(TCCID, tccTimerId); } else { throw new IllegalStateException(); @@ -172,7 +173,7 @@ public void setTccTimerId(Serializable tccTimerId) { @Override public Serializable getTccTimerId() { if (exists()) { - return (Serializable) getNode().get(TCCID); + return (Serializable) getNodeValue(TCCID); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java index c4d95e083..655d575b3 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rf/ServerRfSessionDataReplicatedImpl.java @@ -44,7 +44,7 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.rf.ServerRfSession; import org.jdiameter.common.api.app.rf.ServerRfSessionState; import org.jdiameter.server.impl.app.rf.IServerRfSessionData; @@ -65,12 +65,11 @@ public class ServerRfSessionDataReplicatedImpl extends AppSessionDataReplicatedI private static final String TS_TIMEOUT = "TS_TIMEOUT"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ServerRfSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerRfSession.class); @@ -81,10 +80,12 @@ public ServerRfSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ServerRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -95,7 +96,7 @@ public ServerRfSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobi @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); @@ -110,7 +111,7 @@ public boolean isStateless() { @Override public void setStateless(boolean stateless) { if (exists()) { - getNode().put(STATELESS, stateless); + putNodeValue(STATELESS, stateless); } else { throw new IllegalStateException(); @@ -125,7 +126,7 @@ public void setStateless(boolean stateless) { @Override public ServerRfSessionState getServerRfSessionState() { if (exists()) { - return (ServerRfSessionState) getNode().get(STATE); + return (ServerRfSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -141,7 +142,7 @@ public ServerRfSessionState getServerRfSessionState() { @Override public void setServerRfSessionState(ServerRfSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -156,7 +157,7 @@ public void setServerRfSessionState(ServerRfSessionState state) { @Override public void setTsTimerId(Serializable tccTimerId) { if (exists()) { - getNode().put(TS_TIMERID, tccTimerId); + putNodeValue(TS_TIMERID, tccTimerId); } else { throw new IllegalStateException(); @@ -171,7 +172,7 @@ public void setTsTimerId(Serializable tccTimerId) { @Override public Serializable getTsTimerId() { if (exists()) { - return (Serializable) getNode().get(TS_TIMERID); + return (Serializable) getNodeValue(TS_TIMERID); } else { throw new IllegalStateException(); @@ -186,7 +187,7 @@ public Serializable getTsTimerId() { @Override public long getTsTimeout() { if (exists()) { - return toPrimitive((Long) getNode().get(TS_TIMEOUT)); + return toPrimitive((Long) getNodeValue(TS_TIMEOUT)); } else { throw new IllegalStateException(); @@ -201,7 +202,7 @@ public long getTsTimeout() { @Override public void setTsTimeout(long l) { if (exists()) { - getNode().put(TS_TIMEOUT, l); + putNodeValue(TS_TIMEOUT, l); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java index 0cfddabc8..0d20a7089 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/ro/ServerRoSessionDataReplicatedImpl.java @@ -44,7 +44,7 @@ import java.io.Serializable; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.ro.ServerRoSession; import org.jdiameter.common.api.app.ro.ServerRoSessionState; import org.jdiameter.server.impl.app.ro.IServerRoSessionData; @@ -64,12 +64,11 @@ public class ServerRoSessionDataReplicatedImpl extends AppSessionDataReplicatedI private static final String STATE = "STATE"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ServerRoSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerRoSession.class); @@ -80,10 +79,12 @@ public ServerRoSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ServerRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -94,7 +95,7 @@ public ServerRoSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobi @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); @@ -109,7 +110,7 @@ public boolean isStateless() { @Override public void setStateless(boolean stateless) { if (exists()) { - getNode().put(STATELESS, stateless); + putNodeValue(STATELESS, stateless); } else { throw new IllegalStateException(); @@ -124,7 +125,7 @@ public void setStateless(boolean stateless) { @Override public ServerRoSessionState getServerRoSessionState() { if (exists()) { - return (ServerRoSessionState) getNode().get(STATE); + return (ServerRoSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); @@ -140,7 +141,7 @@ public ServerRoSessionState getServerRoSessionState() { @Override public void setServerRoSessionState(ServerRoSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); @@ -155,7 +156,7 @@ public void setServerRoSessionState(ServerRoSessionState state) { @Override public void setTccTimerId(Serializable tccTimerId) { if (exists()) { - getNode().put(TCCID, tccTimerId); + putNodeValue(TCCID, tccTimerId); } else { throw new IllegalStateException(); @@ -170,7 +171,7 @@ public void setTccTimerId(Serializable tccTimerId) { @Override public Serializable getTccTimerId() { if (exists()) { - return (Serializable) getNode().get(TCCID); + return (Serializable) getNodeValue(TCCID); } else { throw new IllegalStateException(); diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java index 8e12227a3..f98d4fd21 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/rx/ServerRxSessionDataReplicatedImpl.java @@ -42,7 +42,7 @@ package org.mobicents.diameter.impl.ha.server.rx; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.rx.ServerRxSession; import org.jdiameter.common.api.app.rx.ServerRxSessionState; import org.jdiameter.server.impl.app.rx.IServerRxSessionData; @@ -61,12 +61,11 @@ public class ServerRxSessionDataReplicatedImpl extends AppSessionDataReplicatedI private static final String STATE = "STATE"; /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ServerRxSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerRxSession.class); @@ -77,10 +76,12 @@ public ServerRxSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ServerRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } /* @@ -91,7 +92,7 @@ public ServerRxSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobi @Override public boolean isStateless() { if (exists()) { - return toPrimitive((Boolean) getNode().get(STATELESS), true); + return toPrimitive((Boolean) getNodeValue(STATELESS), true); } else { throw new IllegalStateException(); } @@ -105,7 +106,7 @@ public boolean isStateless() { @Override public void setStateless(boolean stateless) { if (exists()) { - getNode().put(STATELESS, stateless); + putNodeValue(STATELESS, stateless); } else { throw new IllegalStateException(); } @@ -119,7 +120,7 @@ public void setStateless(boolean stateless) { @Override public ServerRxSessionState getServerRxSessionState() { if (exists()) { - return (ServerRxSessionState) getNode().get(STATE); + return (ServerRxSessionState) getNodeValue(STATE); } else { throw new IllegalStateException(); } @@ -135,7 +136,7 @@ public ServerRxSessionState getServerRxSessionState() { public void setServerRxSessionState(ServerRxSessionState state) { if (exists()) { - getNode().put(STATE, state); + putNodeValue(STATE, state); } else { throw new IllegalStateException(); } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java index fab5ef951..df09e52e2 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/s13/ServerS13SessionDataReplicatedImpl.java @@ -19,7 +19,7 @@ package org.mobicents.diameter.impl.ha.server.s13; -import org.jboss.cache.Fqn; +import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.s13.ServerS13Session; import org.jdiameter.client.api.IContainer; import org.jdiameter.common.api.app.s13.S13SessionState; @@ -36,12 +36,12 @@ public class ServerS13SessionDataReplicatedImpl extends S13SessionDataReplicatedImpl implements IServerS13SessionData { /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface + * @param container */ - public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster, IContainer container) { - super(nodeFqn, mobicentsCluster, container); + public ServerS13SessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster, IContainer container) { + super(nodeFqnWrapper, mobicentsCluster, container); if (super.create()) { setAppSessionIface(this, ServerS13Session.class); @@ -52,10 +52,13 @@ public ServerS13SessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobic /** * @param sessionId * @param mobicentsCluster - * @param iface + * @param container */ public ServerS13SessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster, IContainer container) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster, container); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster, container + ); } } diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java index c8837f09d..9820dc04c 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/server/sh/ShServerSessionDataReplicatedImpl.java @@ -42,7 +42,7 @@ package org.mobicents.diameter.impl.ha.server.sh; -import org.jboss.cache.Fqn; + import org.restcomm.cache.FqnWrapper; import org.jdiameter.api.sh.ServerShSession; import org.jdiameter.server.impl.app.sh.IShServerSessionData; import org.restcomm.cluster.MobicentsCluster; @@ -57,12 +57,11 @@ public class ShServerSessionDataReplicatedImpl extends AppSessionDataReplicatedImpl implements IShServerSessionData { /** - * @param nodeFqn + * @param nodeFqnWrapper * @param mobicentsCluster - * @param iface */ - public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobicentsCluster) { - super(nodeFqn, mobicentsCluster); + public ShServerSessionDataReplicatedImpl(FqnWrapper nodeFqnWrapper, MobicentsCluster mobicentsCluster) { + super(nodeFqnWrapper, mobicentsCluster); if (super.create()) { setAppSessionIface(this, ServerShSession.class); @@ -72,10 +71,12 @@ public ShServerSessionDataReplicatedImpl(Fqn nodeFqn, MobicentsCluster mobice /** * @param sessionId * @param mobicentsCluster - * @param iface */ public ShServerSessionDataReplicatedImpl(String sessionId, MobicentsCluster mobicentsCluster) { - this(Fqn.fromRelativeElements(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), mobicentsCluster); + this( + FqnWrapper.fromRelativeElementsWrapper(ReplicatedSessionDatasource.SESSIONS_FQN, sessionId), + mobicentsCluster + ); } } From 672e09d1217157f69b137dac01b5d1ce58499c0d Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 21 Apr 2017 13:25:10 +0300 Subject: [PATCH 50/75] Creating single module jdiameter-ha-impl. Fixing pom files. --- core/jdiameter-ha/api/pom.xml | 2 + core/jdiameter-ha/impl/pom.xml | 7 ++++ core/jdiameter-ha/pom.xml | 76 ---------------------------------- core/mux/jar/pom.xml | 1 - core/mux/pom.xml | 15 +------ core/mux/sar-jboss-5/pom.xml | 4 ++ core/mux/sar-wildfly/pom.xml | 19 +++++++-- pom.xml | 22 ++++++++++ 8 files changed, 52 insertions(+), 94 deletions(-) diff --git a/core/jdiameter-ha/api/pom.xml b/core/jdiameter-ha/api/pom.xml index 51d6903f9..0d55391c8 100644 --- a/core/jdiameter-ha/api/pom.xml +++ b/core/jdiameter-ha/api/pom.xml @@ -53,10 +53,12 @@ --> + diff --git a/core/jdiameter-ha/impl/pom.xml b/core/jdiameter-ha/impl/pom.xml index fd891cfc8..bb4909e3e 100644 --- a/core/jdiameter-ha/impl/pom.xml +++ b/core/jdiameter-ha/impl/pom.xml @@ -26,11 +26,13 @@ + @@ -38,6 +40,11 @@ jboss-ha-server-cache-jbc + + org.restcomm.cluster + core + + org.restcomm.cluster cache diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index 7c3711655..6f12096a7 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -18,50 +18,10 @@ api impl - - - - - - - - - - 3.0.0-SNAPSHOT @@ -77,42 +37,6 @@ ${project.version} - - - - org.restcomm.cluster core diff --git a/core/mux/jar/pom.xml b/core/mux/jar/pom.xml index 4b560dce7..7de2f9edd 100644 --- a/core/mux/jar/pom.xml +++ b/core/mux/jar/pom.xml @@ -47,7 +47,6 @@ org.mobicents.diameter - jdiameter-ha-impl diff --git a/core/mux/pom.xml b/core/mux/pom.xml index f7c487384..011617c90 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -19,8 +19,6 @@ 1.5.9.0-build538-SNAPSHOT 1.1.0-SNAPSHOT --> - - pom @@ -41,11 +39,7 @@ jboss5 @@ -56,11 +50,7 @@ wildfly @@ -88,7 +78,6 @@ ${project.groupId} - jdiameter-ha-impl ${project.version} diff --git a/core/mux/sar-jboss-5/pom.xml b/core/mux/sar-jboss-5/pom.xml index 3ad585cde..b3cda1e2c 100644 --- a/core/mux/sar-jboss-5/pom.xml +++ b/core/mux/sar-jboss-5/pom.xml @@ -126,9 +126,11 @@ org.slf4j:slf4j-api org.slf4j:slf4j-log4j12 --> + @@ -152,6 +154,8 @@ + diff --git a/core/mux/sar-wildfly/pom.xml b/core/mux/sar-wildfly/pom.xml index d61e2f312..e86c30064 100644 --- a/core/mux/sar-wildfly/pom.xml +++ b/core/mux/sar-wildfly/pom.xml @@ -149,12 +149,19 @@ org.jboss.naming:jnp-client org.jboss.security:jbosssx-client org.jboss.security:jboss-security-spi - + picocontainer:picocontainer + --> + xml-apis:xml-apis - + + @@ -204,6 +211,8 @@ + @@ -249,7 +258,9 @@ + diff --git a/pom.xml b/pom.xml index 8fc0041db..f2c961de8 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,8 @@ true 6.18 1.8 + + @@ -232,6 +234,26 @@ + testsuite From 12f12a571dc72108a7b82c8c64669175a7068f8d Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 21 Apr 2017 13:26:09 +0300 Subject: [PATCH 51/75] Creating single module jdiameter-ha-impl. Fixing pom files for TestSuite. --- testsuite/pom.xml | 3 +-- testsuite/tests/pom.xml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/testsuite/pom.xml b/testsuite/pom.xml index 6b2e7b4f6..c4cc09f7f 100644 --- a/testsuite/pom.xml +++ b/testsuite/pom.xml @@ -22,7 +22,6 @@ 1.7.2 4.11 2.19 - wildfly @@ -45,7 +44,7 @@ org.mobicents.diameter - jdiameter-ha-impl-${ha.impl} + jdiameter-ha-impl ${project.version} diff --git a/testsuite/tests/pom.xml b/testsuite/tests/pom.xml index c5f66b01c..8f19173ff 100644 --- a/testsuite/tests/pom.xml +++ b/testsuite/tests/pom.xml @@ -29,7 +29,7 @@ org.mobicents.diameter - jdiameter-ha-impl-${ha.impl} + jdiameter-ha-impl runtime From c78dcd56d4fdfed91225d5c27f19487dc990cdc0 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Fri, 21 Apr 2017 17:18:55 +0300 Subject: [PATCH 52/75] Fixing Cluster dependency. --- core/mux/pom.xml | 17 +++++++++++++++++ pom.xml | 4 ++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/core/mux/pom.xml b/core/mux/pom.xml index 011617c90..c0722e82b 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -81,6 +81,23 @@ jdiameter-ha-impl ${project.version} + + org.restcomm.cluster + core + ${cluster.version} + + + + org.restcomm.cluster + cache + ${cluster.version} + + + + org.restcomm.cluster + timers + ${cluster.version} + diff --git a/pom.xml b/pom.xml index f2c961de8..a1c2de196 100644 --- a/pom.xml +++ b/pom.xml @@ -234,7 +234,7 @@ - + testsuite From 8b8d6cfc140780491fd30309f07c0d22e415b129 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 24 Apr 2017 12:45:39 +0300 Subject: [PATCH 53/75] Updating cluster versions. Updating release build. --- core/mux/pom.xml | 3 +-- pom.xml | 4 ++-- release/build.xml | 31 ++++++++----------------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/core/mux/pom.xml b/core/mux/pom.xml index c0722e82b..4eaa6461f 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -81,18 +81,17 @@ jdiameter-ha-impl ${project.version} + org.restcomm.cluster core ${cluster.version} - org.restcomm.cluster cache ${cluster.version} - org.restcomm.cluster timers diff --git a/pom.xml b/pom.xml index a1c2de196..874a0e791 100644 --- a/pom.xml +++ b/pom.xml @@ -241,7 +241,7 @@ false - 1.15.0-SNAPSHOT + 1.15.27 @@ -250,7 +250,7 @@ false - 3.0.0-SNAPSHOT + 3.0.0.11 diff --git a/release/build.xml b/release/build.xml index 957731204..5efa5f488 100644 --- a/release/build.xml +++ b/release/build.xml @@ -150,21 +150,11 @@ - - - - - - - @@ -213,12 +203,9 @@ - @@ -442,17 +429,16 @@ - + - + - - - + + @@ -494,8 +480,7 @@ - - + From cc2df38627fa82d2a7bb88033dfa5d5397ad0eff Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 24 Apr 2017 13:21:54 +0300 Subject: [PATCH 54/75] Fixing release build: updated build core source for JBoss5 and WildFly. --- core/mux/pom.xml | 2 ++ release/build.xml | 12 +++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/core/mux/pom.xml b/core/mux/pom.xml index 4eaa6461f..d9acd597e 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -28,6 +28,7 @@ + jboss5 From 00b76553474f19f83f2474e403c64174d56ae491 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 24 Apr 2017 15:59:46 +0300 Subject: [PATCH 56/75] Fixing getting TransactionManager via getTxManager method of MobicentsCache. --- core/jdiameter-ha/impl/pom.xml | 16 ++++------------ .../ha/data/ReplicatedSessionDatasource.java | 15 ++++++--------- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/core/jdiameter-ha/impl/pom.xml b/core/jdiameter-ha/impl/pom.xml index bb4909e3e..90bd987ee 100644 --- a/core/jdiameter-ha/impl/pom.xml +++ b/core/jdiameter-ha/impl/pom.xml @@ -25,19 +25,11 @@ jdiameter-impl - - - org.jboss.logging - jboss-logging-log4j - provided - - --> - - - - org.jboss.cluster - jboss-ha-server-cache-jbc + javax + javaee-api + 6.0 diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java index 349c0b195..1fc5e1eac 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java @@ -122,20 +122,17 @@ public ReplicatedSessionDatasource(IContainer container, ISessionDatasource loca this.localDataSource = localDataSource; MobicentsCache mcCache = null; - TransactionManager txMgr = null; try { mcCache = new MobicentsCache(cacheConfigFilename); - - // TODO: TxManager - - //Class txMgrClass = Class.forName(mcCache.getJBossCache().getConfiguration().getTransactionManagerLookupClass()); - //Object txMgrLookup = txMgrClass.getConstructor(new Class[]{}).newInstance(new Object[]{}); - //txMgr = (TransactionManager) txMgrClass.getMethod("getTransactionManager", new Class[]{}).invoke(txMgrLookup, new Object[]{}); } catch (Exception e) { - logger.debug("Could not fetch TxMgr. Not using one.", e); - // let's not have Tx Manager than... + logger.debug("Could not create MobicentsCache: ", e); } + TransactionManager txMgr = null; + if (mcCache != null) { + txMgr = mcCache.getTxManager(); + } + this.mobicentsCluster = new DefaultMobicentsCluster(mcCache, txMgr, new DefaultClusterElector()); this.mobicentsCluster.addDataRemovalListener(this); // register, so we know WHEN some other node removes session. this.mobicentsCluster.startCluster(); From cea1a06f27d38e56b332d796a0c07f1001a705d0 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 24 Apr 2017 16:29:48 +0300 Subject: [PATCH 57/75] Fixing pom files on Cluster dependency. --- core/jdiameter-ha/pom.xml | 19 ------------------- core/mux/pom.xml | 20 -------------------- core/mux/sar-jboss-5/pom.xml | 16 ++++++++++++++++ pom.xml | 27 +++++++++++++++++++++++++-- 4 files changed, 41 insertions(+), 41 deletions(-) diff --git a/core/jdiameter-ha/pom.xml b/core/jdiameter-ha/pom.xml index 6f12096a7..781fae464 100644 --- a/core/jdiameter-ha/pom.xml +++ b/core/jdiameter-ha/pom.xml @@ -36,25 +36,6 @@ jdiameter-impl ${project.version} - - - org.restcomm.cluster - core - ${cluster.version} - - - - org.restcomm.cluster - cache - ${cluster.version} - - - - org.restcomm.cluster - timers - ${cluster.version} - - diff --git a/core/mux/pom.xml b/core/mux/pom.xml index d9acd597e..1d6f4d07f 100644 --- a/core/mux/pom.xml +++ b/core/mux/pom.xml @@ -39,22 +39,18 @@ --> jboss5 - sar-jboss-5 wildfly - sar-wildfly @@ -83,22 +79,6 @@ jdiameter-ha-impl ${project.version} - - - org.restcomm.cluster - core - ${cluster.version} - - - org.restcomm.cluster - cache - ${cluster.version} - - - org.restcomm.cluster - timers - ${cluster.version} - diff --git a/core/mux/sar-jboss-5/pom.xml b/core/mux/sar-jboss-5/pom.xml index b3cda1e2c..d08d7ed0e 100644 --- a/core/mux/sar-jboss-5/pom.xml +++ b/core/mux/sar-jboss-5/pom.xml @@ -22,6 +22,22 @@ ${project.version} runtime + + + org.restcomm.cluster + core + compile + + + org.restcomm.cluster + cache + compile + + + org.restcomm.cluster + timers + compile + diff --git a/pom.xml b/pom.xml index 4e4b5e9bb..acf3e90a6 100644 --- a/pom.xml +++ b/pom.xml @@ -241,7 +241,7 @@ false - 1.15.27 + 1.15.28 @@ -250,7 +250,7 @@ false - 3.0.0.11 + 3.0.0.12 @@ -292,6 +292,29 @@ + + + + org.restcomm.cluster + core + ${cluster.version} + provided + + + org.restcomm.cluster + cache + ${cluster.version} + provided + + + org.restcomm.cluster + timers + ${cluster.version} + provided + + + + mobicents-public-repository-group From b7f950634b42ab5ae881900aed213c6ce1acc792 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Mon, 24 Apr 2017 16:39:11 +0300 Subject: [PATCH 58/75] Fixing stylecheck error. --- .../diameter/impl/ha/data/ReplicatedSessionDatasource.java | 1 - 1 file changed, 1 deletion(-) diff --git a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java index 1fc5e1eac..1ca5eb44a 100644 --- a/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java +++ b/core/jdiameter-ha/impl/src/main/java/org/mobicents/diameter/impl/ha/data/ReplicatedSessionDatasource.java @@ -132,7 +132,6 @@ public ReplicatedSessionDatasource(IContainer container, ISessionDatasource loca if (mcCache != null) { txMgr = mcCache.getTxManager(); } - this.mobicentsCluster = new DefaultMobicentsCluster(mcCache, txMgr, new DefaultClusterElector()); this.mobicentsCluster.addDataRemovalListener(this); // register, so we know WHEN some other node removes session. this.mobicentsCluster.startCluster(); From c1228b919605ee79cd356a451ca3916147ce2f1e Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Tue, 25 Apr 2017 17:48:05 +0300 Subject: [PATCH 59/75] Updating Cluster versions. --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index acf3e90a6..419977b66 100644 --- a/pom.xml +++ b/pom.xml @@ -241,7 +241,7 @@ false - 1.15.28 + 1.15.29 @@ -250,7 +250,7 @@ false - 3.0.0.12 + 3.0.0.13 From 2d18554b23f790b8199e52c0b4cb2ef9eb7a74a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Mon, 1 May 2017 18:54:25 +0100 Subject: [PATCH 60/75] Proper cleanup by shutting down ScheduledExecutorService Fixes #27 --- .../java/org/jdiameter/server/impl/io/tcp/NetworkGuard.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/io/tcp/NetworkGuard.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/io/tcp/NetworkGuard.java index 2b21036d7..866f7058a 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/io/tcp/NetworkGuard.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/io/tcp/NetworkGuard.java @@ -281,6 +281,9 @@ public void cleanTask() { } serverSocket = null; } + if (binder != null) { + binder.shutdown(); + } } @Override From 9a9a8d15bcec828a8ca81c5b72b9e6bc9faea13e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Mon, 1 May 2017 19:36:11 +0100 Subject: [PATCH 61/75] Improvements to logging failure situations - Log in case of unable to write to socket; - Log in case of reading an invalid message version; - Change DEBUG to WARN log for rejected CER with NO_COMMON_APPLICATION; --- .../client/impl/transport/tcp/TCPTransportClient.java | 4 ++++ .../src/main/java/org/jdiameter/server/impl/PeerImpl.java | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java index 88d619226..594ef89cd 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java @@ -313,6 +313,9 @@ public void sendMessage(ByteBuffer bytes) throws IOException { if (rc == -1) { throw new IOException("Connection closed"); } + else if (rc == 0) { + logger.error("socketChannel.write(bytes) - returned zero indicating that perhaps the write buffer is full"); + } if (logger.isDebugEnabled()) { logger.debug("Sent a byte buffer of size [{}] over the TCP nio socket [{}]", bytes.array().length, socketDescription); } @@ -392,6 +395,7 @@ private boolean seekMessage() { // ZhixiaoLuo: fix #28, if unlucky storage.limit < data.length(1024), then always failed to do storage.put(data) // ZhixiaoLuo: and get BufferOverflowException in append(data) storage.clear(); + logger.error("Invalid message version detected [" + vers + "]"); return false; } // extract the message length, so we know how much to read diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java index 1b8be7612..08131bf3d 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java @@ -258,8 +258,8 @@ public int processCerMessage(String key, IMessage message) { // Process cer Set newAppId = getCommonApplicationIds(message); if (newAppId.isEmpty()) { - if (logger.isDebugEnabled()) { - logger.debug("Processing CER failed, no common application. Message AppIds [{}]", message.getApplicationIdAvps()); + if(logger.isWarnEnabled()) { + logger.warn("Processing CER failed, no common application. Message AppIds [{}]", message.getApplicationIdAvps()); } return ResultCode.NO_COMMON_APPLICATION; } From 5e41faacd0cf3a86f311d2202493fd239609c815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Tue, 2 May 2017 13:04:44 +0100 Subject: [PATCH 62/75] Fix Network breakdown cause a file descriptor leak Fix suggested by @shark300 Fixes #3 --- .../transport/tcp/TCPTransportClient.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java index 594ef89cd..cf864cccb 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java @@ -124,13 +124,24 @@ public void initialize() throws IOException, NotInitializedException { throw new NotInitializedException("Destination address is not set"); } socketChannel = SelectorProvider.provider().openSocketChannel(); - if (origAddress != null) { - socketChannel.socket().bind(origAddress); + + try { + if (origAddress != null) { + socketChannel.socket().bind(origAddress); + } + + socketChannel.connect(destAddress); + //PCB added logging + socketChannel.configureBlocking(BLOCKING_IO); + getParent().onConnected(); + } + catch (IOException e) { + if (origAddress != null) { + socketChannel.socket().close(); + } + socketChannel.close(); + throw e; } - socketChannel.connect(destAddress); - //PCB added logging - socketChannel.configureBlocking(BLOCKING_IO); - getParent().onConnected(); } public TCPClientConnection getParent() { From d8bae844170117175920500a6800eef4652c2a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Thu, 4 May 2017 17:03:24 +0100 Subject: [PATCH 63/75] Fix session leak in update failure for Ro, Gx and Rx For Ro we use MSCC Validity-Time AVP for setting the Tcc Timer, for Gx and Rx we just move to IDLE state. Also improve CCA to lookup for Validity-Time AVP is MSCC if not found at message top-level. Fixes #23 --- .../impl/app/cca/ServerCCASessionImpl.java | 16 ++++- .../impl/app/gx/ServerGxSessionImpl.java | 4 ++ .../impl/app/ro/ServerRoSessionImpl.java | 72 ++++++++++--------- .../impl/app/rx/ServerRxSessionImpl.java | 2 + 4 files changed, 58 insertions(+), 36 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java index 9fb05777d..12446261a 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/cca/ServerCCASessionImpl.java @@ -200,7 +200,12 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE // Action: Send CC initial answer, reserve units, start Tcc // New State: OPEN if (isSuccess(resultCode)) { - startTcc(answer.getValidityTimeAvp()); + Avp vtAvp = answer.getValidityTimeAvp(); + if (vtAvp == null) { + Avp mscc = answer.getMessage().getAvps().getAvp(Avp.MULTIPLE_SERVICES_CREDIT_CONTROL); + vtAvp = mscc != null ? mscc.getGrouped().getAvp(Avp.VALIDITY_TIME) : null; + } + startTcc(vtAvp); newState = ServerCCASessionState.OPEN; } // Current State: IDLE @@ -253,7 +258,12 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE // Event: CC update request received and successfully processed // Action: Send CC update answer, debit used units, reserve new units, restart Tcc // New State: OPEN - startTcc(answer.getValidityTimeAvp()); + Avp vtAvp = answer.getValidityTimeAvp(); + if (vtAvp == null) { + Avp mscc = answer.getMessage().getAvps().getAvp(Avp.MULTIPLE_SERVICES_CREDIT_CONTROL); + vtAvp = mscc != null ? mscc.getGrouped().getAvp(Avp.VALIDITY_TIME) : null; + } + startTcc(vtAvp); } else { // Current State: OPEN @@ -397,6 +407,8 @@ private void startTcc(Avp validityAvp) { tccTimeout = 2 * context.getDefaultValidityTime(); } + logger.debug("Starting TCC timer with Validity-Avp[{}] and tccTimeout[{}] seconds", validityAvp, tccTimeout); + if (sessionData.getTccTimerId() != null) { stopTcc(true); //tccFuture = super.scheduler.schedule(new TccScheduledTask(this), defaultValue, TimeUnit.SECONDS); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java index af5bd3f98..d7ac1e3e5 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/gx/ServerGxSessionImpl.java @@ -252,12 +252,16 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE // New State: IDLE // It's a failure, we wait for Tcc to fire -- FIXME: Alexandre: Should we? + newState = ServerGxSessionState.IDLE; } } catch (AvpDataException e) { throw new InternalException(e); } dispatchEvent(localEvent.getAnswer()); + if (newState != null) { + setState(newState); + } break; case RECEIVED_TERMINATE: listener.doCreditControlRequest(this, (GxCreditControlRequest) localEvent.getRequest()); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java index 4c08c29b7..e90b0b5cd 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/ro/ServerRoSessionImpl.java @@ -200,7 +200,9 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE // Action: Send CC initial answer, reserve units, start Tcc // New State: OPEN if (isSuccess(resultCode)) { - startTcc(answer.getValidityTimeAvp()); + Avp mscc = answer.getMessage().getAvps().getAvp(Avp.MULTIPLE_SERVICES_CREDIT_CONTROL); + Avp vtAvp = mscc != null ? mscc.getGrouped().getAvp(Avp.VALIDITY_TIME) : null; + startTcc(vtAvp); newState = ServerRoSessionState.OPEN; } // Current State: IDLE @@ -254,7 +256,9 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE // Event: CC update request received and successfully processed // Action: Send CC update answer, debit used units, reserve new units, restart Tcc // New State: OPEN - startTcc(answer.getValidityTimeAvp()); + Avp mscc = answer.getMessage().getAvps().getAvp(Avp.MULTIPLE_SERVICES_CREDIT_CONTROL); + Avp vtAvp = mscc != null ? mscc.getGrouped().getAvp(Avp.VALIDITY_TIME) : null; + startTcc(vtAvp); } else { // Current State: OPEN @@ -390,36 +394,36 @@ public void timeoutExpired(Request request) { } private void startTcc(Avp validityAvp) { - // There is no Validity-Time - //long tccTimeout; - // - //if(validityAvp != null) { - // try { - // tccTimeout = 2 * validityAvp.getUnsigned32(); - // } - // catch (AvpDataException e) { - // logger.debug("Unable to retrieve Validity-Time AVP value, using default.", e); - // tccTimeout = 2 * context.getDefaultValidityTime(); - // } - //} - //else { - // tccTimeout = 2 * context.getDefaultValidityTime(); - //} - // - //if(tccTimerId != null) { - // stopTcc(true); - // //tccFuture = super.scheduler.schedule(new TccScheduledTask(this), defaultValue, TimeUnit.SECONDS); - // tccTimerId = super.timerFacility.schedule(this.sessionId, TCC_TIMER_NAME, tccTimeout * 1000); - // // FIXME: this accepts Future! - // context.sessionSupervisionTimerReStarted(this, null); - //} - //else { - // //tccFuture = super.scheduler.schedule(new TccScheduledTask(this), defaultValue, TimeUnit.SECONDS); - // tccTimerId = super.timerFacility.schedule(this.sessionId, TCC_TIMER_NAME, tccTimeout * 1000); - // //FIXME: this accepts Future! - // context.sessionSupervisionTimerStarted(this, null); - //} - //super.sessionDataSource.updateSession(this); + long tccTimeout; + + if (validityAvp != null) { + try { + tccTimeout = 2 * validityAvp.getUnsigned32(); + } + catch (AvpDataException e) { + logger.debug("Unable to retrieve Validity-Time AVP value, using default.", e); + tccTimeout = 2 * context.getDefaultValidityTime(); + } + } + else { + tccTimeout = 2 * context.getDefaultValidityTime(); + } + + logger.debug("Starting TCC timer with Validity-Avp[{}] and tccTimeout[{}] seconds", validityAvp, tccTimeout); + + if (sessionData.getTccTimerId() != null) { + stopTcc(true); + //tccFuture = super.scheduler.schedule(new TccScheduledTask(this), defaultValue, TimeUnit.SECONDS); + this.sessionData.setTccTimerId(super.timerFacility.schedule(this.getSessionId(), TCC_TIMER_NAME, tccTimeout * 1000)); + // FIXME: this accepts Future! + context.sessionSupervisionTimerReStarted(this, null); + } + else { + //tccFuture = super.scheduler.schedule(new TccScheduledTask(this), defaultValue, TimeUnit.SECONDS); + this.sessionData.setTccTimerId(super.timerFacility.schedule(this.getSessionId(), TCC_TIMER_NAME, tccTimeout * 1000)); + //FIXME: this accepts Future! + context.sessionSupervisionTimerStarted(this, null); + } } /* @@ -441,12 +445,12 @@ else if (timerName.equals(TCC_TIMER_NAME)) { } private void stopTcc(boolean willRestart) { - Serializable tccTimerId = sessionData.getTccTimerId(); + Serializable tccTimerId = this.sessionData.getTccTimerId(); if (tccTimerId != null) { // tccFuture.cancel(false); super.timerFacility.cancel(tccTimerId); // ScheduledFuture f = tccFuture; - sessionData.setTccTimerId(null); + this.sessionData.setTccTimerId(null); if (!willRestart) { context.sessionSupervisionTimerStopped(this, null); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java index 9ea4133d9..53876812b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/app/rx/ServerRxSessionImpl.java @@ -246,6 +246,7 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE // Action: Send AA update answer with Result-Code != SUCCESS // New State: IDLE // It's a failure, we wait for Tcc to fire -- FIXME: Alexandre: Should we? + newState = ServerRxSessionState.IDLE; } } catch (AvpDataException e) { @@ -271,6 +272,7 @@ public boolean handleEvent(StateEvent event) throws InternalException, OverloadE // Action: Send AA update answer with Result-Code != SUCCESS // New State: IDLE // It's a failure, we wait for Tcc to fire -- FIXME: Alexandre: Should we? + newState = ServerRxSessionState.IDLE; } } catch (AvpDataException e) { From d2ca2fcfc28a39d82c19895822ef35cb7166591a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Thu, 11 May 2017 23:56:25 +0100 Subject: [PATCH 64/75] Fix Charging Server example dependency --- .../charging-server-simulator/src/main/assembly/standalone.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/charging-server-simulator/src/main/assembly/standalone.xml b/examples/charging-server-simulator/src/main/assembly/standalone.xml index f39df301e..ebc7f020f 100644 --- a/examples/charging-server-simulator/src/main/assembly/standalone.xml +++ b/examples/charging-server-simulator/src/main/assembly/standalone.xml @@ -10,7 +10,7 @@ true - org.mobicents.diameter:mobicents-diameter-mux-jar + org.mobicents.diameter:restcomm-diameter-mux-jar org.mobicents.diameter:jdiameter-api org.mobicents.diameter:jdiameter-impl org.slf4j:slf4j-api From 7d5eb1c8cc747947b8c244e20aa502a92d87dca9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Fri, 12 May 2017 17:31:23 +0100 Subject: [PATCH 65/75] Route answers with unknown Origin-Realm Plus general fixes to routing. Fixes #93 --- .../client/impl/controller/PeerTableImpl.java | 4 ++-- .../impl/controller/RealmTableImpl.java | 2 +- .../client/impl/router/RouterImpl.java | 22 ++++++++++++------- .../org/jdiameter/server/impl/PeerImpl.java | 7 ++++++ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/PeerTableImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/PeerTableImpl.java index cb3b19c15..964eb5caf 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/PeerTableImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/PeerTableImpl.java @@ -211,8 +211,8 @@ public void sendMessage(IMessage message) throws IllegalDiameterStateException, else { logger.debug("Message is an answer"); peer = message.getPeer(); - if (peer == null) { - logger.debug("Peer is null so we will use router.getPeer to find a peer"); + if (peer == null || !peer.hasValidConnection()) { + logger.debug("Peer is null [{}] or with invalid connection so we will use router.getPeer to find a peer", peer == null); peer = router.getPeer(message, this); if (peer == null) { throw new RouteException( "Cannot found remote context for sending message" ); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java index dbd2d7aa1..3fd8ef17a 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java @@ -200,7 +200,7 @@ public Collection getRealms(String realmName) { Collection present = set.values(); return new ArrayList(present); } - return null; + return new ArrayList(0); } /* diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java index c0fe2bc05..7d72d50f4 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/router/RouterImpl.java @@ -256,6 +256,9 @@ public void registerRequestRouteInfo(IRequest request) { // requestEntryTableLock.writeLock().lock(); long hopByHopId = request.getHopByHopIdentifier(); Avp hostAvp = request.getAvps().getAvp(Avp.ORIGIN_HOST); + // we store the peer FQDN instead of Origin-Host as we want to route back to it, in case of proxied requests this + // should be the FQDN of the proxy, otherwise it's (should be) the same as Origin-Host + String host = ((IMessage)request).getPeer() != null ? ((IMessage)request).getPeer().getUri().getFQDN() : hostAvp.getDiameterIdentity(); Avp realmAvp = request.getAvps().getAvp(Avp.ORIGIN_REALM); AnswerEntry entry; @@ -269,12 +272,10 @@ public void registerRequestRouteInfo(IRequest request) { logger.trace("Route-Record in Request with HbH [{}]: [{}]", request.getHopByHopIdentifier(), rrAvpHost); rrStrings.add(rrAvpHost); } - entry = new AnswerEntry(hopByHopId, hostAvp != null ? hostAvp.getDiameterIdentity() : null, - realmAvp != null ? realmAvp.getDiameterIdentity() : null, rrStrings); + entry = new AnswerEntry(hopByHopId, host, realmAvp != null ? realmAvp.getDiameterIdentity() : null, rrStrings); } else { - entry = new AnswerEntry(hopByHopId, hostAvp != null ? hostAvp.getDiameterIdentity() : null, - realmAvp != null ? realmAvp.getDiameterIdentity() : null); + entry = new AnswerEntry(hopByHopId, host, realmAvp != null ? realmAvp.getDiameterIdentity() : null); } int s = requestEntryMap.size(); @@ -310,7 +311,7 @@ public void registerRequestRouteInfo(IRequest request) { } String messageKey = makeRoutingKey(request); - logger.debug("Adding request key [{}] to RequestRoute map for routing answers back to the requesting peer", messageKey); + logger.debug("Adding request key [{}] to RequestRoute map with entry [{}] for routing answers back to the requesting peer", messageKey, entry); requestEntryMap.put(messageKey, entry); // requestSortedEntryTable.add(hopByHopId); } @@ -451,9 +452,14 @@ public IPeer getPeer(IMessage message, IPeerTable manager) throws RouteException // } // Check realm name - //TODO: check only if it exists? if (matchedRealm == null) { - throw new RouteException("Unknown realm name [" + destRealm + "]"); + if (message.getAvps().getAvp(Avp.ROUTE_RECORD) == null) { + // if it doesn't come through a proxy, we fail with unknown realm... + throw new RouteException("Unknown realm name [" + destRealm + "]"); + } + else { + logger.debug("Realm [{}] not found, but message has Route-Record AVP so it came from proxy peer [{}]. Proceeding...", destRealm, destHost); + } } // THIS IS GET PEER, NOT ROUTE!!!!!!! @@ -1012,7 +1018,7 @@ public boolean equals(Object o) { @Override public String toString() { - return "AnswerEntry {" + "createTime=" + createTime + ", hopByHopId=" + hopByHopId + '}'; + return "AnswerEntry {" + "createTime=" + createTime + ", hopByHopId=" + hopByHopId + ", host=" + host + ", realm=" + realm+ "}"; } } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java index 08131bf3d..6fc97061a 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/PeerImpl.java @@ -343,6 +343,9 @@ public boolean receiveMessage(IMessage message) { logger.debug("Receiving message in server."); boolean isProcessed = false; + // we set the peer in the message so we can later reply directly + message.setPeer(PeerImpl.this); + if (message.isRequest()) { IRequest req = message; Avp destRealmAvp = req.getAvps().getAvp(Avp.DESTINATION_REALM); @@ -410,6 +413,8 @@ public boolean receiveMessage(IMessage message) { return true; } + message.setPeer(PeerImpl.this); + switch (action) { case LOCAL: // always call listener - this covers realms // configured as localy processed and @@ -613,6 +618,8 @@ private boolean consumeMessage(IMessage message) { } isProcessed = true; if (isProcessed && answer != null) { + // we use the peer from the request to reply directly + answer.setPeer(message.getPeer()); sendMessage(answer); } if (statistic.isEnabled()) { From 04569eeaf15c3c98b9f065849dcc737e32beff62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Fri, 12 May 2017 17:41:14 +0100 Subject: [PATCH 66/75] Update Location-Estimate AVP as OctetString Fixes #62 --- core/mux/common/config/dictionary.xml | 2 +- .../charging-server-simulator/src/main/resources/dictionary.xml | 2 +- .../guide1/src/main/resources/org/example/client/dictionary.xml | 2 +- .../guide1/src/main/resources/org/example/server/dictionary.xml | 2 +- testsuite/load/core/src/main/resources/dictionary.xml | 2 +- testsuite/test-framework/src/test/resources/dictionary.xml | 2 +- testsuite/tests/src/test/resources/dictionary.xml | 2 +- testsuite/tests/src/test/resources/validator.xml | 2 +- testsuite/tests/src/test/resources/validatorOff.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/mux/common/config/dictionary.xml b/core/mux/common/config/dictionary.xml index 26c3d6438..6f7c02bc2 100644 --- a/core/mux/common/config/dictionary.xml +++ b/core/mux/common/config/dictionary.xml @@ -2980,7 +2980,7 @@ - + diff --git a/examples/charging-server-simulator/src/main/resources/dictionary.xml b/examples/charging-server-simulator/src/main/resources/dictionary.xml index 26c3d6438..6f7c02bc2 100644 --- a/examples/charging-server-simulator/src/main/resources/dictionary.xml +++ b/examples/charging-server-simulator/src/main/resources/dictionary.xml @@ -2980,7 +2980,7 @@ - + diff --git a/examples/guide1/src/main/resources/org/example/client/dictionary.xml b/examples/guide1/src/main/resources/org/example/client/dictionary.xml index 26c3d6438..6f7c02bc2 100644 --- a/examples/guide1/src/main/resources/org/example/client/dictionary.xml +++ b/examples/guide1/src/main/resources/org/example/client/dictionary.xml @@ -2980,7 +2980,7 @@ - + diff --git a/examples/guide1/src/main/resources/org/example/server/dictionary.xml b/examples/guide1/src/main/resources/org/example/server/dictionary.xml index 26c3d6438..6f7c02bc2 100644 --- a/examples/guide1/src/main/resources/org/example/server/dictionary.xml +++ b/examples/guide1/src/main/resources/org/example/server/dictionary.xml @@ -2980,7 +2980,7 @@ - + diff --git a/testsuite/load/core/src/main/resources/dictionary.xml b/testsuite/load/core/src/main/resources/dictionary.xml index 26c3d6438..6f7c02bc2 100644 --- a/testsuite/load/core/src/main/resources/dictionary.xml +++ b/testsuite/load/core/src/main/resources/dictionary.xml @@ -2980,7 +2980,7 @@ - + diff --git a/testsuite/test-framework/src/test/resources/dictionary.xml b/testsuite/test-framework/src/test/resources/dictionary.xml index 26c3d6438..6f7c02bc2 100644 --- a/testsuite/test-framework/src/test/resources/dictionary.xml +++ b/testsuite/test-framework/src/test/resources/dictionary.xml @@ -2980,7 +2980,7 @@ - + diff --git a/testsuite/tests/src/test/resources/dictionary.xml b/testsuite/tests/src/test/resources/dictionary.xml index 26c3d6438..6f7c02bc2 100644 --- a/testsuite/tests/src/test/resources/dictionary.xml +++ b/testsuite/tests/src/test/resources/dictionary.xml @@ -2980,7 +2980,7 @@ - + diff --git a/testsuite/tests/src/test/resources/validator.xml b/testsuite/tests/src/test/resources/validator.xml index 1cf21c6b6..33f1ad3c6 100644 --- a/testsuite/tests/src/test/resources/validator.xml +++ b/testsuite/tests/src/test/resources/validator.xml @@ -2835,7 +2835,7 @@ Note: The AVP codes from 1119 to 1199 are reserved for TS 29.140 - + diff --git a/testsuite/tests/src/test/resources/validatorOff.xml b/testsuite/tests/src/test/resources/validatorOff.xml index 5178d7471..1dffc0f4c 100644 --- a/testsuite/tests/src/test/resources/validatorOff.xml +++ b/testsuite/tests/src/test/resources/validatorOff.xml @@ -2835,7 +2835,7 @@ Note: The AVP codes from 1119 to 1199 are reserved for TS 29.140 - + From 9b954edf48269c1e2aaa4f581013fd76050dd869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Fri, 12 May 2017 17:55:16 +0100 Subject: [PATCH 67/75] Improve Charging Server Simulator to use Avp/ResultCode --- .../charging/ChargingServerSimulator.java | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java index aaa30633f..19826ecb3 100644 --- a/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java +++ b/examples/charging-server-simulator/src/main/java/org/mobicents/servers/diameter/charging/ChargingServerSimulator.java @@ -19,6 +19,7 @@ import org.jdiameter.api.NetworkReqListener; import org.jdiameter.api.Peer; import org.jdiameter.api.Request; +import org.jdiameter.api.ResultCode; import org.jdiameter.api.app.AppAnswerEvent; import org.jdiameter.api.app.AppRequestEvent; import org.jdiameter.api.app.AppSession; @@ -197,9 +198,9 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque } JCreditControlAnswer cca = null; try { - long requestedUnits = ccrAvps.getAvp(437).getGrouped().getAvp(420).getInteger32(); - String subscriptionId = ccrAvps.getAvp(443).getGrouped().getAvp(444).getUTF8String(); - String serviceContextId = ccrAvps.getAvp(461).getUTF8String(); + long requestedUnits = ccrAvps.getAvp(Avp.REQUESTED_SERVICE_UNIT).getGrouped().getAvp(Avp.CC_TIME).getInteger32(); + String subscriptionId = ccrAvps.getAvp(Avp.SUBSCRIPTION_ID).getGrouped().getAvp(Avp.SUBSCRIPTION_ID_DATA).getUTF8String(); + String serviceContextId = ccrAvps.getAvp(Avp.SERVICE_CONTEXT_ID).getUTF8String(); if (logger.isInfoEnabled()) { logger.info(">> '" + subscriptionId + "' requested " + requestedUnits + " units for '" + serviceContextId + "'."); @@ -219,12 +220,12 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque } else { // Check if not first request, should have Used-Service-Unit AVP - if (ccrAvps.getAvp(415) != null && ccrAvps.getAvp(415).getUnsigned32() >= 1) { - Avp usedServiceUnit = ccrAvps.getAvp(446); + if (ccrAvps.getAvp(Avp.CC_REQUEST_NUMBER) != null && ccrAvps.getAvp(Avp.CC_REQUEST_NUMBER).getUnsigned32() >= 1) { + Avp usedServiceUnit = ccrAvps.getAvp(Avp.USED_SERVICE_UNIT); if (usedServiceUnit != null) { Long wereReserved = reserved.remove(subscriptionId + "_" + serviceContextId); wereReserved = wereReserved == null ? 0 : wereReserved; - long wereUsed = usedServiceUnit.getGrouped().getAvp(420).getUnsigned32(); + long wereUsed = usedServiceUnit.getGrouped().getAvp(Avp.CC_TIME).getUnsigned32(); long remaining = wereReserved - wereUsed; if (logger.isInfoEnabled()) { @@ -236,7 +237,7 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque } long grantedUnits = Math.min(requestedUnits, balance); - cca = createCCA(session, request, grantedUnits, 2001); + cca = createCCA(session, request, grantedUnits, ResultCode.SUCCESS); reserved.put(subscriptionId + "_" + serviceContextId, grantedUnits); balance -= grantedUnits; @@ -300,7 +301,7 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque // *[ Restriction-Filter-Rule ] // *[ Filter-Id ] // [ Redirect-Server ] - AvpSet finalUnitIndicationAvp = cca.getMessage().getAvps().addGroupedAvp(430); + AvpSet finalUnitIndicationAvp = cca.getMessage().getAvps().addGroupedAvp(Avp.FINAL_UNIT_INDICATION); // 8.35. Final-Unit-Action AVP // @@ -328,7 +329,7 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque // according to the IP packet filters identified by the Filter-Id // AVP. All the packets not matching the filters MUST be dropped // (see section 5.6.3). - finalUnitIndicationAvp.addAvp(449, 0); + finalUnitIndicationAvp.addAvp(Avp.FINAL_UNIT_ACTION, 0); } } } @@ -342,7 +343,7 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque } } - //cca.getMessage().getAvps().addAvp(461, serviceContextId, false); + //cca.getMessage().getAvps().addAvp(Avp.SERVICE_CONTEXT_ID, serviceContextId, false); session.sendCreditControlAnswer(cca); } catch (Exception e) { @@ -355,8 +356,8 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque logger.info("<< Received Credit-Control-Request [TERMINATION]"); } try { - String subscriptionId = ccrAvps.getAvp(443).getGrouped().getAvp(444).getUTF8String(); - String serviceContextId = ccrAvps.getAvp(461).getUTF8String(); + String subscriptionId = ccrAvps.getAvp(Avp.SUBSCRIPTION_ID).getGrouped().getAvp(Avp.SUBSCRIPTION_ID_DATA).getUTF8String(); + String serviceContextId = ccrAvps.getAvp(Avp.SERVICE_CONTEXT_ID).getUTF8String(); if (logger.isInfoEnabled()) { logger.info(">> '" + subscriptionId + "' requested service termination for '" + serviceContextId + "'."); @@ -364,11 +365,11 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque Long balance = accounts.get(subscriptionId); - if (ccrAvps.getAvp(415) != null && ccrAvps.getAvp(415).getUnsigned32() >= 1) { - Avp usedServiceUnit = ccrAvps.getAvp(446); + if (ccrAvps.getAvp(Avp.CC_REQUEST_NUMBER) != null && ccrAvps.getAvp(Avp.CC_REQUEST_NUMBER).getUnsigned32() >= 1) { + Avp usedServiceUnit = ccrAvps.getAvp(Avp.USED_SERVICE_UNIT); if (usedServiceUnit != null) { long wereReserved = reserved.remove(subscriptionId + "_" + serviceContextId); - long wereUsed = usedServiceUnit.getGrouped().getAvp(420).getUnsigned32(); + long wereUsed = usedServiceUnit.getGrouped().getAvp(Avp.CC_TIME).getUnsigned32(); long remaining = wereReserved - wereUsed; if (logger.isInfoEnabled()) { @@ -384,7 +385,7 @@ public void doCreditControlRequest(ServerCCASession session, JCreditControlReque } accounts.put(subscriptionId, balance); - cca = createCCA(session, request, -1, 2001); + cca = createCCA(session, request, -1, ResultCode.SUCCESS); // 8.7. Cost-Information AVP // // The Cost-Information AVP (AVP Code 423) is of type Grouped, and it is @@ -489,11 +490,11 @@ private JCreditControlAnswer createCCA(ServerCCASession session, JCreditControlR // { CC-Request-Type } // Using the same as the one present in request - ccaAvps.addAvp(ccrAvps.getAvp(416)); + ccaAvps.addAvp(ccrAvps.getAvp(Avp.CC_REQUEST_TYPE)); // { CC-Request-Number } // Using the same as the one present in request - ccaAvps.addAvp(ccrAvps.getAvp(415)); + ccaAvps.addAvp(ccrAvps.getAvp(Avp.CC_REQUEST_NUMBER)); // [ User-Name ] // [ CC-Session-Failover ] @@ -528,10 +529,10 @@ private JCreditControlAnswer createCCA(ServerCCASession session, JCreditControlR // [ CC-Service-Specific-Units ] // *[ AVP ] if (grantedUnits >= 0) { - AvpSet gsuAvp = ccaAvps.addGroupedAvp(431); + AvpSet gsuAvp = ccaAvps.addGroupedAvp(Avp.GRANTED_SERVICE_UNIT); // Fetch AVP/Value from Request - // gsuAvp.addAvp(ccrAvps.getAvp(437).getGrouped().getAvp(420)); - gsuAvp.addAvp(420, grantedUnits, true); + // gsuAvp.addAvp(ccrAvps.getAvp(Avp.REQUESTED_SERVICE_UNIT).getGrouped().getAvp(Avp.CC_TIME)); + gsuAvp.addAvp(Avp.CC_TIME, grantedUnits, true); } // *[ Multiple-Services-Credit-Control ] From 7349fc344781b0b94b76cec4b2438e0ac3f0f1a1 Mon Sep 17 00:00:00 2001 From: QPhuong Date: Sun, 30 Oct 2016 14:17:18 +0700 Subject: [PATCH 68/75] #45 fixed --- .../client/api/controller/IRealmTable.java | 4 ++- .../impl/controller/RealmTableImpl.java | 5 +++ .../jdiameter/server/impl/NetworkImpl.java | 10 ++++++ .../client/impl/router/TestRouter.java | 4 +++ .../stack/DiameterStackMultiplexer.java | 34 +++++++++++++------ .../stack/DiameterStackMultiplexerMBean.java | 4 ++- 6 files changed, 49 insertions(+), 12 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java index 05c3553ee..4a27e5c84 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java @@ -43,6 +43,7 @@ package org.jdiameter.client.api.controller; import java.util.Collection; +import java.util.List; import org.jdiameter.api.ApplicationId; import org.jdiameter.api.InternalException; @@ -95,5 +96,6 @@ public interface IRealmTable extends RealmTable { */ Realm addRealm(String name, ApplicationId appId, LocalAction locAction, IAgentConfiguration agentConfImpl, boolean isDynamic, long expirationTime, String[] hosts) throws InternalException; - + + List getAllRealmSet(); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java index 3fd8ef17a..c6248132b 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java @@ -442,5 +442,10 @@ public boolean isWrapperFor(Class iface) throws InternalException { public T unwrap(Class iface) throws InternalException { return null; } + + @Override + public List getAllRealmSet(){ + return allRealmsSet; +} } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java index 7afb91f98..91ba00432 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java @@ -43,6 +43,7 @@ package org.jdiameter.server.impl; import java.util.Collection; +import java.util.List; import java.util.concurrent.ConcurrentHashMap; import org.jdiameter.api.ApplicationAlreadyUseException; @@ -57,6 +58,7 @@ import org.jdiameter.api.Statistic; import org.jdiameter.api.URI; import org.jdiameter.client.api.IMessage; +import org.jdiameter.client.api.controller.IRealmTable; import org.jdiameter.common.api.statistic.IStatistic; import org.jdiameter.common.api.statistic.IStatisticManager; import org.jdiameter.common.api.statistic.IStatisticRecord; @@ -270,4 +272,12 @@ public void setPeerManager(IMutablePeerTable manager) { this.manager = manager; } + public List getListPeers() { + return manager.getPeerTable(); + } + + public IRealmTable getRealmTable(){ + return this.router.getRealmTable(); + } + } \ No newline at end of file diff --git a/core/jdiameter/impl/src/test/java/org/jdiameter/client/impl/router/TestRouter.java b/core/jdiameter/impl/src/test/java/org/jdiameter/client/impl/router/TestRouter.java index e65717fbe..15be520ac 100644 --- a/core/jdiameter/impl/src/test/java/org/jdiameter/client/impl/router/TestRouter.java +++ b/core/jdiameter/impl/src/test/java/org/jdiameter/client/impl/router/TestRouter.java @@ -312,6 +312,10 @@ public boolean isWrapperFor(Class iface) throws InternalException { public T unwrap(Class iface) throws InternalException { return null; } + + public List getAllRealmSet(){ + return null; + } } private static class PeerTest extends AbstractPeer implements IPeer { diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java index d033edf2e..489f5a322 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java @@ -72,6 +72,7 @@ import java.net.InetAddress; import java.net.URI; import java.net.URISyntaxException; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.HashMap; @@ -99,6 +100,7 @@ import org.jdiameter.api.MutablePeerTable; import org.jdiameter.api.Network; import org.jdiameter.api.NetworkReqListener; +import org.jdiameter.api.Peer; import org.jdiameter.api.PeerTable; import org.jdiameter.api.Request; import org.jdiameter.api.ResultCode; @@ -603,12 +605,13 @@ public void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException { if (IP_PATTERN.matcher(ipAddress).matches()) { Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); - List newIPAddressesConfig = Arrays.asList(oldIPAddressesConfig); + List newIPAddressesConfig = new ArrayList (Arrays.asList(oldIPAddressesConfig)); + AppConfiguration newIPAddress = getClientConfiguration().add(OwnIPAddress, ipAddress); newIPAddressesConfig.add(newIPAddress); - getMutableConfiguration().setChildren(OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray()); - + getMutableConfiguration().setChildren( OwnIPAddresses.ordinal(), + (Configuration[]) newIPAddressesConfig.toArray(new Configuration[newIPAddressesConfig.size()])); if (logger.isInfoEnabled()) { logger.info("Local Peer IP Address successfully changed to " + ipAddress + ". Restart to Diameter stack is needed to apply changes."); } @@ -618,6 +621,16 @@ public void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException { } } + @Override + public List _Network_Peers_retrievePeer() throws MBeanException { + try { + NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); + return n.getListPeers(); + } + catch (InternalException e) { + throw new MBeanException(e, "Failed to retrieve peer"); + } + } /* * (non-Javadoc) * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_LocalPeer_removeIPAddress(java.lang.String) @@ -939,14 +952,15 @@ public Set _LocalPeer_getCommonApplicationIds() throws MBeanExcep @Override public String[] _Network_Realms_getRealms() throws MBeanException { - Configuration[] realmEntries = getMutableConfiguration().getChildren(RealmTable.ordinal())[0].getChildren(RealmEntry.ordinal()); - String[] realmNames = new String[realmEntries.length]; - - for (int i = 0; i < realmEntries.length; i++) { - realmNames[i] = realmEntries[i].getStringValue(RealmName.ordinal(), DEFAULT_STRING); + try{ + org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); + List list = n.getRealmTable().getAllRealmSet(); + String [] stringArray = list.toArray(new String[list.size()]); + return stringArray; + } + catch (Exception e) { + throw new MBeanException(e); } - - return realmNames; } @Override diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java index 8599ac34f..741a41fa0 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java @@ -43,12 +43,14 @@ package org.mobicents.diameter.stack; import java.net.InetAddress; +import java.util.List; import java.util.Set; import javax.management.MBeanException; import org.jboss.system.ServiceMBean; import org.jdiameter.api.ApplicationId; +import org.jdiameter.api.Peer; import org.jdiameter.api.Stack; import org.mobicents.diameter.api.DiameterMessageFactory; import org.mobicents.diameter.api.DiameterProvider; @@ -336,5 +338,5 @@ void _Network_Realms_addRealm(String name, String peers, long appVendorId, long boolean _LocalPeer_isActive() throws MBeanException; boolean _Network_Peers_isPeerConnected(String name) throws MBeanException; - + List _Network_Peers_retrievePeer() throws MBeanException; } From 8b9470fde0e65203adea0724b0f874d10cdfa96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Fri, 12 May 2017 18:50:34 +0100 Subject: [PATCH 69/75] Fix checkstyle issues from PR #68 --- .../jdiameter/client/api/controller/IRealmTable.java | 2 +- .../client/impl/controller/RealmTableImpl.java | 6 +++--- .../java/org/jdiameter/server/impl/NetworkImpl.java | 6 +++--- .../diameter/stack/DiameterStackMultiplexer.java | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java index 4a27e5c84..0c2824e26 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/api/controller/IRealmTable.java @@ -96,6 +96,6 @@ public interface IRealmTable extends RealmTable { */ Realm addRealm(String name, ApplicationId appId, LocalAction locAction, IAgentConfiguration agentConfImpl, boolean isDynamic, long expirationTime, String[] hosts) throws InternalException; - + List getAllRealmSet(); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java index c6248132b..2b50893d6 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/controller/RealmTableImpl.java @@ -442,10 +442,10 @@ public boolean isWrapperFor(Class iface) throws InternalException { public T unwrap(Class iface) throws InternalException { return null; } - + @Override - public List getAllRealmSet(){ + public List getAllRealmSet() { return allRealmsSet; -} + } } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java index 91ba00432..7f07eb36d 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/server/impl/NetworkImpl.java @@ -272,11 +272,11 @@ public void setPeerManager(IMutablePeerTable manager) { this.manager = manager; } - public List getListPeers() { + public List getListPeers() { return manager.getPeerTable(); } - - public IRealmTable getRealmTable(){ + + public IRealmTable getRealmTable() { return this.router.getRealmTable(); } diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java index 489f5a322..5abd086c8 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java @@ -606,11 +606,11 @@ public void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException { Configuration[] oldIPAddressesConfig = getMutableConfiguration().getChildren(OwnIPAddresses.ordinal()); List newIPAddressesConfig = new ArrayList (Arrays.asList(oldIPAddressesConfig)); - + AppConfiguration newIPAddress = getClientConfiguration().add(OwnIPAddress, ipAddress); newIPAddressesConfig.add(newIPAddress); - getMutableConfiguration().setChildren( OwnIPAddresses.ordinal(), + getMutableConfiguration().setChildren( OwnIPAddresses.ordinal(), (Configuration[]) newIPAddressesConfig.toArray(new Configuration[newIPAddressesConfig.size()])); if (logger.isInfoEnabled()) { logger.info("Local Peer IP Address successfully changed to " + ipAddress + ". Restart to Diameter stack is needed to apply changes."); @@ -624,7 +624,7 @@ public void _LocalPeer_addIPAddress(String ipAddress) throws MBeanException { @Override public List _Network_Peers_retrievePeer() throws MBeanException { try { - NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); + NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); return n.getListPeers(); } catch (InternalException e) { @@ -953,9 +953,9 @@ public Set _LocalPeer_getCommonApplicationIds() throws MBeanExcep @Override public String[] _Network_Realms_getRealms() throws MBeanException { try{ - org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); + org.jdiameter.server.impl.NetworkImpl n = (org.jdiameter.server.impl.NetworkImpl) stack.unwrap(org.jdiameter.api.Network.class); List list = n.getRealmTable().getAllRealmSet(); - String [] stringArray = list.toArray(new String[list.size()]); + String [] stringArray = list.toArray(new String[list.size()]); return stringArray; } catch (Exception e) { From 27c07e52b2bbc33930a19de1b3f0f9e524cfe149 Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Sat, 13 May 2017 16:51:36 +0300 Subject: [PATCH 70/75] Fix release script. --- .../src/main/resources/META-INF/module.xml | 2 +- release/build.xml | 11 +++++++---- release/release-build-wildfly.xml | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml b/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml index c3a05c062..811e29a34 100644 --- a/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml +++ b/core/mux/sar-wildfly/src/main/resources/META-INF/module.xml @@ -34,7 +34,7 @@ - + diff --git a/release/build.xml b/release/build.xml index 94918c25d..bd9206783 100644 --- a/release/build.xml +++ b/release/build.xml @@ -91,7 +91,7 @@ - + @@ -115,14 +115,14 @@ Checkout Diameter Core (jDiameter @tag:${CORE_JDIAMETER_TAG}) - + Checkout Diameter SLEE Diameter Package v${SLEE_DIAMETER_PACKAGE_VERSION} - + @@ -141,7 +141,7 @@ Checkout Diameter RHQ Plugin - + @@ -509,6 +509,9 @@ + + diff --git a/release/release-build-wildfly.xml b/release/release-build-wildfly.xml index 6c52784dd..836d3b9a7 100644 --- a/release/release-build-wildfly.xml +++ b/release/release-build-wildfly.xml @@ -1,6 +1,11 @@ + + + + + From 75cd0401bafa53065f3f4b71232a7dceed8a3b0b Mon Sep 17 00:00:00 2001 From: SergeyLee Date: Sat, 13 May 2017 17:18:08 +0300 Subject: [PATCH 71/75] Fix dependencies for TestSuite/JBoss 5.1. --- core/jdiameter-ha/api/pom.xml | 7 ------- core/jdiameter-ha/impl/pom.xml | 8 ++++++++ pom.xml | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/jdiameter-ha/api/pom.xml b/core/jdiameter-ha/api/pom.xml index 0d55391c8..9bd4e4002 100644 --- a/core/jdiameter-ha/api/pom.xml +++ b/core/jdiameter-ha/api/pom.xml @@ -32,11 +32,6 @@ org.jboss.cluster jboss-ha-server-cache-jbc - - - org.mobicents.cluster - timers - --> @@ -53,12 +48,10 @@ --> - diff --git a/core/jdiameter-ha/impl/pom.xml b/core/jdiameter-ha/impl/pom.xml index 90bd987ee..68d5239a6 100644 --- a/core/jdiameter-ha/impl/pom.xml +++ b/core/jdiameter-ha/impl/pom.xml @@ -26,11 +26,19 @@ + + + org.jboss.cluster + jboss-ha-server-cache-jbc + + + org.restcomm.cluster diff --git a/pom.xml b/pom.xml index 419977b66..849553a91 100644 --- a/pom.xml +++ b/pom.xml @@ -298,19 +298,19 @@ org.restcomm.cluster core ${cluster.version} - provided + org.restcomm.cluster cache ${cluster.version} - provided + org.restcomm.cluster timers ${cluster.version} - provided + From dd978b29478efaf4c8f507f1e87f9e7a1017f52e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Mon, 15 May 2017 16:45:22 +0100 Subject: [PATCH 72/75] Set `jboss5` as default profile --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 849553a91..5408bf17d 100644 --- a/pom.xml +++ b/pom.xml @@ -238,7 +238,7 @@ jboss5 - false + true 1.15.29 From 16c11af07260e30dc73d81782781f9de42a18871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Tue, 16 May 2017 13:11:35 +0100 Subject: [PATCH 73/75] Add lock to Session set and release container methods Closes #1 and closes #2. --- .../jdiameter/client/impl/SessionImpl.java | 48 ++++++++++++++----- 1 file changed, 37 insertions(+), 11 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java index 8dbead2c0..351164317 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/SessionImpl.java @@ -42,6 +42,7 @@ package org.jdiameter.client.impl; +import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; import org.jdiameter.api.Answer; @@ -63,6 +64,8 @@ import org.jdiameter.client.api.parser.IMessageParser; import org.jdiameter.common.api.data.ISessionDatasource; import org.jdiameter.common.api.timer.ITimerFacility; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * Implementation for {@link ISession} @@ -73,6 +76,10 @@ */ public class SessionImpl extends BaseSessionImpl implements ISession { + private static final Logger logger = LoggerFactory.getLogger(SessionImpl.class); + + private Semaphore lock = new Semaphore(1); // container lock + SessionImpl(IContainer container) { setContainer(container); try { @@ -84,8 +91,17 @@ public class SessionImpl extends BaseSessionImpl implements ISession { } void setContainer(IContainer container) { - this.container = container; - this.parser = container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + try { + lock.acquire(); // allow container change only if not releasing + this.container = container; + this.parser = (IMessageParser) container.getAssemblerFacility().getComponentInstance(IMessageParser.class); + } + catch (InterruptedException e) { + logger.error("failure getting lock", e); + } + finally { + lock.release(); + } } @Override @@ -174,17 +190,27 @@ public Request createRequest(Request prevRequest) { @Override public void release() { isValid = false; - if (container != null) { - if (istTimerId != null) { - container.getAssemblerFacility().getComponentInstance(ITimerFacility.class).cancel(istTimerId); + try { + lock.acquire(); // prevent container NullPointerException + + if (container != null) { + if (istTimerId != null) { + container.getAssemblerFacility().getComponentInstance(ITimerFacility.class).cancel(istTimerId); + } + container.removeSessionListener(sessionId); + container.getAssemblerFacility().getComponentInstance(ISessionDatasource.class).removeSession(sessionId); } - container.removeSessionListener(sessionId); - // FIXME - container.getAssemblerFacility().getComponentInstance(ISessionDatasource.class).removeSession(sessionId); + + container = null; + parser = null; + reqListener = null; + } + catch (InterruptedException e) { + logger.error("failure getting lock", e); + } + finally { + lock.release(); } - container = null; - parser = null; - reqListener = null; } @Override From 7daf1b946dd3b829954bc977c53ea7180e12e334 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Tue, 16 May 2017 14:26:09 +0100 Subject: [PATCH 74/75] Add realm name parameter to _Network_Peers_addPeer Fixes #1, closes #2 --- .../mobicents/diameter/stack/DiameterStackMultiplexer.java | 6 +++--- .../diameter/stack/DiameterStackMultiplexerAS7.java | 6 +++--- .../diameter/stack/DiameterStackMultiplexerAS7MBean.java | 3 ++- .../diameter/stack/DiameterStackMultiplexerMBean.java | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java index 5abd086c8..cdcae4f99 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexer.java @@ -719,13 +719,13 @@ public void _LocalPeer_setVendorId(long vendorId) throws MBeanException { /* * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int, String) */ @Override - public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) throws MBeanException { + public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating, String realm) throws MBeanException { try { NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); - /*Peer p =*/ n.addPeer(name, "", attemptConnect); // FIXME: This requires realm... + /*Peer p =*/ n.addPeer(name, realm, attemptConnect); } catch (IllegalArgumentException e) { logger.warn(e.getMessage()); diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java index ae1de4975..5f576b28e 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7.java @@ -687,13 +687,13 @@ public void _LocalPeer_setVendorId(long vendorId) { /* * (non-Javadoc) - * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int) + * @see org.mobicents.diameter.stack.DiameterStackMultiplexerMBean#_Network_Peers_addPeer(java.lang.String, boolean, int, String) */ @Override - public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) { + public void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating, String realm) { try { NetworkImpl n = (NetworkImpl) stack.unwrap(Network.class); - /*Peer p =*/ n.addPeer(name, "", attemptConnect); // FIXME: This requires realm... + /*Peer p =*/ n.addPeer(name, realm, attemptConnect); } catch (IllegalArgumentException e) { logger.warn(e.getMessage()); diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java index 702e918b8..9a858c98d 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerAS7MBean.java @@ -181,8 +181,9 @@ public interface DiameterStackMultiplexerAS7MBean { * @param name the name/uri of the peer * @param attemptConnect indicates if the stack should try to connect to this peer or wait for incoming connection * @param rating the peer rating for decision on message routing + * @param realm name of the realm */ - void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating); + void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating, String realm); /** * Removes a peer definition from stack. diff --git a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java index 741a41fa0..8b708584f 100644 --- a/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java +++ b/core/mux/jar/src/main/java/org/mobicents/diameter/stack/DiameterStackMultiplexerMBean.java @@ -223,9 +223,10 @@ public interface DiameterStackMultiplexerMBean extends ServiceMBean { * @param name the name/uri of the peer * @param attemptConnect indicates if the stack should try to connect to this peer or wait for incoming connection * @param rating the peer rating for decision on message routing + * @param realm name of the realm * @throws MBeanException if the operation is unable to perform correctly */ - void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating) throws MBeanException; + void _Network_Peers_addPeer(String name, boolean attemptConnect, int rating, String realm) throws MBeanException; /** * Removes a peer definition from stack. From a6d0eacc933c4d7aeae92fec2b07eef0f0f0296f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexandre=20Mendon=C3=A7a?= Date: Tue, 16 May 2017 14:40:17 +0100 Subject: [PATCH 75/75] Add trace log to HEX dump in/out Diameter messages Also add length to Avp `toString` method. Fixes #1, closes #2 --- .../jdiameter/client/impl/parser/AvpImpl.java | 4 +-- .../client/impl/parser/MessageParser.java | 34 +++++++++++++++++++ .../transport/tcp/TCPClientConnection.java | 9 ++++- .../transport/tcp/TCPTransportClient.java | 10 +++++- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpImpl.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpImpl.java index 7898930b0..4ed2aa6a3 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpImpl.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/AvpImpl.java @@ -295,8 +295,8 @@ public byte[] getRawData() { @Override public String toString() { if (toString == null) { - this.toString = new StringBuffer("AvpImpl [avpCode=").append(avpCode).append(", vendorID=").append(vendorID).append("]@").append(super.hashCode()). - toString(); + this.toString = new StringBuffer("AvpImpl [avpCode=").append(avpCode).append(", vendorID=").append(vendorID). + append(", len=").append((rawData != null) ? rawData.length : null).append("]@").append(super.hashCode()).toString(); } return this.toString; diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/MessageParser.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/MessageParser.java index b46f59041..e658247d9 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/MessageParser.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/parser/MessageParser.java @@ -250,6 +250,40 @@ void copyBasicAvps(IMessage newMessage, IMessage prnMessage, boolean invertPoint } } + public static String byteArrayToHexString(byte[] in, boolean columnize) { + if (in == null || in.length <= 0) { + return ""; + } + String pseudo = "0123456789ABCDEF"; + + StringBuffer out = new StringBuffer(in.length * 3); + + for (int i = 0; i < in.length; i++) { + byte ch = in[i]; + out.append(pseudo.charAt((int) ((ch & 0xF0) >> 4))); + out.append(pseudo.charAt((int) (ch & 0x0F))); + + if (columnize) { + if ((i + 1) % 16 == 0) { + out.append("\n"); + } + else if ((i + 1) % 4 == 0) { + out.append(" "); + } + } + } + + return out.toString(); + } + + public static String byteArrayToHexStringLine(byte[] in) { + return byteArrayToHexString(in, false); + } + + public static String byteArrayToHexString(byte[] in) { + return byteArrayToHexString(in, true); + } + @Override public ByteBuffer encodeMessage(IMessage message) throws ParseException { ByteArrayOutputStream out = new ByteArrayOutputStream(); diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPClientConnection.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPClientConnection.java index 10521c373..e9e3243b3 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPClientConnection.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPClientConnection.java @@ -63,6 +63,7 @@ import org.jdiameter.client.api.io.TransportError; import org.jdiameter.client.api.io.TransportException; import org.jdiameter.client.api.parser.IMessageParser; +import org.jdiameter.client.impl.parser.MessageParser; import org.jdiameter.common.api.concurrent.IConcurrentFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -298,7 +299,13 @@ protected void onDisconnect() throws AvpDataException { protected void onMessageReceived(ByteBuffer message) throws AvpDataException { if (logger.isDebugEnabled()) { - logger.debug("Received message of size [{}]", message.array().length); + if (logger.isTraceEnabled()) { + String hex = MessageParser.byteArrayToHexString(message.array()); + logger.trace("Received message of size [{}]\n{}", new Object[] { message.array().length, hex }); + } + else { + logger.debug("Received message of size [{}]", message.array().length); + } } onEvent(new Event(EventType.MESSAGE_RECEIVED, message)); } diff --git a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java index cf864cccb..6fc1aa398 100644 --- a/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java +++ b/core/jdiameter/impl/src/main/java/org/jdiameter/client/impl/transport/tcp/TCPTransportClient.java @@ -60,6 +60,7 @@ import org.jdiameter.api.AvpDataException; import org.jdiameter.client.api.io.NotInitializedException; +import org.jdiameter.client.impl.parser.MessageParser; import org.jdiameter.common.api.concurrent.IConcurrentFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -303,7 +304,14 @@ public InetSocketAddress getOrigAddress() { public void sendMessage(ByteBuffer bytes) throws IOException { if (logger.isDebugEnabled()) { - logger.debug("About to send a byte buffer of size [{}] over the TCP nio socket [{}]", bytes.array().length, socketDescription); + if (logger.isTraceEnabled()) { + String hex = MessageParser.byteArrayToHexString(bytes.array()); + logger.trace("About to send a byte buffer of size [{}] over the TCP nio socket [{}]\n{}", + new Object[]{bytes.array().length, socketDescription, hex}); + } + else { + logger.debug("About to send a byte buffer of size [{}] over the TCP nio socket [{}]", bytes.array().length, socketDescription); + } } int rc = 0; // PCB - removed locking