Пример #1
0
  /**
   * Create a Tree structure adding the reference to passed As. The Tree is created starting from
   * {@link DPCNode} as parent node containing 'n' {@link OPCNode} leafs where 'n' is list of OPC
   * passed. For each {@link OPCNode} there will be 'm' {@link SINode} leafs where 'm' is number of
   * Service Indicator passed.
   *
   * <p>DPC is mandatory while OPC and SI list are optional. If OPC or SI is not passed the wild
   * card '-1' leaf will be added to parent node
   *
   * @param rk
   * @param asImpl
   * @throws Exception
   */
  public void addRk(RoutingKey rk, AsImpl asImpl) throws Exception {
    int dpc = rk.getDestinationPointCodes()[0].getPointCode();
    OPCList[] opcArray = rk.getOPCLists();

    int[] opcIntArr = null;
    if (opcArray == null) {
      opcIntArr = new int[] {-1};
    } else {
      opcIntArr = opcArray[0].getPointCodes();
    }

    ServiceIndicators[] siArray = rk.getServiceIndicators();
    short[] siShortArr = null;
    if (siArray == null) {
      siShortArr = new short[] {-1};
    } else {
      siShortArr = siArray[0].getIndicators();
    }

    for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail();
        (n = n.getNext()) != end; ) {
      DPCNode dpcNode = n.getValue();
      if (dpcNode.dpc == dpc) {
        this.addSi(dpcNode, opcIntArr, siShortArr, asImpl);
        return;
      }
    }

    DPCNode dpcNode = new DPCNode(dpc);
    this.addSi(dpcNode, opcIntArr, siShortArr, asImpl);
    this.dpcList.add(dpcNode);
  }
  @Override
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
    ServletInputStream is = request.getInputStream();
    try {
      XmlCAPDialog original = factory.deserialize(is);
      HttpSession session = request.getSession(true);
      if (logger.isInfoEnabled()) {
        logger.info("doPost. HttpSession=" + session.getId() + " Dialog = " + original);
      }

      if ((original.getNoActivityTimeout() != null) && (original.getNoActivityTimeout())) {
        try {
          original.close(true);
          this.sendResponse(response, original);
        } catch (CAPException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
        return;
      }

      FastList<CAPMessage> capMessages = original.getCAPMessages();

      for (FastList.Node<CAPMessage> n = capMessages.head(), end = capMessages.tail();
          (n = n.getNext()) != end; ) {

        CAPMessage capMessage = n.getValue();
        switch (capMessage.getMessageType()) {
          case initialDP_Request:
            InitialDPRequestImpl initialDPRequest = (InitialDPRequestImpl) capMessage;
            this.handleIdp(original, initialDPRequest);
            break;
          case applyChargingReport_Request:
            ApplyChargingReportRequestImpl applyChargingReportRequest =
                (ApplyChargingReportRequestImpl) capMessage;
            logger.info(
                String.format(
                    "Received applyChargingReportRequest=%s", applyChargingReportRequest));
            break;
          case eventReportBCSM_Request:
            EventReportBCSMRequestImpl eventReportBCSMRequest =
                (EventReportBCSMRequestImpl) capMessage;
            logger.info(
                String.format("Received eventReportBCSMRequest=%s", eventReportBCSMRequest));
            break;
          default:
            logger.info(String.format("unrecognized capMessage=%s", capMessage));
            break;
        }
      }

      // send response
      this.sendResponse(response, original);
    } catch (XMLStreamException e) {
      logger.error("Error while processing received XML", e);
    }
  }
Пример #3
0
 /**
  * Match the passed dpc, opc and si with Tree structure and return the As from corresponding
  * matched {@link SINode}.
  *
  * <p>For example if AS1 is added for Routing Key with DPC=123 only. The tree will be formed with
  * 123 as {@link DPCNode} parent node and -1 as {@link OPCNode} leaf and within {@link OPCNode} -1
  * as {@link SINode}
  *
  * @param dpc
  * @param opc
  * @param si
  * @return
  */
 public AsImpl getAs(int dpc, int opc, short si) {
   for (FastList.Node<DPCNode> n = dpcList.head(), end = dpcList.tail();
       (n = n.getNext()) != end; ) {
     DPCNode dpcNode = n.getValue();
     if (dpcNode.dpc == dpc) {
       return dpcNode.getAs(opc, si);
     }
   }
   return null;
 }
Пример #4
0
  @Override
  public void onEvent(FSMState state) {
    // Call listener and indicate of state change only if not already done
    if (!this.asImpl.state.getName().equals(State.STATE_DOWN)) {
      AsState oldState = AsState.getState(this.asImpl.state.getName());
      this.asImpl.state = AsState.DOWN;

      FastList<M3UAManagementEventListener> managementEventListenersTmp =
          this.asImpl.m3UAManagementImpl.managementEventListeners;

      for (FastList.Node<M3UAManagementEventListener> n = managementEventListenersTmp.head(),
              end = managementEventListenersTmp.tail();
          (n = n.getNext()) != end; ) {
        M3UAManagementEventListener m3uaManagementEventListener = n.getValue();
        try {
          m3uaManagementEventListener.onAsDown(this.asImpl, oldState);
        } catch (Throwable ee) {
          logger.error("Exception while invoking onAsDown", ee);
        }
      }
    }
  }