/** * Factory method to create a {@link Message} instance that is not read from a resource bundle. * * @param message Message's message text * @return a Messsage instance that has an error code of -1 and no arguments. */ public static Message createStaticMessage(String message) { return new Message(message, STATIC_ERROR_CODE, EMPTY_ARGS); }
/** * Factory method to create a {@link Message} instance that is not read from a resource bundle. * * @param message Static message text that may contain format specifiers * @param arguments Arguments referenced by the format specifiers in the message string. * @return a Messsage instance that has an error code of -1 and no arguments. */ public static Message createStaticMessage(String message, Object... arguments) { return new Message(String.format(message, arguments), STATIC_ERROR_CODE, EMPTY_ARGS); }
/** * Factory method to create a new {@link Message} instance that is filled with the formatted * message with id <code>code</code> from the resource bundle <code>bundlePath</code>. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message */ protected Message createMessage(String bundlePath, int code) { String messageString = getString(bundlePath, code, null); return new Message(messageString, code, EMPTY_ARGS); }
/** * Factory method to create a new {@link Message} instance that is filled with the formatted * message with id <code>code</code> from the resource bundle <code>bundlePath</code>. * * <b>Attention:</b> do not confuse this method with * <code>createMessage(String, int, Object)</code>. * * @param bundlePath complete path to the resource bundle for lookup * @param code numeric code of the message * @param arguments * @see #getBundlePath(String) */ protected Message createMessage(String bundlePath, int code, Object... arguments) { String messageString = getString(bundlePath, code, arguments); return new Message(messageString, code, arguments); }
public void configure(Reader configuration) throws ContainerException { try { container.setConfiguration(configuration); container.start(); } catch (Exception e) { throw new ContainerException(new Message(Messages.FAILED_TO_CONFIGURE_CONTAINER), e); } }
public void initialise() throws InitialisationException, RecoverableException { if (configFile == null) { return; } try { URL url = IOUtils.getResourceAsUrl(configFile, getClass()); if (url == null) { throw new ConfigurationException(new Message(Messages.CANT_LOAD_X_FROM_CLASSPATH_FILE, configFile)); } container.setConfiguration(url); container.start(); } catch (Exception e) { throw new InitialisationException(new Message(Messages.FAILED_TO_CREATE_X_WITH_X, "Plexus container", this.configFile), this); } }
public void initialise(Object component) throws InitialisationException { // only call this once if (invoked) { return; } if (component instanceof GlueInitialisable) { logger.debug("Calling Glue initialisation for component: " + component.getClass().getName()); ((GlueInitialisable)component).initialise(service, context); } invoked = true; try { logger.debug("Publishing service " + servicePath + " to Glue registry."); Registry.publish(servicePath, service, context); } catch (RegistryException e) { throw new InitialisationException(new Message("soap", 3, component.getClass().getName()), e, this); } } }
/** * Template method to dispose any resources associated with this receiver. There * is not need to dispose the connector as this is already done by the framework */ protected void doDispose() { try { Registry.unpublish(component.getDescriptor().getName()); } catch (RegistryException e) { logger.error(new Message(Messages.FAILED_TO_UNREGISTER_X_ON_ENDPOINT_X, component.getDescriptor() .getName(), endpoint.getEndpointURI()), e); } }
new Message("soap", 2, component.getDescriptor().getName()), this); throw new InitialisationException(new Message(Messages.CLASS_X_NOT_FOUND, e.getMessage()), e, this); throw new InitialisationException(new Message("soap", 3, component.getDescriptor().getName()), e, this); throw new InitialisationException(new Message(Messages.FAILED_TO_START_X, "Soap Server"), e, this);