/* (non-Javadoc)
@see org.apereo.portal.rendering.PipelineComponent#getEventReader(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
775426
@Override
    public PipelineEventReader<CharacterEventReader, CharacterEvent> getEventReader(
            HttpServletRequest request, HttpServletResponse response) throws IllegalStateException {
        if (this.wrappedComponent != null) {
            final PipelineEventReader<CharacterEventReader, CharacterEvent> pipelineEventReader =
                    this.wrappedComponent.getEventReader(request, response);
            final CharacterEventReader eventReader = pipelineEventReader.getEventReader();
            final JsonWrapperFilteringCharacterEventReader
                    jsonWrapperFilteringCharacterEventReader =
                            new JsonWrapperFilteringCharacterEventReader(eventReader);
            final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
            return new PipelineEventReaderImpl<CharacterEventReader, CharacterEvent>(
                    jsonWrapperFilteringCharacterEventReader, outputProperties);
        } else {
            logger.warn("PipelineComponentWrapper.wrapperComponent is null");
            throw new IllegalStateException("PipelineComponentWrapper.wrapperComponent is null");
        }
    }
754854
public static EventEngine getEventService() {
        CHFWBundle c = instance.get().get();
        if (null != c) {
            return c.eventService;
        }
        return null;
    }
104280
@Override
    public MessageEvent parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment)
                    throws XmlPullParserException, IOException {
        MessageEvent messageEvent = new MessageEvent();
        boolean done = false;
        while (!done) {
            int eventType = parser.next();
            if (eventType == XmlPullParser.START_TAG) {
                if (parser.getName().equals("id"))
                    messageEvent.setStanzaId(parser.nextText());
                if (parser.getName().equals(MessageEvent.COMPOSING))
                    messageEvent.setComposing(true);
                if (parser.getName().equals(MessageEvent.DELIVERED))
                    messageEvent.setDelivered(true);
                if (parser.getName().equals(MessageEvent.DISPLAYED))
                    messageEvent.setDisplayed(true);
                if (parser.getName().equals(MessageEvent.OFFLINE))
                    messageEvent.setOffline(true);
            } else if (eventType == XmlPullParser.END_TAG) {
                if (parser.getName().equals("x")) {
                    done = true;
                }
            }
        }

        return messageEvent;
    }
627325
@Override
    public XMLEventReader2 createXMLEventReader(URL src)
        throws XMLStreamException
    {
        /* true for auto-close, since caller has no access to the underlying
         * input stream created from the URL
         */
        return new WstxEventReader(createEventAllocator(),
                                   createSR(createPrivateConfig(), src, true, true));
    }
584114
private EventImpl getEventImpl(final String fullName) {
        if (!isInitialized) {
            return null;
        }

        // Check if subscribed
        EventImpl eventImpl = eventImplMap.get(fullName);

        // Check if subscription is out of time
        if (eventImpl != null && !eventImpl.isStillSubscribed()) {
            logger.debug("{} not subscribed any more", fullName);
            // System.out.println(fullName + "Not Subscribed any more");
            eventImplMap.remove(fullName);

            // if no subscribers, close sockets
            if (eventImplMap.isEmpty()) {
                logger.debug("no subscribers on server, closing resources");
                close();
            }
            eventImpl = null;
        }

        return eventImpl;
    }
699414
@Override
    public PipelineEventReader<XMLEventReader, XMLEvent> getEventReader(
            HttpServletRequest request, HttpServletResponse response) {
        final PipelineEventReader<XMLEventReader, XMLEvent> pipelineEventReader =
                this.wrappedComponent.getEventReader(request, response);

        final XMLEventReader eventReader = pipelineEventReader.getEventReader();

        final IStylesheetDescriptor stylesheetDescriptor =
                stylesheetAttributeSource.getStylesheetDescriptor(request);

        final IPortalRequestInfo portalRequestInfo =
                this.urlSyntaxProvider.getPortalRequestInfo(request);

        final XMLEventReader filteredEventReader;
        if (portalRequestInfo.getTargetedPortletWindowId() == null) {
            final IStylesheetParameterDescriptor defaultWindowStateParam =
                    stylesheetDescriptor.getStylesheetParameterDescriptor(
                            "dashboardForcedWindowState");
            if (defaultWindowStateParam != null) {
                // Set all window states to the specified default
                final WindowState windowState =
                        PortletUtils.getWindowState(defaultWindowStateParam.getDefaultValue());
                filteredEventReader =
                        new SinglePortletWindowStateSettingXMLEventReader(
                                request, eventReader, windowState);
            } else {
                // Make sure there aren't any portlets in a "targeted" window state
                filteredEventReader =
                        new NonTargetedPortletWindowStateSettingXMLEventReader(
                                request, eventReader);
            }
        } else {
            // Not mobile, don't bother filtering
            filteredEventReader = eventReader;
        }

        final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
        return new PipelineEventReaderImpl<XMLEventReader, XMLEvent>(
                filteredEventReader, outputProperties);
    }
