/protocols/ss7/isup/isup-impl/src/main/java/org/mobicents/protocols/ss7/isup/impl/message/CircuitGroupResetMessageImpl.java

http://mobicents.googlecode.com/ · Java · 144 lines · 55 code · 27 blank · 62 comment · 2 complexity · 871cf9b1fc580dc1db219a50eb2ebd8f MD5 · raw file

  1. /*
  2. * JBoss, Home of Professional Open Source
  3. * Copyright 2011, Red Hat, Inc. and individual contributors
  4. * by the @authors tag. See the copyright.txt in the distribution for a
  5. * full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. /**
  23. * Start time:00:09:01 2009-09-07<br>
  24. * Project: mobicents-isup-stack<br>
  25. *
  26. * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski </a>
  27. */
  28. package org.mobicents.protocols.ss7.isup.impl.message;
  29. import java.util.Map;
  30. import java.util.Set;
  31. import org.mobicents.protocols.ss7.isup.ISUPParameterFactory;
  32. import org.mobicents.protocols.ss7.isup.ParameterException;
  33. import org.mobicents.protocols.ss7.isup.impl.message.parameter.AbstractISUPParameter;
  34. import org.mobicents.protocols.ss7.isup.impl.message.parameter.MessageTypeImpl;
  35. import org.mobicents.protocols.ss7.isup.message.CircuitGroupResetMessage;
  36. import org.mobicents.protocols.ss7.isup.message.parameter.MessageType;
  37. import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus;
  38. /**
  39. * Start time:00:09:01 2009-09-07<br>
  40. * Project: mobicents-isup-stack<br>
  41. *
  42. * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski </a>
  43. */
  44. public class CircuitGroupResetMessageImpl extends ISUPMessageImpl implements CircuitGroupResetMessage {
  45. public static final MessageType _MESSAGE_TYPE = new MessageTypeImpl(MESSAGE_CODE);
  46. private static final int _MANDATORY_VAR_COUNT = 1;
  47. static final int _INDEX_F_MessageType = 0;
  48. static final int _INDEX_V_RangeAndStatus = 0;
  49. CircuitGroupResetMessageImpl(Set<Integer> mandatoryCodes, Set<Integer> mandatoryVariableCodes, Set<Integer> optionalCodes, Map<Integer, Integer> mandatoryCode2Index,
  50. Map<Integer, Integer> mandatoryVariableCode2Index, Map<Integer, Integer> optionalCode2Index) {
  51. super( mandatoryCodes, mandatoryVariableCodes, optionalCodes, mandatoryCode2Index, mandatoryVariableCode2Index, optionalCode2Index);
  52. super.f_Parameters.put(_INDEX_F_MessageType, this.getMessageType());
  53. }
  54. public void setRangeAndStatus(RangeAndStatus ras)
  55. {
  56. super.v_Parameters.put(_INDEX_V_RangeAndStatus, ras);
  57. }
  58. public RangeAndStatus getRangeAndStatus()
  59. {
  60. return (RangeAndStatus) super.v_Parameters.get(_INDEX_V_RangeAndStatus);
  61. }
  62. /*
  63. * (non-Javadoc)
  64. *
  65. * @see
  66. * org.mobicents.protocols.ss7.isup.ISUPMessageImpl#decodeMandatoryVariableBody(byte
  67. * [], int)
  68. */
  69. protected void decodeMandatoryVariableBody(ISUPParameterFactory parameterFactory,byte[] parameterBody, int parameterIndex) throws ParameterException {
  70. switch (parameterIndex) {
  71. case _INDEX_V_RangeAndStatus:
  72. RangeAndStatus ras = parameterFactory.createRangeAndStatus();
  73. ((AbstractISUPParameter)ras).decode(parameterBody);
  74. this.setRangeAndStatus(ras);
  75. break;
  76. default:
  77. throw new ParameterException("Unrecognized parameter index for mandatory variable part, index: " + parameterIndex);
  78. }
  79. }
  80. /*
  81. * (non-Javadoc)
  82. *
  83. * @see org.mobicents.protocols.ss7.isup.ISUPMessageImpl#decodeOptionalBody(byte[],
  84. * byte)
  85. */
  86. protected void decodeOptionalBody(ISUPParameterFactory parameterFactory,byte[] parameterBody, byte parameterCode) throws ParameterException {
  87. throw new ParameterException("This message does not support optional parameters");
  88. }
  89. /*
  90. * (non-Javadoc)
  91. *
  92. * @see org.mobicents.protocols.ss7.isup.ISUPMessageImpl#getMessageType()
  93. */
  94. public MessageType getMessageType() {
  95. return this._MESSAGE_TYPE;
  96. }
  97. /*
  98. * (non-Javadoc)
  99. *
  100. * @seeorg.mobicents.protocols.ss7.isup.ISUPMessageImpl#
  101. * getNumberOfMandatoryVariableLengthParameters()
  102. */
  103. protected int getNumberOfMandatoryVariableLengthParameters() {
  104. return _MANDATORY_VAR_COUNT;
  105. }
  106. /*
  107. * (non-Javadoc)
  108. *
  109. * @see org.mobicents.protocols.ss7.isup.ISUPMessageImpl#hasAllMandatoryParameters()
  110. */
  111. public boolean hasAllMandatoryParameters() {
  112. return super.v_Parameters.get(_INDEX_V_RangeAndStatus) != null;
  113. }
  114. protected boolean optionalPartIsPossible() {
  115. return false;
  116. }
  117. }