⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jaintcapstackimpl.java

📁 用Java实现的TCAP协议
💻 JAVA
字号:
/*
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *  Copyrights:
 *
 *  Copyright - 1999 Sun Microsystems, Inc. All rights reserved.
 *  901 San Antonio Road, Palo Alto, California 94043, U.S.A.
 *
 *  This product and related documentation are protected by copyright and
 *  distributed under licenses restricting its use, copying, distribution, and
 *  decompilation. No part of this product or related documentation may be
 *  reproduced in any form by any means without prior written authorization of
 *  Sun and its licensors, if any.
 *
 *  RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the United
 *  States Government is subject to the restrictions set forth in DFARS
 *  252.227-7013 (c)(1)(ii) and FAR 52.227-19.
 *
 *  The product described in this manual may be protected by one or more U.S.
 *  patents, foreign patents, or pending applications.
 *
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 *
 *  Author:
 *
 *  AePONA Limited, Interpoint Building
 *  20-24 York Street, Belfast BT15 1AQ
 *  N. Ireland.
 *
 *
 *  Module Name   : JAIN TCAP RI
 *  File Name     : JainTcapStackImpl.java
 *  Author        : Aidan Mc Gowan + Colm Hayden [Aepona]
 *                  Eugene Bell [AePONA]
 *  Approver      : Aepona JAIN Team
 *  Version       : 1.1
 *  Notes         :
 *
 * HISTORY
 * Version   Date      Author              Comments
 * 1.0     19/03/99   AmcG, CH             Initial version
 * 1.0d    15/8/2000  Eugene Bell          Final Public Release
 * 1.1     26/4/2001  Eugene Bell          Maintenance Release 1.1
 *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 */
package com.aepona.jain.protocol.ss7.tcap;

// java import
import java.util.Vector;

// jain import
import jain.DeleteProviderException;
import jain.protocol.ss7.VersionNotSupportedException;
import jain.protocol.ss7.tcap.JainTcapStack;
import jain.protocol.ss7.tcap.JainTcapProvider;
import jain.protocol.ss7.tcap.TcapException;
import jain.protocol.ss7.tcap.dialogue.DialogueConstants;

// deprecated as of 1.1
import jain.protocol.ss7.tcap.ProviderNotAttachedException;

 /**
 * Used to control the creation/deletion of proprietary JainTcapProviders [In the RI we use PeerProvider]
 *
 * @version     1.1
 * @author      AePONA
 */
public class JainTcapStackImpl implements JainTcapStack {

  public JainTcapStackImpl(){
    System.out.println("JainTcapStackImpl : constructor");
    this.setVendorName(nameOfStack);
  }

  /**
  * Returns the Signaling Point Code of this JainTcapStack.
  * The Signaling Point Code will uniquely identify the JainTcapStack.
  * @return the  signalingPointCode of this JainTcapStack.
  */
  public int[] getSignalingPointCode(){
    System.out.println("JainTcapStackImpl : getsignalingPointCode : accessing SPC");
    return(this.spc);
  }

  /**
  * Sets the signaling Point Code of this JainTcapStack. The Signaling Point Code
  * will uniquely identify the JainTcapStack.
  * @param <var>signalingPointCode</var> the Signaling Point Code of this JainTcapStack.
  */
  public void setSignalingPointCode(int[] signalingPointCode){
    System.out.println("JainTcapStackImpl : setsignalingPointCode : setting SPC");
    this.spc = signalingPointCode;
  }

  /**
  * Creates a new Peer (Vendor specific) <CODE>JainTcapProvider</CODE>
  * that is <B>attached</B> to this JainTcapStack and returns a reference to it.
  * <i>Note to developers:</i> The implementation of this method should add
  * the newly created <CODE>JainTcapProvider</CODE> to the
  * <a href="#providerList">providerList</a> once the <CODE>JainTcapProvider</CODE>
  * has been successfully created.
  * @return the newly created Peer Provider <i>attached to this JainTcapStack.</i>
  */
  public JainTcapProvider createProvider(){
    System.out.println("JainTcapStackImpl : createProvider : Creating Provider");
    try {
      myProvider = new PeerProvider();
    } catch(Exception err) {
      System.out.println(err);
    }
    providerList.addElement(myProvider);
    System.out.println("JainTcapStackImpl : createProvider : Peer provider created ");
    return myProvider;
  }

  /**
  * Creates a new Peer (Vendor specific) <CODE>JainTcapProvider</CODE>
  * that is <B>attached</B> to this JainTcapStack and returns a reference to it.
  * <i>Note to developers:</i> The implementation of this method should add
  * the newly created <CODE>JainTcapProvider</CODE> to the
  * <a href="#providerList">providerList</a> once the <CODE>JainTcapProvider</CODE>
  * has been successfully created.
  * @return the newly created Peer Provider <i>attached to this JainTcapStack.</i>
  * @deprecated as of version 1.1
  */
  public  JainTcapProvider createAttachedProvider(){
    return null;
  }