213835
public FutureAPIResponse getEventAsFuture(String eid) throws IOException {
    Request request = (new RequestBuilder("GET"))
        .setUrl(apiUrl + "/events/" + eid + ".json?accessKey=" + accessKey)
        .build();
    return new FutureAPIResponse(client.executeRequest(request, getHandler()));
  }
707006
public void processResponseEvent(HttpClientNIOResponseEvent event, HttpClientNIORequestActivityImpl activity) {

        HttpClientNIORequestActivityHandle ah = new HttpClientNIORequestActivityHandle(activity.getId());

        if (tracer.isFineEnabled())
            tracer.fine("==== FIRING ResponseEvent EVENT TO LOCAL SLEE, Event: " + event + " ====");

        try {
            resourceAdaptorContext.getSleeEndpoint().fireEvent(ah, fireableEventType, event, null, null, EVENT_FLAGS);
        } catch (Throwable e) {
            tracer.severe(e.getMessage(), e);
        }
    }
1350840
def getEvents(self):
        

        url = "https://redunda.sobotics.org/events.json"
        data = parse.urlencode({"key": self.key}).encode()

        req = request.Request(url, data)
        
        response = request.urlopen(req)

        return json.loads(response.read().decode("utf-8"))
566693
public void processResponseEvent(ResponseEvent event, HttpClientActivity activity) throws ActivityIsEndingException {

        HttpClientActivityHandle ah = new HttpClientActivityHandle(activity.getSessionId());

        if (tracer.isFineEnabled())
            tracer.fine("==== FIRING ResponseEvent EVENT TO LOCAL SLEE, Event: " + event + " ====");

        try {
            resourceAdaptorContext.getSleeEndpoint().fireEvent(ah, fireableEventType, event, null, null, EVENT_FLAGS);
        } catch (Throwable e) {
            throw new ActivityIsEndingException();
        }
    }
102701
public Object getEventResult() {
		Object result = eventResultCache.get();
		if (result != null) {
			return result;
		}

		if (eventResultHandler != null) {
			result = eventResultHandler.get();
			if (result != null){
				if (!eventResultCache.compareAndSet(null, result)){
					result = eventResultCache.get();
				}
			}
		}
		return result;
	}
36034
@Override
    public Reader getInput() throws IOException {
        ServletRESTRequestImpl ret = castRequest();
        if (ret != null)
            return ret.getInput();
        return null;
    }
565078
JsonEvent readEvent() throws IOException {
        char next = readNext();
        // whitespace
        while (next == ' ' || next == '\t' || next == '\n' || next == '\r') {
            next = readNext();
        }
        // identify token
        switch (next) {
            case '{':
                return JsonEvent.OBJECT;
            case '}':
                return JsonEvent.OBJECT_END;
            case '[':
                return JsonEvent.ARRAY;
            case ']':
                return JsonEvent.ARRAY_END;
            case '"':
                return JsonEvent.STRING;
            case '-':
            case '0':
            case '1':
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
                return acceptNumber(next);
            case 'n':
                return acceptNull();
            case 't':
                return acceptTrue();
            case 'f':
                return acceptFalse();
            case ',':
                return JsonEvent.COMMA;
            case ':':
                return JsonEvent.COLON;
            default:
                throw new IllegalArgumentException("Invalid JSON data: Expected JSON character but found '" + next + "'");
        }
    }
