Package org.kitesdk.data.event

Examples of org.kitesdk.data.event.StandardEvent


    String message = request.getParameter("message");
    if (message == null) {
      pw.println("<p>No message specified.</p>");
    } else {
      pw.println("<p>Message: " + message + "</p>");
      StandardEvent event = StandardEvent.newBuilder()
          .setEventInitiator("server_user")
          .setEventName("web:message")
          .setUserId(Long.parseLong(userId))
          .setSessionId(request.getSession(true).getId())
          .setIp(request.getRemoteAddr())
View Full Code Here


      if (!events.hasNext()) {
        return;
      }

      // Initialize the values needed to create a session for this group
      final StandardEvent firstEvent = events.next();
      long startTime = firstEvent.getTimestamp();
      long endTime = firstEvent.getTimestamp();
      int numEvents = 1;

      // Inspect each event and keep track of start time, end time, and count
      while (events.hasNext()) {
        final StandardEvent event = events.next();
        startTime = Math.min(startTime, event.getTimestamp());
        endTime = Math.max(endTime, event.getTimestamp());
        numEvents += 1;
      }

      // Create a session. Use the first event for fields that do not change
      emitter.emit(Session.newBuilder()             // same on all events:
View Full Code Here

          public Iterable<Tuple2<CorrelationKey, StandardEvent>>
              call(Tuple2<StandardEvent, Void> t) throws Exception {
            List<Tuple2<CorrelationKey, StandardEvent>> result =
                new ArrayList<Tuple2<CorrelationKey, StandardEvent>>(2);

            StandardEvent event = t._1();
            long loTimestamp = createLoTimestamp(event.getTimestamp());
            long hiTimestamp = createHiTimestamp(event.getTimestamp());
            String ip = event.getIp().toString();

            result.add(new Tuple2<CorrelationKey, StandardEvent>(
                new CorrelationKey(loTimestamp, ip), event));
            result.add(new Tuple2<CorrelationKey, StandardEvent>(
                new CorrelationKey(hiTimestamp, ip), event));

            return result;
          }
        });

    // Group the events by they correlation key
    JavaPairRDD<CorrelationKey, Iterable<StandardEvent>> groupedEvents = mappedEvents.groupByKey();

    // Generate potential matches by creating a list of alerts along with the
    // matched list of clicks. If no alerts were found with this correlation
    // key, then output an empty pair
    JavaPairRDD<List<StandardEvent>, List<StandardEvent>> potentialMatches = groupedEvents.mapToPair(
        new PairFunction<Tuple2<CorrelationKey, Iterable<StandardEvent>>, List<StandardEvent>, List<StandardEvent>>(){

          @Override
          public Tuple2<List<StandardEvent>, List<StandardEvent>> call(Tuple2<CorrelationKey, Iterable<StandardEvent>> t) throws Exception {
            Iterable<StandardEvent> allEvents = t._2();
            List<StandardEvent> alerts = new ArrayList<StandardEvent>();
            List<StandardEvent> clicks = new ArrayList<StandardEvent>();

            for (StandardEvent event : allEvents) {
              if (event.getEventDetails() != null &&
                  event.getEventDetails().containsKey(new Utf8("type")) &&
                  "alert".equals(event.getEventDetails().get(new Utf8("type")).toString())) {
                alerts.add(event);
              } else if (event.getEventDetails() != null &&
                  event.getEventDetails().containsKey(new Utf8("type")) &&
                  "click".equals(event.getEventDetails().get(new Utf8("type")).toString())) {
                clicks.add(event);
              }
            }

            if (alerts.isEmpty()) {
View Full Code Here

TOP

Related Classes of org.kitesdk.data.event.StandardEvent

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.