  /**
  * Creates a new Peer (Vendor specific) Provider that is <B>detached</B> from this
  * JainTcapStack and returns a reference to it.
  * <i>Note to developers:</i> The implementation of this method should add
  * the newly created <CODE>JainTcapProvider</CODE> to the
  * <a href="#providerList">providerList</a> once the <CODE>JainTcapProvider</CODE>
  * has been successfully created.
  * @return the newly created <i>detached</i> Peer Provider.
  * @deprecated as of version 1.1
  */
  public  JainTcapProvider createDetachedProvider(){
    return null;
  }

  /**
  * Deletes the specifed <CODE>JainTcapProvider</CODE>.
  * <i>Note to developers:</i> The implementation of this method should remove
  * the specified<CODE>JainTcapProvider</CODE> from
  * <a href="#providerList">providerList</a>. <P>
  * @param <var>providerToBeDeleted</var> the <CODE>JainTcapProvider</CODE> to be deleted.
  * @exception <var>DeleteProviderException</var> thrown if the specified
  * <CODE>JainTcapProvider</CODE> cannot be deleted. This may be because the
  * JainTcapProvider has already been deleted, or because the
  * <CODE>JainTcapProvider</CODE> is in use.
  */
  public void deleteProvider(JainTcapProvider providerToBeDeleted) throws DeleteProviderException {
    System.out.println("JainTcapStackImpl : deleteProvider : deleting provider");
    try {
      // check if the provider has been created by this stack
      if (!providerList.contains(providerToBeDeleted)) {
        throw new DeleteProviderException("JainTcapStackImpl : deleteProvider : The provider is not listed with this TcapStack");
      } else {
        providerList.removeElement(providerToBeDeleted);
      }
    } catch (DeleteProviderException e) {
      System.out.println("JainTcapStackImpl : deleteProvider : " +e.getMessage());
    }
  }

  /**
  * Attaches the specified Vendor specific Provider (Peer Provider) to this protocol stack.
  * @param <var>provider</var> the JainTcapProvider to attach to this JainTcapStack
  * @deprecated since version 1.1
  */
  public void attach(JainTcapProvider provider){
  }

  /**
  * Detaches the specified Vendor specific Provider (Peer Provider) from this protocol stack.
  * @param <var>provider</var> the JainTcapStack to attach to.
  * @exception ProviderNotAttachedException thrown if this method is invoked and the
  * specified Peer Provider is not attached to this Stack.
  * @deprecated since version 1.1
  */
  public void detach(JainTcapProvider provider) throws ProviderNotAttachedException{
  }

  /**
  * Returns the list of <CODE>JainTcapProviders</CODE> that have been created by this
  * <CODE>JainTcapStack</CODE>. All of these <CODE>JainTcapProviders</CODE>
  * will be proprietary objects, but will all be specific to the same Stack
  * Vendor as this <CODE>JainTcapStack</CODE>. Note that the <CODE>JainTcapProviders</CODE>
  * on this list may be either <em>attached</em> or <em>detached</em>.
  * @return a JainTcapProvider[] containing all the Peer Providers created.
  */
  public JainTcapProvider[] getProviderList(){
    System.out.println("JainTcapStackImpl : getProviderList : getting provider list");
    //return a clone of the providers, so that the internal list cannot be changed
    return (JainTcapProvider[])this.providerList.clone();
  }

  /**
  * Gets the Protocol Version parameter of the TCAPStack.
  * The Protocol version can be used to determine the protocol variant implementation of the TcapStack.
  * <UL>
  * <LI><B>PROTOCOL_VERSION_UNRECOGNISED</B>
  * <LI><B>PROTOCOL_VERSION_UNSUPPORTED</B>
  * <LI><B>PROTOCOL_VERSION_ANSI_92</B>
  * <LI><B>PROTOCOL_VERSION_ANSI_96</B>
  * <LI><B>PROTOCOL_VERSION_ITU_93</B>
  * <LI><B>PROTOCOL_VERSION_ITU_97</B>
  * </UL>
  * @return    the Protocol Version of the TCAP Stack object
  * @deprecated since version 1.1
  */
  public int getProtocolVersion() {
    return -1;
  }

