@Override
    public void notifyChild(ElementParser child) {
      if (!(child instanceof ParametersParser)) return;

      ParametersParser parametersChild = (ParametersParser) child;

      if (this.currentElement.equals(XmlConstants.XML_CONTAINER)) {
        getContainerModel().setParameterMap(parametersChild.getParameterMap());
      } else if (this.currentElement.equals(XmlConstants.XML_HANDLER_ENCRYPTION)) {
        getContainerModel().setEncryptionHandlerParameterMap(parametersChild.getParameterMap());
      } else if (this.currentElement.equals(XmlConstants.XML_HANDLER_PERSISTENCE)) {
        getContainerModel().setPersistenceHandlerParameterMap(parametersChild.getParameterMap());
      }
    }
Пример #2
0
  /**
   * parse the String message
   *
   * @return SIPHeader (Event object)
   * @throws SIPParseException if the message does not respect the spec.
   */
  public SIPHeader parse() throws ParseException {

    if (debug) dbg_enter("EventParser.parse");

    try {
      headerName(TokenTypes.EVENT);
      this.lexer.SPorHT();

      Event event = new Event();
      this.lexer.match(TokenTypes.ID);
      Token token = lexer.getNextToken();
      String value = token.getTokenValue();

      event.setEventType(value);
      super.parse(event);

      this.lexer.SPorHT();
      this.lexer.match('\n');

      return event;

    } catch (ParseException ex) {
      throw createParseException(ex.getMessage());
    } finally {
      if (debug) dbg_leave("EventParser.parse");
    }
  }
  /**
   * parse the CallInfo String header
   *
   * @return SIPHeader (CallInfoList object)
   * @throws SIPParseException if the message does not respect the spec.
   */
  public SIPHeader parse() throws ParseException {

    if (debug) dbg_enter("CallInfoParser.parse");
    CallInfoList list = new CallInfoList();

    try {
      headerName(TokenTypes.CALL_INFO);

      while (lexer.lookAhead(0) != '\n') {
        CallInfo callInfo = new CallInfo();
        callInfo.setHeaderName(SIPHeaderNames.CALL_INFO);

        this.lexer.SPorHT();
        this.lexer.match('<');
        URLParser urlParser = new URLParser((Lexer) this.lexer);
        GenericURI uri = urlParser.uriReference(true);
        callInfo.setInfo(uri);
        this.lexer.match('>');
        this.lexer.SPorHT();

        super.parse(callInfo);
        list.add(callInfo);

        while (lexer.lookAhead(0) == ',') {
          this.lexer.match(',');
          this.lexer.SPorHT();

          callInfo = new CallInfo();

          this.lexer.SPorHT();
          this.lexer.match('<');
          urlParser = new URLParser((Lexer) this.lexer);
          uri = urlParser.uriReference(true);
          callInfo.setInfo(uri);
          this.lexer.match('>');
          this.lexer.SPorHT();

          super.parse(callInfo);
          list.add(callInfo);
        }
      }

      return list;
    } finally {
      if (debug) dbg_leave("CallInfoParser.parse");
    }
  }
Пример #4
0
  /**
   * parse the String message
   *
   * @return SIPHeader (CallID object)
   * @throws ParseException if the message does not respect the spec.
   */
  public SIPHeader parse() throws ParseException {
    if (debug) dbg_enter("parse");
    try {
      headerName(TokenTypes.REPLACES_TO);

      Replaces replaces = new Replaces();
      this.lexer.SPorHT();
      String callId = lexer.byteStringNoSemicolon();
      this.lexer.SPorHT();
      super.parse(replaces);
      replaces.setCallId(callId);
      return replaces;
    } finally {
      if (debug) dbg_leave("parse");
    }
  }
Пример #5
0
  /**
   * parse the AlertInfo String header
   *
   * @return SIPHeader (AlertInfoList object)
   * @throws SIPParseException if the message does not respect the spec.
   */
  public SIPHeader parse() throws ParseException {

    if (debug) dbg_enter("AlertInfoParser.parse");
    AlertInfoList list = new AlertInfoList();

    try {
      headerName(TokenTypes.ALERT_INFO);

      while (lexer.lookAhead(0) != '\n') {
        AlertInfo alertInfo = new AlertInfo();
        alertInfo.setHeaderName(SIPHeaderNames.ALERT_INFO);
        URLParser urlParser;
        GenericURI uri;

        do {
          this.lexer.SPorHT();
          if (this.lexer.lookAhead(0) == '<') {
            this.lexer.match('<');
            urlParser = new URLParser((Lexer) this.lexer);
            uri = urlParser.uriReference(true);
            alertInfo.setAlertInfo(uri);
            this.lexer.match('>');
          } else {
            /* This is non standard for Polycom support.
             * I know it is bad grammar but please do not remove. mranga
             */
            String alertInfoStr = this.lexer.byteStringNoSemicolon();
            alertInfo.setAlertInfo(alertInfoStr);
          }

          this.lexer.SPorHT();

          super.parse(alertInfo);
          list.add(alertInfo);

          if (lexer.lookAhead(0) == ',') {
            this.lexer.match(',');
          } else break;
        } while (true);
      }
      return list;
    } finally {
      if (debug) dbg_leave("AlertInfoParser.parse");
    }
  }