Actually send an event to the provider.

@param statement the LRS statement to send.
541881
@Override
    public boolean sendEvent(LrsStatement statement) {
        if (!isEnabled()) {
            return false;
        }

        ResponseEntity<Object> response =
                sendRequest(
                        STATEMENTS_REST_ENDPOINT, HttpMethod.POST, null, statement, Object.class);
        if (response.getStatusCode().series() == Series.SUCCESSFUL) {
            logger.trace("LRS provider successfully sent to {}, statement: {}", LRSUrl, statement);
        } else {
            logger.error("LRS provider failed to send to {}, statement: {}", LRSUrl, statement);
            logger.error("- Response: {}", response);
            return false;
        }

        return true;
    }
163039
public void eventReceived (DEvent event)
    {
        log.debug("Event received", "event", event);

        if (event instanceof InvocationRequestEvent) {
            InvocationRequestEvent ire = (InvocationRequestEvent)event;
            dispatchRequest(ire.getSourceOid(), ire.getInvCode(),
                            ire.getMethodId(), ire.getArgs(), ire.getTransport());
        }
    }
615938
public void offerEvent(final Event event) throws IOException
    {
        if (!acceptEvents.get()) {
            // TODO shouldn't we increment eventsLost here?
            return;
        }

        eventsReceived.incrementAndGet();

        try {
            log.debug("Writing event: {}", event);
            eventWriter.write(event);
        }
        catch (IOException e) {
            log.error(String.format("Failed to write event: %s", event), e);
            eventsLost.incrementAndGet();

            throw e;
        }
    }
482911
public void sendResponse(int code, String response) {
        if(con.isClosed()) return;

        if(response == null || response.isEmpty()) {
            response = "Unknown";
        }

        try {
            if(response.charAt(0) == '-') {
                writer.write(code + response + "\r\n");
            } else {
                writer.write(code + " " + response + "\r\n");
            }
            writer.flush();
        } catch(IOException ex) {
            Utils.closeQuietly(this);
        }
        responseSent = true;
    }
880023
public void sendEvent(EventBuilder eventBuilder) {
        if (!Util.isNullOrEmpty(release)) {
            eventBuilder.withRelease(release.trim());
            if (!Util.isNullOrEmpty(dist)) {
                eventBuilder.withDist(dist.trim());
            }
        }

        if (!Util.isNullOrEmpty(environment)) {
            eventBuilder.withEnvironment(environment.trim());
        }

        if (!Util.isNullOrEmpty(serverName)) {
            eventBuilder.withServerName(serverName.trim());
        }

        for (Map.Entry<String, String> tagEntry : tags.entrySet()) {
            eventBuilder.withTag(tagEntry.getKey(), tagEntry.getValue());
        }

        for (Map.Entry<String, Object> extraEntry : extra.entrySet()) {
            eventBuilder.withExtra(extraEntry.getKey(), extraEntry.getValue());
        }

        runBuilderHelpers(eventBuilder);
        Event event = eventBuilder.build();
        sendEvent(event);
    }
89496
public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception 
	{
        if (!EventUtils.isEmptyOrNull(msgs)) {
    		// Check to validate port
    		int portToUse = getTransportPort(port);
        	
        	DatagramSocket socket = new DatagramSocket();

    		for (int i=0; i<msgs.length; i++) {
    			byte[] msgBytes = getTransportPayload(msgs[i]);
    			send(msgBytes, socket, destination, portToUse);
    		}
           socket.close();
        }
	}
1351567
private Object exec(StatementContext statement) {
    if (statement == null)
      return null;
    return statement.accept(visitor);
  }
1230854
@Override
  public boolean writeEvent(AuditEvent event) throws HandlerException {
    StringBuilder elements = new StringBuilder();
    for (Field element : event.getFields()) {
      elements.append(
        element.getName() + " " + element.getType() + ":" + element.getValue() + ", ");
    }

    try (Connection conn = getConnection()) {
      try (PreparedStatement statement = conn.prepareStatement(insertQuery)) {
        statement.setString(1, event.getUuid().toString());
        statement.setTimestamp(2, new Timestamp(event.getTimestamp().getTime()));
        statement.setString(3, event.getActor());
        statement.setString(4, event.getOrigin());
        statement.setString(5, event.getAction());
        statement.setString(6, elements.toString());

        return statement.execute();
      }
    } catch (SQLException e) {
      throw new HandlerException("SQL Exception", DatabaseAuditHandler.class, e);
    }
  }
261497
protected void executeUpdateSilently(String statement) {
        logger.trace(statement);
        try (Statement alter = conn.createStatement()) {
            alter.execute(statement);
        } catch (final SQLException e) {
            logger.debug("Could not execute {}.", statement, e);
        }
    }
948624
public static void closeStatement(Statement statement, String sql) {
		if (statement != null) {
			try {
				statement.close();
			} catch (SQLException e) {
				log.log(Level.WARNING, "Failed to close SQL Statement: " + sql,
						e);
			}
		}
	}
41481
@Override
	public void writeStatement(Statement oldStat)
	{
		if (null == oldStat)
		{
			System.err.println("java.lang.Exception: XMLEncoder: discarding statement null");
			System.err.println("Continuing...");
			return;
		}

		// record how the object is changed
		recordStatement(oldStat);
		super.writeStatement(oldStat);
	}
1029111
public static void closeStatement(Statement statement) {
        try {
            if (statement != null && !statement.isClosed()) {

                statement.close();
            }
        } catch (SQLException ex) {
            LOGGER.trace(statement.toString(), ex);
        }
    }
1228298
@Override
    public void remove(Iterable<? extends Statement> statements) throws RepositoryException {
        Iterator <? extends Statement> iter = statements.iterator();
        while(iter.hasNext()){
            Statement st = iter.next();
            getClient().sendRemove(null, st.getSubject(), st.getPredicate(), st.getObject());
        }
    }
625796
public void sendEventsFromQueue() {
        if (null == queue || stopSending) {
            return;
        }
        LOG.fine("Scheduler called for sending events");

        int packageSize = getEventsPerMessageCall();

        while (!queue.isEmpty()) {
            final List<Event> list = new ArrayList<Event>();
            int i = 0;
            while (i < packageSize && !queue.isEmpty()) {
                Event event = queue.remove();
                if (event != null && !filter(event)) {
                    list.add(event);
                    i++;
                }
            }
            if (list.size() > 0) {
                executor.execute(new Runnable() {
                    public void run() {
                        try {
                            sendEvents(list);
                        } catch (MonitoringException e) {
                            e.logException(Level.SEVERE);
                        }
                    }
                });

            }
        }

    }
1225148
@Override
    public LrsStatement toLrsStatement(PortalEvent event) {
        return new LrsStatement(getActor(event), getVerb(event), getLrsObject(event));
    }
447584
void executeStatement(String statement) {

		try (Connection conn = getFastConnection(); Statement stm = conn.createStatement()) {
			stm.execute(statement);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
204494
public void sendAuditEvent(AuditEventMessage[] msgs, InetAddress destination, int port) throws Exception 
	{
        if (!EventUtils.isEmptyOrNull(msgs)) {
    		Socket s = getTLSSocket(destination, port);

    		for (int i=0; i<msgs.length; i++) {
				send(msgs[i], s);
    		}
    		
    		//TODO: tear down the TLS transport socket, if needed
        }
	}