/** * Creates a mapping of an <code>error (ServiceErrorID</code>) and corresponding <code> * actionsList (ErrorHandlingAction</code>) that may be taken when an <code>error</code> occurs * * @param error <code>ServiceErrorID</code> * @param actionsList <code>ErrorHandlingAction</code>s */ protected void addError(ServiceErrorID error, Set<ErrorHandlingAction> actionsList) { if (error == null) { throw new IllegalArgumentException(RBUtil.getMessage(Bundle.class, Bundle.NULL_ERROR_ADDED)); } if (actionsList == null) { throw new IllegalArgumentException( RBUtil.getMessage(Bundle.class, Bundle.NULL_ERROR_ACTION_LIST_ADDED)); } errorActionsMap.put(error, actionsList); }
@Override protected void internalCreate() throws ServiceExecutionException { super.internalCreate(); try { session = transportProvider.getConnection().createSession(false, Session.CLIENT_ACKNOWLEDGE); ccpEventManager = new CCPEventManager(service, session, logger); logger.log( Level.FINE, RBUtil.getMessage(Bundle.class, Bundle.COMMUNICATION_WITH_PEER_ESTABLISHED)); } catch (JMSException e) { throw new ServiceExecutionException( RBUtil.getMessage(Bundle.class, Bundle.FAILED_TO_START_COMMUNICATION_WITH_PEER), e, ServiceErrorID.SERVICE_LAUNCH_ERROR); } }
/** * Returns a <code>java.util.Map</code> containing <code>ServiceErrorID</code> and corresponding * <code>java.util.Collection</code> of <code>ErrorHandlingAction</code>s that may be taken when * an exception occurs * * @param errorActionsMap a <code>java.util.Map</code> <<code>ServiceErrorID</code>, <code> * java.util.Collection</code>> */ public void setErrorActionsMap(Map<ServiceErrorID, Set<ErrorHandlingAction>> errorActionsMap) { if (errorActionsMap == null) { throw new IllegalArgumentException( RBUtil.getMessage(Bundle.class, Bundle.NULL_ERROR_ACTION_MAP)); } this.errorActionsMap = errorActionsMap; }
@Override protected void internalDestroy() throws ServiceExecutionException { try { if (session != null) { try { session.close(); } finally { session = null; } } if (ccpEventManager != null) { ccpEventManager = null; } logger.log( Level.FINE, RBUtil.getMessage(Bundle.class, Bundle.COMMUNICATION_WITH_PEER_ESTABLISHED)); } catch (JMSException e) { logger.log( Level.WARNING, RBUtil.getMessage(Bundle.class, Bundle.FAILED_TO_CLOSE_COMMUNICATION_WITH_PEER), e); } super.internalDestroy(); }
/** Returns custom editor for object */ public final Component getCustomEditor() { try { AbstractErrorHandlingConfiguration configuration = (AbstractErrorHandlingConfiguration) getValue(); return new ErrorHandlingPanel(configuration); } catch (Exception ex) { String message = RBUtil.getMessage( Bundle.class, Bundle.CUSTOM_EDITOR_INIT_FAILED, new Object[] {this.getClass().getName()}); ErrorManager.getDefault().notify(ErrorManager.EXCEPTION, new Exception(message, ex)); return new JLabel(message); } }