Package org.apache.blur.thirdparty.thrift_0_9_0.transport

Examples of org.apache.blur.thirdparty.thrift_0_9_0.transport.TFileTransport$Event


      Event[] events = history.getLatestPage();

      System.out.println("Events In the latestPage are : ");
      for (int i = 0; i < events.length; i++)
      {
        Event anEvent = events[i];
        System.out.println("Event: " + anEvent.getClass().getName()
            + "  FullFormattedMessage: "
            + anEvent.getFullFormattedMessage());
      }
    } catch (Exception e)
    {
      System.out.println("Caught Exception : " + " Name : "
          + e.getClass().getName() + " Message : " + e.getMessage()
View Full Code Here


                {
                    ArrayOfEvent aoe = (ArrayOfEvent) value;
                    Event[] evts = aoe.getEvent();
                    for (int evtID = 0; evtID < evts.length; ++evtID)
                    {
                        Event anEvent = evts[evtID];
                        System.out.println("\n----------" + "\n Event ID: "
                                + anEvent.getKey() + "\n Event: "
                                + anEvent.getClass().getName()
                                + "\n FullFormattedMessage: "
                                + anEvent.getFullFormattedMessage()
                                + "\n VM Reference: "
                                + anEvent.getVm().getVm().get_value()
                                + "\n----------\n");
                    }
                } else if (value instanceof VmEvent)
                {
                    VmEvent anEvent = (VmEvent) value;
                    System.out.println("\n----------" + "\n Event ID: "
                            + anEvent.getKey() + "\n Event: "
                            + anEvent.getClass().getName()
                            + "\n FullFormattedMessage: "
                            + anEvent.getFullFormattedMessage()
                            + "\n VM Reference: "
                            + anEvent.getVm().getVm().get_value()
                            + "\n----------\n");
                }
                System.out.println("===============");
            }
        }
View Full Code Here

        evtMgr.createCollectorForEvents(eventFilter);
      Event[] events = ehc.getLatestPage();

      for (int i = 0; i < events.length; i++)
      {
        Event anEvent = events[i];
        System.out.println("Event: " +
            anEvent.getClass().getName());
      }
    }
    si.getServerConnection().logout();
  }
View Full Code Here

    ServiceInstance si = new ServiceInstance(
        new URL(args[0]), args[1], args[2], true);

    // get the latest event and print it out
    EventManager evtMgr = si.getEventManager();
    Event latestEvent = evtMgr.getLatestEvent();
    printEvent(latestEvent);

    // create a filter spec for querying events
    EventFilterSpec efs = new EventFilterSpec();
    // limit to only error and warning
View Full Code Here

      selectionKey_ = selectionKey;
      selectThread_ = selectThread;
      buffer_ = ByteBuffer.allocate(4);

      frameTrans_ = new TMemoryInputTransport();
      response_ = new TByteArrayOutputStream();
      inTrans_ = inputTransportFactory_.getTransport(frameTrans_);
      outTrans_ = outputTransportFactory_.getTransport(new TIOStreamTransport(response_));
      inProt_ = inputProtocolFactory_.getProtocol(inTrans_);
      outProt_ = outputProtocolFactory_.getProtocol(outTrans_);
View Full Code Here

    /**
     * Get the transport that should be used by the invoker for responding.
     */
    private TTransport getOutputTransport() {
      response_ = new TByteArrayOutputStream();
      return outputTransportFactory_.getTransport(new TIOStreamTransport(response_));
    }
View Full Code Here

  // Read in a JSON string, unescaping as appropriate.. Skip reading from the
  // context if skipContext is true.
  private TByteArrayOutputStream readJSONString(boolean skipContext)
    throws TException {
    TByteArrayOutputStream arr = new TByteArrayOutputStream(DEF_STRING_SIZE);
    if (!skipContext) {
      context_.read();
    }
    readJSONSyntaxChar(QUOTE);
    while (true) {
      byte ch = reader_.read();
      if (ch == QUOTE[0]) {
        break;
      }
      if (ch == ESCSEQ[0]) {
        ch = reader_.read();
        if (ch == ESCSEQ[1]) {
          readJSONSyntaxChar(ZERO);
          readJSONSyntaxChar(ZERO);
          trans_.readAll(tmpbuf_, 0, 2);
          ch = (byte)((hexVal((byte)tmpbuf_[0]) << 4) + hexVal(tmpbuf_[1]));
        }
        else {
          int off = ESCAPE_CHARS.indexOf(ch);
          if (off == -1) {
            throw new TProtocolException(TProtocolException.INVALID_DATA,
                                         "Expected control char");
          }
          ch = ESCAPE_CHAR_VALS[off];
        }
      }
      arr.write(ch);
    }
    return arr;
  }
View Full Code Here

  // Read in a JSON double value. Throw if the value is not wrapped in quotes
  // when expected or if wrapped in quotes when not expected.
  private double readJSONDouble() throws TException {
    context_.read();
    if (reader_.peek() == QUOTE[0]) {
      TByteArrayOutputStream arr = readJSONString(true);
      try {
        double dub = Double.valueOf(arr.toString("UTF-8"));
        if (!context_.escapeNum() && !Double.isNaN(dub) &&
            !Double.isInfinite(dub)) {
          // Throw exception -- we should not be in a string in this case
          throw new TProtocolException(TProtocolException.INVALID_DATA,
                                       "Numeric data unexpectedly quoted");
View Full Code Here

    }
  }

  // Read in a JSON string containing base-64 encoded data and decode it.
  private byte[] readJSONBase64() throws TException {
    TByteArrayOutputStream arr = readJSONString(false);
    byte[] b = arr.get();
    int len = arr.len();
    int off = 0;
    int size = 0;
    while (len >= 4) {
      // Decode 4 bytes at a time
      TBase64Utils.decode(b, off, 4, b, size); // NB: decoded in place
View Full Code Here

  public void writeString(String str) throws TException {
    try {
      byte[] bytes = str.getBytes("UTF-8");
      writeBinary(bytes, 0, bytes.length);
    } catch (UnsupportedEncodingException e) {
      throw new TException("UTF-8 not supported!");
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.blur.thirdparty.thrift_0_9_0.transport.TFileTransport$Event

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.