private ErrorInformation makeErrorInformation ( final Exception e ) { return new ErrorInformation ( null, e.getMessage (), ExceptionHelper.formatted ( e ) ); } }
private ErrorInformation makeErrorInformation ( final Exception e ) { return new ErrorInformation ( null, e.getMessage (), ExceptionHelper.formatted ( e ) ); } }
public synchronized void sendQueryState ( final QueryImpl queryImpl, final QueryState state, final Throwable error ) { final QueryImpl query = this.queries.get ( queryImpl.getQueryId () ); if ( query == null ) { return; } sendMessage ( new UpdateQueryState ( query.getQueryId (), state, new ErrorInformation ( null, error == null ? null : error.getMessage (), ExceptionHelper.formatted ( error ) ) ) ); }
private void handleSubscribeItem ( final SubscribeItem message ) { try { this.service.subscribeItem ( this.session, message.getItemId () ); } catch ( final Exception e ) { logger.warn ( "Failed to subscribe", e ); sendMessage ( new ItemStateUpdate ( message.getItemId (), SubscriptionState.DISCONNECTED, new ErrorInformation ( 0x01L, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); } }
private void handleUnsubscibeItem ( final UnsubscibeItem message ) { try { this.service.unsubscribeItem ( this.session, message.getItemId () ); } catch ( final Exception e ) { logger.warn ( "Failed to unsubscribe", e ); sendMessage ( new ItemStateUpdate ( message.getItemId (), SubscriptionState.DISCONNECTED, new ErrorInformation ( 0x01L, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); } }
private void handleUnsubscibeItem ( final UnsubscibeItem message ) { try { this.service.unsubscribeItem ( this.session, message.getItemId () ); } catch ( final Exception e ) { logger.warn ( "Failed to unsubscribe", e ); sendMessage ( new ItemStateUpdate ( message.getItemId (), SubscriptionState.DISCONNECTED, new ErrorInformation ( 0x01L, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); } }
private void handleSubscribeItem ( final SubscribeItem message ) { try { this.service.subscribeItem ( this.session, message.getItemId () ); } catch ( final Exception e ) { logger.warn ( "Failed to subscribe", e ); sendMessage ( new ItemStateUpdate ( message.getItemId (), SubscriptionState.DISCONNECTED, new ErrorInformation ( 0x01L, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); } }
private void sendBrowseError ( final BrowseFolder message, final Exception e, final Long code ) { sendMessage ( new BrowseResult ( new Response ( message.getRequest () ), null, new ErrorInformation ( code, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); } }
private void sendWriteValueError ( final StartWriteValue message, final Exception e, final Long code ) { sendMessage ( new WriteValueResult ( new Response ( message.getRequest () ), new ErrorInformation ( code, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); }
private void sendBrowseError ( final BrowseFolder message, final Exception e, final Long code ) { sendMessage ( new BrowseResult ( new Response ( message.getRequest () ), null, new ErrorInformation ( code, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); } }
private void sendWriteAttributesError ( final StartWriteAttributes message, final Exception e, final Long code ) { sendMessage ( new WriteAttributesResult ( new Response ( message.getRequest () ), null, new ErrorInformation ( code, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); }
private void sendWriteValueError ( final StartWriteValue message, final Exception e, final Long code ) { sendMessage ( new WriteValueResult ( new Response ( message.getRequest () ), new ErrorInformation ( code, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); }
private void sendWriteAttributesError ( final StartWriteAttributes message, final Exception e, final Long code ) { sendMessage ( new WriteAttributesResult ( new Response ( message.getRequest () ), null, new ErrorInformation ( code, e.getMessage (), ExceptionHelper.formatted ( e ) ) ) ); }
private ErrorInformation convertEntry ( final WriteAttributeResult value ) { if ( value == null || value.isSuccess () || value.getError () == null ) { return null; } return new ErrorInformation ( null, value.getError ().getMessage (), ExceptionHelper.formatted ( value.getError () ) ); }
private ErrorInformation convertEntry ( final WriteAttributeResult value ) { if ( value == null || value.isSuccess () || value.getError () == null ) { return null; } return new ErrorInformation ( null, value.getError ().getMessage (), ExceptionHelper.formatted ( value.getError () ) ); }
protected void processCallbackFuture ( final Request request, final Future<Callback[]> future, final Callback[] callbacks ) { logger.debug ( "Processing callback result - request: {}, future: {}", request, future ); final List<CallbackResponse> result = new LinkedList<CallbackResponse> (); ErrorInformation errorInformation = null; try { future.get (); // this is just a get call to see if we have an exception for ( final Callback cb : callbacks ) { final boolean canceled = cb.isCanceled (); final Map<String, String> attributes = !canceled ? cb.buildResponseAttributes () : Collections.<String, String> emptyMap (); logger.debug ( "Callback result - canceled: {}, attributes: {}", canceled, attributes ); result.add ( new CallbackResponse ( canceled, attributes ) ); } } catch ( final Exception e ) { logger.warn ( "Failed to build result map", e ); errorInformation = new ErrorInformation ( null, ExceptionHelper.getMessage ( e ), ExceptionHelper.formatted ( e ) ); result.clear (); } sendMessage ( new RespondCallbacks ( new Response ( request ), result, errorInformation ) ); }
protected void processCallbackFuture ( final Request request, final Future<Callback[]> future, final Callback[] callbacks ) { logger.debug ( "Processing callback result - request: {}, future: {}", request, future ); final List<CallbackResponse> result = new LinkedList<CallbackResponse> (); ErrorInformation errorInformation = null; try { future.get (); // this is just a get call to see if we have an exception for ( final Callback cb : callbacks ) { final boolean canceled = cb.isCanceled (); final Map<String, String> attributes = !canceled ? cb.buildResponseAttributes () : Collections.<String, String> emptyMap (); logger.debug ( "Callback result - canceled: {}, attributes: {}", canceled, attributes ); result.add ( new CallbackResponse ( canceled, attributes ) ); } } catch ( final Exception e ) { logger.warn ( "Failed to build result map", e ); errorInformation = new ErrorInformation ( null, ExceptionHelper.getMessage ( e ), ExceptionHelper.formatted ( e ) ); result.clear (); } sendMessage ( new RespondCallbacks ( new Response ( request ), result, errorInformation ) ); }
@Override public void complete ( final Future<Void> future ) { try { future.get (); sendMessage ( new AcknowledgeResponse ( new Response ( message.getRequest () ), null ) ); } catch ( final Exception e ) { sendMessage ( new AcknowledgeResponse ( new Response ( message.getRequest () ), new ErrorInformation ( 0x01L, "Permission denied", ExceptionHelper.formatted ( e ) ) ) ); } } } );
return new org.eclipse.scada.core.data.ErrorInformation ( code, message, diagnosticInformation );
private void handleAknRequest ( final AcknowledgeRequest message ) throws InvalidSessionException { final Date timestamp = message.getAknTimestamp () == null ? null : new Date ( message.getAknTimestamp () ); final CallbackHandler callbackHandler = createCallbackHandler ( message.getCallbackHandlerId () ); final NotifyFuture<Void> future = this.service.acknowledge ( this.session, message.getMonitorId (), timestamp, message.getOperationParameters (), callbackHandler ); future.addListener ( new FutureListener<Void> () { @Override public void complete ( final Future<Void> future ) { try { future.get (); sendMessage ( new AcknowledgeResponse ( new Response ( message.getRequest () ), null ) ); } catch ( final Exception e ) { sendMessage ( new AcknowledgeResponse ( new Response ( message.getRequest () ), new ErrorInformation ( 0x01L, "Permission denied", ExceptionHelper.formatted ( e ) ) ) ); } } } ); }