void connect() throws TransportException, DataEndpointAuthenticationException, DataEndpointException { if (connectionWorker != null) { connectionService.submit(connectionWorker); } else { throw new DataEndpointException("Data Endpoint is not initialized"); } }
@Override protected synchronized String login(Object client, String userName, String password) throws DataEndpointAuthenticationException { try { return ((ThriftSecureEventTransmissionService.Client) client).connect(userName, password); } catch (ThriftAuthenticationException e) { throw new DataEndpointAuthenticationException("Thrift Authentication Exception", e); } catch (TException e) { throw new DataEndpointAuthenticationException("Thrift exception", e); } }
/** * Extracts and return the protocol, host, port elements from the URL. * * @param url String of URL that needs to be processed. * @return Array which has elements - protocol, host, and port in the given order. */ public static String[] getProtocolHostPort(String url) throws DataEndpointConfigurationException { String[] keyElements = url.split(DataEndpointConstants.SEPARATOR); String[] urlElements = keyElements[0].split(":"); if (urlElements.length != 3) { throw new DataEndpointConfigurationException("Invalid URL is provided :" + url + ". Receiver URL property should take the format : " + "protocol://host:port"); } return new String[]{urlElements[0], urlElements[1].replace("//", ""), urlElements[2]}; }
public synchronized DataEndpointAgent getDataEndpointAgent(String type) throws DataEndpointAgentConfigurationException { DataEndpointAgent agent = this.dataEndpointAgents.get(type.toLowerCase()); if (agent == null) { throw new DataEndpointAgentConfigurationException("No data agent configured for the type: " + type.toLowerCase()); } return agent; }
private void tryPut(Event event) throws EventQueueFullException { long sequence; try { sequence = this.ringBuffer.tryNext(1); WrappedEventFactory.WrappedEvent bufferedEvent = this.ringBuffer.get(sequence); bufferedEvent.setEvent(event); this.ringBuffer.publish(sequence); } catch (InsufficientCapacityException e) { throw new EventQueueFullException("Cannot send events because the event queue is full", e); } }
void connect() throws TransportException, DataEndpointAuthenticationException, DataEndpointException { if (connectionWorker != null) { connectionService.submit(connectionWorker); } else { throw new DataEndpointException("Data Endpoint is not initialized"); } }
@Override protected synchronized String login(Object client, String userName, String password) throws DataEndpointAuthenticationException { try { return ((ThriftSecureEventTransmissionService.Client) client).connect(userName, password); } catch (ThriftAuthenticationException e) { throw new DataEndpointAuthenticationException("Thrift Authentication Exception", e); } catch (TException e) { throw new DataEndpointAuthenticationException("Thrift exception", e); } }
/** * Extracts and return the protocol, host, port elements from the URL. * * @param url String of URL that needs to be processed. * @return Array which has elements - protocol, host, and port in the given order. */ public static String[] getProtocolHostPort(String url) throws DataEndpointConfigurationException { String[] keyElements = url.split(DataEndpointConstants.SEPARATOR); String[] urlElements = keyElements[0].split(":"); if (urlElements.length != 3) { throw new DataEndpointConfigurationException("Invalid URL is provided :" + url + ". Receiver URL property should take the format : " + "protocol://host:port"); } return new String[]{urlElements[0], urlElements[1].replace("//", ""), urlElements[2]}; }
public synchronized DataEndpointAgent getDataEndpointAgent(String type) throws DataEndpointAgentConfigurationException { DataEndpointAgent agent = this.dataEndpointAgents.get(type.toLowerCase()); if (agent == null) { throw new DataEndpointAgentConfigurationException("No data agent configured for the type: " + type.toLowerCase()); } return agent; }
private void tryPut(Event event) throws EventQueueFullException { long sequence; try { sequence = this.ringBuffer.tryNext(1); WrappedEventFactory.WrappedEvent bufferedEvent = this.ringBuffer.get(sequence); bufferedEvent.setEvent(event); this.ringBuffer.publish(sequence); } catch (InsufficientCapacityException e) { throw new EventQueueFullException("Cannot send events because the event queue is full", e); } }
/** * Initialize the data endpoint connection worker. * A connection worker can be instantiated only ONE time. * * @param dataEndpoint DataEndpoint instance to handle the connection. * @param dataEndpointConfiguration DataEndpointConfiguration to handle the connection. * @throws DataEndpointException */ public void initialize(DataEndpoint dataEndpoint, DataEndpointConfiguration dataEndpointConfiguration) throws DataEndpointException { if (this.dataEndpointConfiguration == null) { this.dataEndpointConfiguration = dataEndpointConfiguration; } else { throw new DataEndpointException("Already data endpoint configuration is set: " + this.dataEndpointConfiguration.toString() + " for the endpoint " + dataEndpointConfiguration.toString()); } if (this.dataEndpoint == null) { this.dataEndpoint = dataEndpoint; } else { throw new DataEndpointException("Already data endpoint is configured for the connection worker"); } }
@Override protected synchronized void logout(Object client, String sessionId) throws DataEndpointAuthenticationException { try { ((ThriftSecureEventTransmissionService.Client) client).disconnect(sessionId); } catch (TException e) { throw new DataEndpointAuthenticationException("Thrift Exception", e); } }
throw new DataEndpointConfigurationException("Invalid data endpoints URL set provided : " + aURLGroup + ", a URL group can be configured as failover OR load balancing endpoints."); } else if (isLBURL) {
/** * Initialize the data endpoint connection worker. * A connection worker can be instantiated only ONE time. * * @param dataEndpoint DataEndpoint instance to handle the connection. * @param dataEndpointConfiguration DataEndpointConfiguration to handle the connection. * @throws DataEndpointException */ public void initialize(DataEndpoint dataEndpoint, DataEndpointConfiguration dataEndpointConfiguration) throws DataEndpointException { if (this.dataEndpointConfiguration == null) { this.dataEndpointConfiguration = dataEndpointConfiguration; } else { throw new DataEndpointException("Already data endpoint configuration is set: " + this.dataEndpointConfiguration.toString() + " for the endpoint " + dataEndpointConfiguration.toString()); } if (this.dataEndpoint == null) { this.dataEndpoint = dataEndpoint; } else { throw new DataEndpointException("Already data endpoint is configured for the connection worker"); } }
@Override protected synchronized void logout(Object client, String sessionId) throws DataEndpointAuthenticationException { try { ((ThriftSecureEventTransmissionService.Client) client).disconnect(sessionId); } catch (TException e) { throw new DataEndpointAuthenticationException("Thrift Exception", e); } }
public synchronized void shutDown() throws DataEndpointException { for (DataPublisher dataPublisher : dataPublishers) { dataPublisher.shutdown(); } try { transportPool.close(); securedTransportPool.close(); } catch (Exception e) { throw new DataEndpointException("Error while closing the transport pool", e); } } }
@Override protected String login(Object client, String userName, String password) throws DataEndpointAuthenticationException { Socket socket = (Socket) client; try { sendBinaryLoginMessage(socket, userName, password); return processResponse(socket); } catch (Exception e) { if (e instanceof DataEndpointAuthenticationException) { throw (DataEndpointAuthenticationException) e; } else { throw new DataEndpointAuthenticationException("Error while trying to login to data receiver :" + socket.getRemoteSocketAddress().toString(), e); } } }
public synchronized void shutDown() throws DataEndpointException { for (DataPublisher dataPublisher : dataPublishers) { dataPublisher.shutdown(); } try { transportPool.close(); securedTransportPool.close(); } catch (Exception e) { throw new DataEndpointException("Error while closing the transport pool", e); } } }
private Object getClient() throws DataEndpointException { try { return transportPool.borrowObject(getDataEndpointConfiguration().getPublisherKey()); } catch (Exception e) { throw new DataEndpointException("Cannot borrow client for " + getDataEndpointConfiguration().getPublisherKey(), e); } }
private Object getClient() throws DataEndpointException { try { return transportPool.borrowObject(getDataEndpointConfiguration().getPublisherKey()); } catch (Exception e) { throw new DataEndpointException("Cannot borrow client for " + getDataEndpointConfiguration().getPublisherKey(), e); } }