Package com.linkedin.databus2.core

Examples of com.linkedin.databus2.core.DatabusException


  @Override
  public void processElement(StateMachine stateMachine, XMLStreamReader xmlStreamReader)
      throws Exception
  {
    if(!xmlStreamReader.getLocalName().equals(_currentState))
      throw new DatabusException("Unexpected state, expected " + _currentState + ", found: " + xmlStreamReader.getLocalName());

    if(xmlStreamReader.isEndElement())
    {
      onEndElement(stateMachine, xmlStreamReader);
    }
View Full Code Here


    if(xmlStreamReader.isEndElement())
      nextStateType = StateProcessor.STATETYPE.ENDELEMENT;
    else if(xmlStreamReader.isStartElement())
      nextStateType = StateProcessor.STATETYPE.STARTELEMENT;
    else
      throw new DatabusException("Neither Start element or End element! cannot transition states");

    validateAndSetStateProcessor(stateMachine, _currentState, _currentStateType, nextState, nextStateType);
  }
View Full Code Here

    else if(nextState.equals(TokenState.TOKENSTATE))
      return stateMachine.tokenState;
    else if(nextState.equals(RootState.ROOT))
      return stateMachine.rootState;
    else
      throw new DatabusException("Unknown state (" + nextState +")! unable to find a corresponding state processor");

  }
View Full Code Here

    TransitionElement endTransition = new TransitionElement(nextStateType, nextState);

    HashSet<TransitionElement> expectedTranstitions = _transitionMapping.get(startTransition);

    if(expectedTranstitions == null)
      throw new DatabusException("No mapping found for this particular state "+ startTransition +". The state machine does not know the expected transitions");

    if(!expectedTranstitions.contains(endTransition))
    {
      throw new DatabusException("The current state is : "+ startTransition  +" the expected state was: " + expectedTranstitions + ". The next state found was: " + endTransition);
    }

   }
View Full Code Here

    }

    public int[] getBinlogOffset(int serverId)
    throws DatabusException
    {
      throw new DatabusException("Unimplemented method");
    }
View Full Code Here

    }

    public Map<String, String> printInfo()
    throws DatabusException
    {
      throw new DatabusException("Unimplemented method");
    }
View Full Code Here

      throws XMLStreamException, DatabusException
  {


    if(xmlStreamReader.getEventType() != XMLStreamReader.START_ELEMENT)
      throw new DatabusException("The XmlStreamReader is not pointing to a start element");

    StringBuffer sb = new StringBuffer();
      while(xmlStreamReader.hasNext())
      {

       int eventType = xmlStreamReader.next();
       if(eventType == XMLStreamConstants.CHARACTERS
              || eventType == XMLStreamConstants.CDATA
              || eventType == XMLStreamConstants.SPACE
              || eventType == XMLStreamConstants.ENTITY_REFERENCE) {
          sb.append(xmlStreamReader.getText());
          } else if(eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
              || eventType == XMLStreamConstants.COMMENT) {
            // skip
            LOG.error("Unknown state while processing characters (in method getText())");
          } else if(eventType == XMLStreamConstants.END_DOCUMENT) {
            throw new DatabusException("Unexpected end of document when reading element text content");
          } else if(eventType == XMLStreamConstants.START_ELEMENT) {
            throw new DatabusException("Element text content may not contain START_ELEMENT");
          } else {
            throw new DatabusException("Unexpected event type "+eventType);
          }
        }
    return sb.toString();
  }
View Full Code Here

      throws DatabusException, XMLStreamException
  {
    if(xmlStreamReader.hasNext())
      xmlStreamReader.next();
    else
      throw new DatabusException("XmlStream does not have any more data");
  }
View Full Code Here

      throws DatabusException, XMLStreamException
  {
    if(xmlStreamReader.hasNext())
      xmlStreamReader.nextTag();
    else
      throw new DatabusException("XmlStream does not have any more data");
  }
View Full Code Here

    if(xmlStreamReader.isEndElement())
    {
      if(xmlStreamReader.hasNext())
        xmlStreamReader.nextTag();
      else
        throw new DatabusException("XmlStream does not have any more data");
    }
    else if(xmlStreamReader.isStartElement())
    {
      XmlStreamReaderHelper.checkAndMoveNext(xmlStreamReader);
      if(xmlStreamReader.isCharacters())
      {
        XmlStreamReaderHelper.checkAndMoveToNextTag(xmlStreamReader);
      }

      if(xmlStreamReader.isEndElement())
        XmlStreamReaderHelper.checkAndMoveToNextTag(xmlStreamReader);

      if(!xmlStreamReader.isStartElement() && !xmlStreamReader.isEndElement())
        throw new DatabusException("Inconsistent state, expected cursor state START_ELEMENT or END_ELEMENT");

    }
    else
      throw new DatabusException("Unable to move to nextTag, expected START_ELEMENT or END_ELEMENT");
  }
View Full Code Here

TOP

Related Classes of com.linkedin.databus2.core.DatabusException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.