PageRenderTime 28ms CodeModel.GetById 10ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

/protocols/ss7/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/parameter/ParameterFactoryImpl.java

http://mobicents.googlecode.com/
Java | 249 lines | 194 code | 30 blank | 25 comment | 1 complexity | 67a6f79dd4c46d3f2a67c3f6df69c2e5 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
 23package org.mobicents.protocols.ss7.m3ua.impl.parameter;
 24
 25import org.mobicents.protocols.ss7.m3ua.parameter.ASPIdentifier;
 26import org.mobicents.protocols.ss7.m3ua.parameter.AffectedPointCode;
 27import org.mobicents.protocols.ss7.m3ua.parameter.ConcernedDPC;
 28import org.mobicents.protocols.ss7.m3ua.parameter.CongestedIndication;
 29import org.mobicents.protocols.ss7.m3ua.parameter.CongestedIndication.CongestionLevel;
 30import org.mobicents.protocols.ss7.m3ua.parameter.CorrelationId;
 31import org.mobicents.protocols.ss7.m3ua.parameter.DeregistrationResult;
 32import org.mobicents.protocols.ss7.m3ua.parameter.DeregistrationStatus;
 33import org.mobicents.protocols.ss7.m3ua.parameter.DestinationPointCode;
 34import org.mobicents.protocols.ss7.m3ua.parameter.DiagnosticInfo;
 35import org.mobicents.protocols.ss7.m3ua.parameter.ErrorCode;
 36import org.mobicents.protocols.ss7.m3ua.parameter.HeartbeatData;
 37import org.mobicents.protocols.ss7.m3ua.parameter.InfoString;
 38import org.mobicents.protocols.ss7.m3ua.parameter.LocalRKIdentifier;
 39import org.mobicents.protocols.ss7.m3ua.parameter.NetworkAppearance;
 40import org.mobicents.protocols.ss7.m3ua.parameter.OPCList;
 41import org.mobicents.protocols.ss7.m3ua.parameter.Parameter;
 42import org.mobicents.protocols.ss7.m3ua.parameter.ParameterFactory;
 43import org.mobicents.protocols.ss7.m3ua.parameter.ProtocolData;
 44import org.mobicents.protocols.ss7.m3ua.parameter.RegistrationResult;
 45import org.mobicents.protocols.ss7.m3ua.parameter.RegistrationStatus;
 46import org.mobicents.protocols.ss7.m3ua.parameter.RoutingContext;
 47import org.mobicents.protocols.ss7.m3ua.parameter.RoutingKey;
 48import org.mobicents.protocols.ss7.m3ua.parameter.ServiceIndicators;
 49import org.mobicents.protocols.ss7.m3ua.parameter.Status;
 50import org.mobicents.protocols.ss7.m3ua.parameter.TrafficModeType;
 51import org.mobicents.protocols.ss7.m3ua.parameter.UserCause;
 52import org.mobicents.protocols.ss7.mtp.Mtp3TransferPrimitive;
 53
 54/**
 55 * 
 56 * @author kulikov
 57 */
 58public class ParameterFactoryImpl implements ParameterFactory {
 59	public ProtocolData createProtocolData(int opc, int dpc, int si, int ni, int mp, int sls, byte[] data) {
 60		return new ProtocolDataImpl(opc, dpc, si, ni, mp, sls, data);
 61	}
 62
 63	public ProtocolData createProtocolData(byte[] payloadData) {
 64		ProtocolDataImpl p = new ProtocolDataImpl(payloadData);
 65		return p;
 66	}
 67
 68	public ProtocolData createProtocolData(Mtp3TransferPrimitive mtp3TransferPrimitive) {
 69		ProtocolDataImpl p = new ProtocolDataImpl(mtp3TransferPrimitive);
 70		return p;
 71	}
 72
 73	public NetworkAppearance createNetworkAppearance(long netApp) {
 74		return new NetworkAppearanceImpl(netApp);
 75	}
 76
 77	public RoutingContext createRoutingContext(long[] routCntx) {
 78		return new RoutingContextImpl(routCntx);
 79	}
 80
 81	public CorrelationId createCorrelationId(long corrId) {
 82		return new CorrelationIdImpl(corrId);
 83	}
 84
 85	public AffectedPointCode createAffectedPointCode(int[] pc, short[] mask) {
 86		return new AffectedPointCodeImpl(pc, mask);
 87	}
 88
 89	public DestinationPointCode createDestinationPointCode(int pc, short mask) {
 90		return new DestinationPointCodeImpl(pc, mask);
 91	}
 92
 93	public InfoString createInfoString(String string) {
 94		return new InfoStringImpl(string);
 95	}
 96
 97	public ConcernedDPC createConcernedDPC(int pointCode) {
 98		return new ConcernedDPCImpl(pointCode);
 99	}
100
101	public CongestedIndication createCongestedIndication(CongestionLevel level) {
102		return new CongestedIndicationImpl(level);
103	}
104
105	public UserCause createUserCause(int user, int cause) {
106		return new UserCauseImpl(user, cause);
107	}
108
109	public ASPIdentifier createASPIdentifier(long aspId) {
110		return new ASPIdentifierImpl(aspId);
111	}
112
113	public LocalRKIdentifier createLocalRKIdentifier(long id) {
114		return new LocalRKIdentifierImpl(id);
115	}
116
117	public OPCList createOPCList(int[] pc, short[] mask) {
118		return new OPCListImpl(pc, mask);
119	}
120
121	public ServiceIndicators createServiceIndicators(short[] inds) {
122		return new ServiceIndicatorsImpl(inds);
123	}
124
125	public TrafficModeType createTrafficModeType(int mode) {
126		return new TrafficModeTypeImpl(mode);
127	}
128
129	public RegistrationStatus createRegistrationStatus(int status) {
130		return new RegistrationStatusImpl(status);
131	}
132
133	public DiagnosticInfo createDiagnosticInfo(String info) {
134		return new DiagnosticInfoImpl(info);
135	}
136
137	public RoutingKey createRoutingKey(LocalRKIdentifier localRkId, RoutingContext rc, TrafficModeType trafMdTy,
138			NetworkAppearance netApp, DestinationPointCode[] dpc, ServiceIndicators[] servInds, OPCList[] opcList) {
139		return new RoutingKeyImpl(localRkId, rc, trafMdTy, netApp, dpc, servInds, opcList);
140	}
141
142	public RegistrationResult createRegistrationResult(LocalRKIdentifier localRkId, RegistrationStatus status,
143			RoutingContext rc) {
144		return new RegistrationResultImpl(localRkId, status, rc);
145	}
146
147	public DeregistrationStatus createDeregistrationStatus(int status) {
148		return new DeregistrationStatusImpl(status);
149	}
150
151	public DeregistrationResult createDeregistrationResult(RoutingContext rc, DeregistrationStatus status) {
152		return new DeregistrationResultImpl(rc, status);
153	}
154
155	public ErrorCode createErrorCode(int code) {
156		return new ErrorCodeImpl(code);
157	}
158
159	public Status createStatus(int type, int info) {
160		return new StatusImpl(type, info);
161	}
162	
163	public HeartbeatData createHeartbeatData(byte[] data){
164		return new HeartbeatDataImpl(data);
165	}
166
167	public Parameter createParameter(int tag, byte[] value) {
168		ParameterImpl p = null;
169		switch (tag) {
170		case ParameterImpl.Protocol_Data:
171			p = new ProtocolDataImpl(value);
172			break;
173		case ParameterImpl.Traffic_Mode_Type:
174			p = new TrafficModeTypeImpl(value);
175			break;
176		case ParameterImpl.Network_Appearance:
177			p = new NetworkAppearanceImpl(value);
178			break;
179		case ParameterImpl.Routing_Context:
180			p = new RoutingContextImpl(value);
181			break;
182		case ParameterImpl.Correlation_ID:
183			p = new CorrelationIdImpl(value);
184			break;
185		case ParameterImpl.Affected_Point_Code:
186			p = new AffectedPointCodeImpl(value);
187			break;
188		case ParameterImpl.Originating_Point_Code_List:
189			p = new OPCListImpl(value);
190			break;
191		case ParameterImpl.Destination_Point_Code:
192			p = new DestinationPointCodeImpl(value);
193			break;
194		case ParameterImpl.INFO_String:
195			p = new InfoStringImpl(value);
196			break;
197		case ParameterImpl.Concerned_Destination:
198			p = new ConcernedDPCImpl(value);
199			break;
200		case ParameterImpl.Congestion_Indications:
201			p = new CongestedIndicationImpl(value);
202			break;
203		case ParameterImpl.User_Cause:
204			p = new UserCauseImpl(value);
205			break;
206		case ParameterImpl.ASP_Identifier:
207			p = new ASPIdentifierImpl(value);
208			break;
209		case ParameterImpl.Local_Routing_Key_Identifier:
210			p = new LocalRKIdentifierImpl(value);
211			break;
212		case ParameterImpl.Service_Indicators:
213			p = new ServiceIndicatorsImpl(value);
214			break;
215		case ParameterImpl.Routing_Key:
216			p = new RoutingKeyImpl(value);
217			break;
218		case ParameterImpl.Registration_Status:
219			p = new RegistrationStatusImpl(value);
220			break;
221		case ParameterImpl.Registration_Result:
222			p = new RegistrationResultImpl(value);
223			break;
224		case ParameterImpl.Deregistration_Status:
225			p = new DeregistrationStatusImpl(value);
226			break;
227		case ParameterImpl.Deregistration_Result:
228			p = new DeregistrationResultImpl(value);
229			break;
230		case ParameterImpl.Diagnostic_Information:
231			p = new DiagnosticInfoImpl(value);
232			break;
233		case ParameterImpl.Error_Code:
234			p = new ErrorCodeImpl(value);
235			break;
236		case ParameterImpl.Status:
237			p = new StatusImpl(value);
238			break;
239		case ParameterImpl.Heartbeat_Data:
240			p = new HeartbeatDataImpl(value);
241			break;
242		default:
243			p = new UnknownParameterImpl(tag, value.length, value);
244			break;
245		}
246		return p;
247	}
248
249}