/* (non-Javadoc)
@see org.apereo.portal.rendering.PipelineComponent#getEventReader(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
501996
@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 PortletRenderingXMLEventReader filteredEventReader =
                new PortletRenderingXMLEventReader(request, response, eventReader);

        final Map<String, String> outputProperties = pipelineEventReader.getOutputProperties();
        return new PipelineEventReaderImpl<XMLEventReader, XMLEvent>(
                filteredEventReader, outputProperties);
    }
1216741
public static String getEventTypeDescription(final XMLStreamReader reader) {
        final int eventType = reader.getEventType();
        if (eventType == XMLStreamConstants.START_ELEMENT) {
            final String namespace = reader.getNamespaceURI();
            return "<" + reader.getLocalName()
                    + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">";
        }
        if (eventType == XMLStreamConstants.END_ELEMENT) {
            final String namespace = reader.getNamespaceURI();
            return "</" + reader.getLocalName()
                    + (!StringUtils.isEmpty(namespace) ? "@" + namespace : StringUtils.EMPTY) + ">";
        }
        return NAMES_OF_EVENTS[reader.getEventType()];
    }
972202
public static synchronized XMLEventReader createListReader(final List<XMLEvent> paramEvents)
        throws IOException, XMLStreamException {
        checkNotNull(paramEvents);
        return new ListEventReader(paramEvents);
    }
86319
public void handleEvent(Event event) {
        String topic = event.getTopic();
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Received event topic: " + topic);
        }
        HttpInboundLink link = event.getProperty(CallbackIDs.CALLBACK_HTTPICL.getName(), HttpInboundLink.class);
        if (null != link) {
            if (tc.isEventEnabled()) {
                Tr.event(tc, "Processing request on new thread; " + link);
            }
            link.ready(link.getVirtualConnection());
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Unable to process pipelined request with null link");
            }
        }
    }
1143582
public synchronized EventAgent getEventAgent() {
    if (this.eventAgent == null) {
      if (isService) {
        this.eventAgent =
            new EventAgent(
                this.serviceName,
                this.projectId,
                this.sslEnabled,
                this.nfvoIp,
                this.nfvoPort,
                this.version,
                this.serviceKey);
      } else {
        this.eventAgent =
            new EventAgent(
                this.username,
                this.password,
                this.projectId,
                this.sslEnabled,
                this.nfvoIp,
                this.nfvoPort,
                this.version);
      }
    }
    return this.eventAgent;
  }
253725
public static HttpServletResponse getHttpServletResponseFromExternalWebflowContext(final RequestContext context) {
        Assert.isInstanceOf(ServletExternalContext.class, context.getExternalContext(),
            "Cannot obtain HttpServletResponse from event of type: " + context.getExternalContext().getClass().getName());
        return (HttpServletResponse) context.getExternalContext().getNativeResponse();
    }
883823
@Override
    public Event readEvent(long id) {
        RowMapper<Event> rowMapper = new EventRowMapper();
        Event event = getJdbcTemplate()
            .queryForObject("select * from EVENTS where ID=" + id, rowMapper);
        event.getCustomInfo().clear();
        event.getCustomInfo().putAll(readCustomInfo(id));
        return event;
    }
1128327
protected InputStreamReader resolveReader(URL url) {

        if (url != null) {
            try {
                InputStream in = url.openStream();
                if (in != null)
                    return new InputStreamReader(in, this.encoding);
            } catch (IOException e) {
                logger.warn("resolve template error", e);
            }
        }
        return null;
    }
89145
public static HttpResponse fromEvent(HttpHeaders headers, ServerSentEvent sse) {
        return fromEvent(headers, sse, HttpHeaders.EMPTY_HEADERS);
    }
1173919
@Override
    public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) {
        return new Stax2FilteredEventReader(Stax2EventReaderAdapter.wrapIfNecessary(reader), filter);
    }
1118957
public Method getEventMethod(Class controlInterface)
    {
        //
        // If we already hold a method reference and its loader matches up with the input
        // interface, then just return it.
        //
        if (_method != null &&
            _method.getDeclaringClass().getClassLoader().equals(controlInterface.getClassLoader()))
            return _method;

        //
        // Otherwise, obtain the mapping from descriptors to methods, and use it to
        // convert back to a method.
        //
        String eventDescriptor = getEventDescriptor(controlInterface); 
        HashMap<String,Method> descriptorMap = getDescriptorMap(controlInterface);
        if (!descriptorMap.containsKey(eventDescriptor))
        {
            throw new IllegalArgumentException("Control interface " + controlInterface + 
                                               " does not contain an event method that " +
                                               " corresponds to " + eventDescriptor);
        }
        return descriptorMap.get(eventDescriptor);
    }
894807
private EventHandler getEventHandler(Connection connection, String name) {
        final String READ_ONE_EVENT_HANDLER_QUERY = "SELECT json_data FROM meta_event_handler WHERE name = ?";

        return query(connection, READ_ONE_EVENT_HANDLER_QUERY,
                q -> q.addParameter(name).executeAndFetchFirst(EventHandler.class));
    }
1145928
protected XMLEvent readStartTag(XMLEventReader reader, QName tagName)
            throws XMLStreamException, JournalException {
        XMLEvent event = reader.nextTag();
        if (!isStartTagEvent(event, tagName)) {
            throw getNotStartTagException(tagName, event);
        }
        return event;
    }
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;
    }
290019
public static EventEngine getEventService() {
        SSLChannelProvider p = instance.get();
        if (p != null)
            return p.eventService;

        throw new IllegalStateException("Requested service is null: no active component instance");
    }
803165
public static Document getEventDocFromUrl(String url) throws TVRageException {
        Document doc;
        InputStream in = null;

        try {
            in = new ByteArrayInputStream(requestWebContent(url));

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(in);
            doc.getDocumentElement().normalize();
            return doc;
        } catch (ParserConfigurationException | SAXException | IOException ex) {
            throw new TVRageException(ApiExceptionType.MAPPING_FAILED, UNABLE_TO_PARSE, url, ex);
        } finally {
            try {
                if (in != null) {
                    in.close();
                }
            } catch (IOException ex) {
                // Input Stream was already closed or null
                LOG.trace("Stream already closed for getEventDocFromUrl", ex);
            }
        }
    }
622359
public function readEvent()
    {
        $rawRequestBody = $this->httpClient->getRawRequest();
        $webhookEvent = !empty($rawRequestBody['webhook_event'])
            ? json_decode($rawRequestBody['webhook_event'], true)
            : false;
        return $webhookEvent ? $this->dataFactory->create($webhookEvent) : false;
    }