1325903
private static MgcpRequestedEvent parseSingle(int requestId, String requestedEvent, MgcpPackageManager packageManager)
            throws UnrecognizedMgcpPackageException, UnrecognizedMgcpEventException, UnrecognizedMgcpActionException, MgcpParseException {
        // Get indexes of separators
        int indexOfEvent = requestedEvent.indexOf(EVENT_SEPARATOR);
        if (indexOfEvent == -1) {
            throw new UnrecognizedMgcpPackageException("Missing event name separator on " + requestedEvent);
        }
        
        int indexOfConnectionId = requestedEvent.indexOf(CONNECTION_ID_SEPARATOR);
        
        int indexOfActionStart = requestedEvent.indexOf(ACTION_START_SEPARATOR);
        if (indexOfActionStart == -1) {
            throw new MgcpParseException("Missing action start separator on " + requestedEvent);
        }

        int indexOfActionEnd = requestedEvent.indexOf(ACTION_END_SEPARATOR);
        if (indexOfActionEnd == -1) {
            throw new MgcpParseException("Missing action end separator on " + requestedEvent);
        }
        
        // Parse information
        try {
            // Load MGCP Package
            String packageName = requestedEvent.substring(0, indexOfEvent);
            MgcpPackage mgcpPackage = packageManager.getPackage(packageName);
            
            if (mgcpPackage == null) {
                throw new UnrecognizedMgcpPackageException("Unrecognized package " + packageName + " on " + requestedEvent);
            }

            // Load MGCP Event
            String eventName;
            if(indexOfConnectionId == -1) {
                eventName = requestedEvent.substring(indexOfEvent + 1, indexOfActionStart);
            } else {
                eventName = requestedEvent.substring(indexOfEvent + 1, indexOfConnectionId);
            }
            MgcpEventType eventDetails = mgcpPackage.getEventDetails(eventName);
            
            if (eventDetails == null) {
                throw new UnrecognizedMgcpEventException("Unrecognized event " + eventName + " on " + requestedEvent);
            }
            
            String connectionIdHex = "";
            if(indexOfConnectionId != -1) {
                connectionIdHex = requestedEvent.substring(indexOfConnectionId + 1, indexOfActionStart);
                if(!connectionIdHex.matches("^[0-9A-F]+$")) {
                    throw new MgcpParseException("Invalid connection identifier " + connectionIdHex + " on " + requestedEvent);
                }
            }

            String eventParameters = "";
            boolean parameterized = eventDetails.parameterized();
            if (parameterized) {
                int indexOfParameterStart = requestedEvent.indexOf(PARAMETER_START_SEPARATOR, indexOfActionEnd);
                if (indexOfParameterStart == -1) {
                    throw new MgcpParseException("Missing parameters start separator on " + requestedEvent);
                }

                int indexOfParameterEnd = requestedEvent.indexOf(PARAMETER_END_SEPARATOR, indexOfParameterStart);
                if (indexOfActionEnd == -1) {
                    throw new MgcpParseException("Missing parameters end separator on " + requestedEvent);
                }
                
                eventParameters = requestedEvent.substring(indexOfParameterStart + 1, indexOfParameterEnd);
            }

            // Parse Action
            String action = requestedEvent.substring(indexOfActionStart + 1, indexOfActionEnd);
            MgcpActionType actionType = MgcpActionType.fromSymbol(action);
            if (actionType == null) {
                throw new UnrecognizedMgcpActionException("Unrecognized action " + eventName + " on " + requestedEvent);
            }

            // Build object
            int connectionId = connectionIdHex.isEmpty() ? 0 : Integer.parseInt(connectionIdHex, 16);
            String[] eventParametersTokens = eventParameters.isEmpty() ? new String[0] : eventParameters.split(",");
            return new MgcpRequestedEvent(requestId, packageName, eventName, actionType, connectionId, eventParametersTokens);
        } catch (RuntimeException e) {
            throw new MgcpParseException("Could not parse requested event " + requestedEvent, e);
        }
    }
15314
function (event) {
                var
                    reader = event.target,
                    buffer,
                    len,
                    result,
                    idx;
                _gpfAssert(reader === this._reader, "Unexpected change of reader");
                if (reader.error) {
                    gpfFireEvent.call(this,
                        gpfI.IReadableStream.ERROR,
                        {
                            // According to W3C
                            // http://www.w3.org/TR/domcore/#interface-domerror
                            error: {
                                name: reader.error.name,
                                message: reader.error.message
                            }
                        },
                        this._eventsHandler
                    );
                } else if (reader.readyState === FileReader.DONE) {
                    buffer = new Int8Array(reader.result);
                    len = buffer.length;
                    result = [];
                    for (idx = 0; idx < len; ++idx) {
                        result.push(buffer[idx]);
                    }
                    gpfFireEvent.call(this, gpfI.IReadableStream.EVENT_DATA, {buffer: result}, this._eventsHandler);
                }
            }
270549
public org.glassfish.jersey.server.monitoring.RequestEvent.ExceptionCause getExceptionCause() {
        return event.getExceptionCause();
    }
166869
@Override
    public PipelineEventReader<XMLEventReader, XMLEvent> getEventReader(
            HttpServletRequest request, HttpServletResponse response) {
        // Get the reader from the parent and add the attribute incorporating wrapper
        final PipelineEventReader<XMLEventReader, XMLEvent> cachingEventReader =
                this.wrappedComponent.getEventReader(request, response);
        final XMLEventReader eventReader =
                new AttributeIncorporatingXMLEventReader(
                        request, response, cachingEventReader.getEventReader());

        final Map<String, String> outputProperties = cachingEventReader.getOutputProperties();
        return new PipelineEventReaderImpl<XMLEventReader, XMLEvent>(eventReader, outputProperties);
    }