  /**
  * Gets the stack Specification that this Stack is currently supporting. <p>
  *
  * <b>Note to developers</b> :- This should not be confused with the protocol
  * version field supported by the ANSI 1996 Dialogue Portion.
  *
  * @return    the current Protocol Version of this stack. This may be one of the
  *      following values:
  *      <UL>
  *        <LI> STACK_SPECIFICATION_ANSI_92
  *        <LI> STACK_SPECIFICATION_ANSI_96
  *        <LI> STACK_SPECIFICATION_ITU_93
  *        <LI> STACK_SPECIFICATION_ITU_97
  *      </UL>
  *      These values are defined in the TcapConstants class.
  * @since     JAIN TCAP v1.1
  *
  * Note: These get/set protocolVersion methods were deprecated to avoid
  * confusion between the stack standards supported and the protocol version field
  * supported by the ANSI 1996 Dialogue Portion
  */
  public int getStackSpecification() {
    System.out.println("JainTcapStackImpl : getStackSpecification : getting Stack Specification");
    return (stackSpecification);
  }

  /**
  * Sets the Protocol Version parameter of the TCAPStack.
  * The Protocol version can be used to determine the protocol variant implementation of the TcapStack.
  * @param <var>protocolVersion</var> the protocol version of this JainTcapStack
  * <UL>
  * <LI><B>PROTOCOL_VERSION_UNRECOGNISED</B>
  * <LI><B>PROTOCOL_VERSION_UNSUPPORTED</B>
  * <LI><B>PROTOCOL_VERSION_ANSI_92</B>
  * <LI><B>PROTOCOL_VERSION_ANSI_96</B>
  * <LI><B>PROTOCOL_VERSION_ITU_93</B>
  * <LI><B>PROTOCOL_VERSION_ITU_97</B>
  * </UL>
  * @deprecated as of version 1.1
  */
  public void setProtocolVersion(int protocolVersion) throws TcapException {
  }

  /**
  * Sets the Stack specification that this Stack is to support. Invoking this
  * method should initially configure the stack to support the given
  * specification if the specification supported has not already been set. In
  * the event that this Stack is already supporting a specification other than
  * the supplied specification, then the Stack will change the supported
  * specification if possible, or throw an Exception if this is not possible.
  * <p>
  *
  *  <b>Note to developers</b> :- This should not be confused with the protocol
  *  version field supported by the ANSI 1996 Dialogue Portion.
  *
  * @param  stackSpecification one of the following values:
  *      <UL>
  *        <LI> STACK_SPECIFICATION_ANSI_92
  *        <LI> STACK_SPECIFICATION_ANSI_96
  *        <LI> STACK_SPECIFICATION_ITU_93
  *        <LI> STACK_SPECIFICATION_ITU_97
  *      </UL>
  * @exception TcapException thrown if the supplied stack specification
  * cannot be supported by this Stack, or if the Stack
  * cannot change supported stack specifications because it is
  * not in a idle state.
  * @since  JAIN TCAP v1.1
  * @see TcapConstants
  */
  public void setStackSpecification(int stackSpecification) throws VersionNotSupportedException {
      System.out.println("JainTcapStackImpl : setStackSpecification : setting StackSpecification");
      this.stackSpecification = stackSpecification;
      protocolVersionSet = true;
  }

  /**
   * Sets the Name of this Stack.
   *  @param <var>stackName</var> the stack name.
   */
  public void setStackName(String stackName){
      System.out.println("JainTcapStackImpl : setStackName : setting StackName");
      this.stackName = stackName;
  }

  /**
   * Gets the Stack Name.
   * @return  a string describing the name of the Stack
   */
  public String getStackName(){
      System.out.println("JainTcapStackImpl : getStackName : returning StackName");
      return stackName;
  }

      /**
     * Returns the Vendor's name for this stack
     *
     * @return  a string describing the Vendor's name
     * @since     JAIN TCAP v1.1
     */
    public String getVendorName(){
      System.out.println("JainTcapStackImpl : getVendorName : returning VendorName");
      return nameOfVendor;
    }

    /**
     * Sets the Vendors name for this stack, this name will be the Vendor's domain
     * name inverted i.e. com.sun followed by the rest of the path name i.e.
     * jain.protocol.ss7.tcap.ri.PeerTcapStack.
     *
     * @param  vendorName  The new Vendor's Name
     * @since     JAIN TCAP v1.1
     */
     public void setVendorName(String vendorName){
            this.nameOfVendor = vendorName;
            System.out.println("JainTcapStackImpl : setVendorName : setting VendorName");
     }

  private Vector providerList = new Vector();
  //private String StackName = null;
  private String nameOfVendor = null;
  private int protocolVersion = 0;
  private int stackSpecification = 0;
  private String stackName = null;
  private boolean protocolVersionSet = false;
  private int[] spc = new int[10];    //The number of signaling point codes allowed
  private JainTcapProvider myProvider = null;
  private String nameOfStack = new String("TCK-2001-AePONA");
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -