protected ServerNotification createNotification(MuleContext context, String action) { try { return (ServerNotification)ctor.newInstance(context, action); } catch (Exception e) { throw new MuleRuntimeException(CoreMessages.failedToCreate("Notification:" + action) ,e); } } }
protected synchronized void createStoreDirectory(File directory) { // To support concurrency we need to check if directory exists again inside // synchronized method if (!directory.exists() && !directory.mkdirs()) { Message message = CoreMessages.failedToCreate("object store directory " + directory.getAbsolutePath()); throw new MuleRuntimeException(message); } }
protected synchronized void createStoreDirectory(File directory) throws ObjectStoreException { // To support concurrency we need to check if directory exists again inside // synchronized method if (!directory.exists() && !directory.mkdirs()) { Message message = CoreMessages.failedToCreate("queue store store directory " + directory.getAbsolutePath()); throw new ObjectStoreException(message); } }
/** * Creates the deployment properties directory. * * @param deploymentPropertiesDirectory path to create */ private static synchronized void createDeploymentPropertiesDirectory(File deploymentPropertiesDirectory) { if (!deploymentPropertiesDirectory.exists() && !deploymentPropertiesDirectory.mkdirs()) { Message message = CoreMessages.failedToCreate("deployment properties directory " + deploymentPropertiesDirectory.getAbsolutePath()); throw new MuleRuntimeException(message); } }
public void initialise() throws InitialisationException { try { if (!SecurityUtils.isFipsSecurityModel()) { Security.addProvider(new BouncyCastleProvider()); } } catch (Exception e) { logger.error("Error in Initialisation: " + e.getMessage(), e); throw new InitialisationException(CoreMessages.failedToCreate("PGPKeyRingImpl"), e, this); } }
protected void registerObjectProcessor(ObjectProcessor processor) { try { muleContext.getRegistry().registerObject("_" + processor.getClass().getSimpleName(), processor); } catch (RegistrationException e) { throw new MuleRuntimeException(CoreMessages.failedToCreate(processor.getClass().getName()), e); } }
protected void createDirectory(File directory) throws ObjectStoreException { try { // To support concurrency we need to check if directory exists again // inside // synchronized method if (!directory.exists() && !directory.mkdirs()) { Message message = CoreMessages.failedToCreate("object store directory " + directory.getAbsolutePath()); throw new MuleRuntimeException(message); } } catch (Exception e) { throw new ObjectStoreException(e); } }
@Deprecated public Model createModel() throws ServiceException { if (modelClass != null) { try { Model model = (Model)ClassUtils.instanciateClass(modelClass, ClassUtils.NO_ARGS, getClass()); BeanUtils.populateWithoutFail(model, properties, false); return model; } catch (Exception e) { throw new ServiceException(CoreMessages.failedToCreate(modelClass), e); } } else return null; }
public AbstractService(MuleContext muleContext) { this.muleContext = muleContext; ((MuleContextAware) component).setMuleContext(muleContext); try { lifecycleManager = new ServiceLifecycleManager(this, muleContext); } catch (MuleException e) { throw new MuleRuntimeException(CoreMessages.failedToCreate("Service Lifecycle Manager"), e); } }
/** * <p> * Create a {@link MuleMessageFactory} from this connector's configuration, * typically through the transport descriptor. * </p> * <p/> * <b>Attention!</b> This method is not meant to be used by client code directly. * It is only publicly available to service message receivers which should be * used as <em>real</em> factories to create {@link MuleMessage} instances. * * @see MessageReceiver#createMuleMessage(Object) * @see MessageReceiver#createMuleMessage(Object, String) */ @Override public MuleMessageFactory createMuleMessageFactory() throws CreateException { try { return serviceDescriptor.createMuleMessageFactory(); } catch (TransportServiceException tse) { throw new CreateException(CoreMessages.failedToCreate("MuleMessageFactory"), tse, this); } }
@Override protected void doInitialise() throws InitialisationException { try { if (!SecurityUtils.isFipsSecurityModel()) { java.security.Security.addProvider(new BouncyCastleProvider()); } setSecurityContextFactory(new PGPSecurityContextFactory()); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToCreate("PGPProvider"), e, this); } }
public Context getJndiContext(String jndiProviderUrl) throws InitialisationException { try { setJndiProviderUrl(jndiProviderUrl); initJndiContext(); } catch (Exception e) { throw new InitialisationException( CoreMessages.failedToCreate("AbstractJndiConnector"), e, this); } return jndiContext; }
public MetaTransportServiceDescriptor(String metaScheme, String scheme, Properties props, ClassLoader classLoader) throws ServiceException { super(metaScheme, props, classLoader); this.metaScheme = metaScheme; Properties p = SpiUtils.findServiceDescriptor(ServiceType.TRANSPORT, scheme); //Load any overrides for the for the endpoint scheme if (p == null) { throw new ServiceException(CoreMessages.failedToCreate("transport: " + metaScheme + ":" + scheme)); } Properties temp = new Properties(); PropertiesUtils.getPropertiesWithPrefix(props, scheme + ".", temp); if (temp.size() > 0) { p.putAll(PropertiesUtils.removeNamespaces(temp)); } setOverrides(p); }
/** * Uses this object's {@link MuleMessageFactory} to create a new {@link MuleMessage} instance. * This is the designated way to build {@link MuleMessage}s from the transport specific message. */ public MuleMessage createMuleMessage(Object transportMessage, String encoding) throws MuleException { try { return muleMessageFactory.create(transportMessage, encoding, endpoint.getMuleContext()); } catch (Exception e) { throw new CreateException(CoreMessages.failedToCreate("MuleMessage"), e, this); } }
/** * Uses this object's {@link MuleMessageFactory} to create a new {@link MuleMessage} instance. * The payload of the new message will be taken from <code>transportMessage</code>, all * message properties will be copied from <code>previousMessage</code>. */ public MuleMessage createMuleMessage(Object transportMessage, MuleMessage previousMessage, String encoding) throws MuleException { try { return muleMessageFactory.create(transportMessage, previousMessage, encoding, endpoint.getMuleContext()); } catch (Exception e) { throw new CreateException(CoreMessages.failedToCreate("MuleMessage"), e); } }
/** * Invokes the MessageProcessor. * * @param event MuleEvent to be processed * @throws MuleException */ public MuleEvent process(MuleEvent event) throws MuleException { MuleMessage _muleMessage = event.getMessage(); FTPServerModuleLifecycleAdapter castedModuleObject = null; if (moduleObject instanceof String) { castedModuleObject = ((FTPServerModuleLifecycleAdapter) muleContext.getRegistry().lookupObject(((String) moduleObject))); if (castedModuleObject == null) { throw new MessagingException(CoreMessages.failedToCreate("remove"), event, new RuntimeException("Cannot find the configuration specified by the config-ref attribute.")); } } else { castedModuleObject = ((FTPServerModuleLifecycleAdapter) moduleObject); } try { String transformedPath = ((String) evaluateAndTransform(_muleMessage, RemoveMessageProcessor.class.getDeclaredField("_pathType").getGenericType(), null, path)); retryCount.getAndIncrement(); castedModuleObject.remove(transformedPath); retryCount.set(0); return event; } catch (Exception e) { throw new MessagingException(CoreMessages.failedToInvoke("remove"), event, e); } }
/** * Invokes the MessageProcessor. * * @param event MuleEvent to be processed * @throws MuleException */ public MuleEvent process(MuleEvent event) throws MuleException { MuleMessage _muleMessage = event.getMessage(); FTPServerModuleLifecycleAdapter castedModuleObject = null; if (moduleObject instanceof String) { castedModuleObject = ((FTPServerModuleLifecycleAdapter) muleContext.getRegistry().lookupObject(((String) moduleObject))); if (castedModuleObject == null) { throw new MessagingException(CoreMessages.failedToCreate("startServer"), event, new RuntimeException("Cannot find the configuration specified by the config-ref attribute.")); } } else { castedModuleObject = ((FTPServerModuleLifecycleAdapter) moduleObject); } try { retryCount.getAndIncrement(); castedModuleObject.startServer(); retryCount.set(0); return event; } catch (Exception e) { throw new MessagingException(CoreMessages.failedToInvoke("startServer"), event, e); } }
/** * Invokes the MessageProcessor. * * @param event MuleEvent to be processed * @throws MuleException */ public MuleEvent process(MuleEvent event) throws MuleException { MuleMessage _muleMessage = event.getMessage(); FTPServerModuleLifecycleAdapter castedModuleObject = null; if (moduleObject instanceof String) { castedModuleObject = ((FTPServerModuleLifecycleAdapter) muleContext.getRegistry().lookupObject(((String) moduleObject))); if (castedModuleObject == null) { throw new MessagingException(CoreMessages.failedToCreate("stopServer"), event, new RuntimeException("Cannot find the configuration specified by the config-ref attribute.")); } } else { castedModuleObject = ((FTPServerModuleLifecycleAdapter) moduleObject); } try { retryCount.getAndIncrement(); castedModuleObject.stopServer(); retryCount.set(0); return event; } catch (Exception e) { throw new MessagingException(CoreMessages.failedToInvoke("stopServer"), event, e); } }
public void initialise() throws InitialisationException { if (algorithm == null) { throw new InitialisationException(CoreMessages.objectIsNull("Algorithm"), this); } else { logger.debug("Using encryption algorithm: " + algorithm); } keySpec = createKeySpec(); try { secretKey = getSecretKey(); createAndInitCiphers(); } catch (Exception e) { throw new InitialisationException(CoreMessages.failedToCreate("encryption ciphers"), e, this); } }
@Override public TransactionManager getObject() throws Exception { if (muleContext.isDisposing()) { // The txManager might be declared, but if it isn't used by the application it won't be created until the // muleContext is disposed. // At that point, there is no need to create the txManager. return null; } else if (txManagerFactory != null) { try { return txManagerFactory.create(muleContext.getConfiguration()); } catch (Exception e) { throw new MuleRuntimeException(failedToCreate("transaction manager"), e); } } else { return customTxManager; } }