PageRenderTime 39ms CodeModel.GetById 15ms app.highlight 17ms RepoModel.GetById 2ms app.codeStats 0ms

/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/**
 24 * Start time:00:09:01 2009-09-07<br>
 25 * Project: mobicents-isup-stack<br>
 26 * 
 27 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski </a>
 28 */
 29package org.mobicents.protocols.ss7.isup.impl.message;
 30
 31import java.util.Map;
 32import java.util.Set;
 33
 34import org.mobicents.protocols.ss7.isup.ISUPParameterFactory;
 35import org.mobicents.protocols.ss7.isup.ParameterException;
 36import org.mobicents.protocols.ss7.isup.impl.message.parameter.AbstractISUPParameter;
 37import org.mobicents.protocols.ss7.isup.impl.message.parameter.MessageTypeImpl;
 38import org.mobicents.protocols.ss7.isup.message.CircuitGroupResetMessage;
 39import org.mobicents.protocols.ss7.isup.message.parameter.MessageType;
 40import org.mobicents.protocols.ss7.isup.message.parameter.RangeAndStatus;
 41
 42/**
 43 * Start time:00:09:01 2009-09-07<br>
 44 * Project: mobicents-isup-stack<br>
 45 * 
 46 * @author <a href="mailto:baranowb@gmail.com">Bartosz Baranowski </a>
 47 */
 48public class CircuitGroupResetMessageImpl extends ISUPMessageImpl implements CircuitGroupResetMessage {
 49
 50	public static final MessageType _MESSAGE_TYPE = new MessageTypeImpl(MESSAGE_CODE);
 51	private static final int _MANDATORY_VAR_COUNT = 1;
 52	
 53	static final int _INDEX_F_MessageType = 0;
 54	static final int _INDEX_V_RangeAndStatus = 0;
 55
 56	CircuitGroupResetMessageImpl(Set<Integer> mandatoryCodes, Set<Integer> mandatoryVariableCodes, Set<Integer> optionalCodes, Map<Integer, Integer> mandatoryCode2Index,
 57			Map<Integer, Integer> mandatoryVariableCode2Index, Map<Integer, Integer> optionalCode2Index) {
 58		super( mandatoryCodes, mandatoryVariableCodes, optionalCodes, mandatoryCode2Index, mandatoryVariableCode2Index, optionalCode2Index);
 59
 60		super.f_Parameters.put(_INDEX_F_MessageType, this.getMessageType());
 61
 62	}
 63
 64	public void setRangeAndStatus(RangeAndStatus ras)
 65	{
 66		super.v_Parameters.put(_INDEX_V_RangeAndStatus, ras);
 67	}
 68	public RangeAndStatus getRangeAndStatus()
 69	{
 70		return (RangeAndStatus) super.v_Parameters.get(_INDEX_V_RangeAndStatus);
 71	}
 72
 73	/*
 74	 * (non-Javadoc)
 75	 * 
 76	 * @see
 77	 * org.mobicents.protocols.ss7.isup.ISUPMessageImpl#decodeMandatoryVariableBody(byte
 78	 * [], int)
 79	 */
 80	
 81	protected void decodeMandatoryVariableBody(ISUPParameterFactory parameterFactory,byte[] parameterBody, int parameterIndex) throws ParameterException {
 82		switch (parameterIndex) {
 83		case _INDEX_V_RangeAndStatus:
 84			RangeAndStatus ras = parameterFactory.createRangeAndStatus();
 85			((AbstractISUPParameter)ras).decode(parameterBody);
 86			this.setRangeAndStatus(ras);
 87			break;
 88		default:
 89			throw new ParameterException("Unrecognized parameter index for mandatory variable part, index: " + parameterIndex);
 90
 91		}
 92
 93	}
 94
 95	/*
 96	 * (non-Javadoc)
 97	 * 
 98	 * @see org.mobicents.protocols.ss7.isup.ISUPMessageImpl#decodeOptionalBody(byte[],
 99	 * byte)
100	 */
101	
102	protected void decodeOptionalBody(ISUPParameterFactory parameterFactory,byte[] parameterBody, byte parameterCode) throws ParameterException {
103		throw new ParameterException("This message does not support optional parameters");
104
105	}
106
107	/*
108	 * (non-Javadoc)
109	 * 
110	 * @see org.mobicents.protocols.ss7.isup.ISUPMessageImpl#getMessageType()
111	 */
112	
113	public MessageType getMessageType() {
114		return this._MESSAGE_TYPE;
115	}
116
117	/*
118	 * (non-Javadoc)
119	 * 
120	 * @seeorg.mobicents.protocols.ss7.isup.ISUPMessageImpl#
121	 * getNumberOfMandatoryVariableLengthParameters()
122	 */
123	
124	protected int getNumberOfMandatoryVariableLengthParameters() {
125
126		return _MANDATORY_VAR_COUNT;
127	}
128
129	/*
130	 * (non-Javadoc)
131	 * 
132	 * @see org.mobicents.protocols.ss7.isup.ISUPMessageImpl#hasAllMandatoryParameters()
133	 */
134	
135	public boolean hasAllMandatoryParameters() {
136		return super.v_Parameters.get(_INDEX_V_RangeAndStatus) != null;
137	}
138
139	
140	protected boolean optionalPartIsPossible() {
141
142		return false;
143	}
144}