/** * @see javax.jbi.component.ComponentContext#getTransactionManager() */ public Object getTransactionManager() { return this.context.getTransactionManager(); }
/** * @see javax.jbi.component.ComponentContext#getTransactionManager() */ public Object getTransactionManager() { return context.getTransactionManager(); }
public Object getTransactionManager() { return context.getTransactionManager(); }
public TransactionManager getTransactionManager() { if (_txm == null) { return (TransactionManager) getContext().getTransactionManager(); } return _txm; }
public Object getTransactionManager() { return getContext().getTransactionManager(); }
public void init(ComponentContext context) throws JBIException { try { logger.debug("Initializing component"); Thread.currentThread().setContextClassLoader(component.getClass().getClassLoader()); this.context = context; this.channel = context.getDeliveryChannel(); try { this.transactionManager = (TransactionManager) context.getTransactionManager(); } catch (Throwable e) { // Ignore, this is just a safeguard against non compliant // JBI implementation which throws an exception instead of // return null } container = Container.detect(context); doInit(); setCurrentState(INITIALIZED); logger.debug("Component initialized"); } catch (JBIException e) { throw e; } catch (Exception e) { throw new JBIException("Error calling init", e); } }
public void start() throws Exception { transactionManager = (TransactionManager) context.getTransactionManager(); endpointFactory = new SingletonEndpointFactory(this, transactionManager); bootstrapContext = endpoint.getBootstrapContext(); if (bootstrapContext == null) { throw new IllegalArgumentException("bootstrapContext not set"); } connectionFactory = endpoint.getConnectionFactory(); if (connectionFactory == null) { throw new IllegalArgumentException("connectionFactory not set"); } activationSpec = endpoint.getActivationSpec(); if (activationSpec == null) { throw new IllegalArgumentException("activationSpec not set"); } resourceAdapter = endpoint.getResourceAdapter(); if (resourceAdapter == null) { resourceAdapter = activationSpec.getResourceAdapter(); if (resourceAdapter == null) { throw new IllegalArgumentException("resourceAdapter not set"); } } else if (activationSpec.getResourceAdapter() == null) { activationSpec.setResourceAdapter(resourceAdapter); } resourceAdapter.start(bootstrapContext); resourceAdapter.endpointActivation(endpointFactory, activationSpec); }
private void checkJmsTransportTransaction() { Destination destination = server.getDestination(); if (destination instanceof JMSDestination) { JMSDestination jmsDestination = (JMSDestination)destination; JMSConfiguration jmsConfig = jmsDestination.getJmsConfig(); if (jmsConfig.isSessionTransacted()) { TransactionManager tm = (TransactionManager) getContext().getTransactionManager(); if (tm == null) { throw new IllegalStateException("No TransactionManager available"); } else if (tm instanceof PlatformTransactionManager) { jmsConfig.setSessionTransacted(true); jmsConfig.setTransactionManager((PlatformTransactionManager)tm); jmsConfig.setUseJms11(false); setSynchronous(true); transactionEnabled = true; } } } }
if (endpoint.isRollbackOnError()) { TransactionManager tm = (TransactionManager) endpoint.getServiceUnit().getComponent().getComponentContext().getTransactionManager(); tm.setRollbackOnly(); return;
private void resumeTx(MessageExchange exchange) throws MessagingException { if (!getEndpoint().getServiceUnit().getComponent().getContainer().handleTransactions()) { Transaction tx = (Transaction) exchange.getProperty(MessageExchange.JTA_TRANSACTION_PROPERTY_NAME); if (tx != null) { TransactionManager txmgr = (TransactionManager) endpoint.getServiceUnit().getComponent().getComponentContext().getTransactionManager(); try { txmgr.resume(tx); } catch (InvalidTransactionException e) { throw new MessagingException(e); } catch (SystemException e) { throw new MessagingException(e); } } } }
public synchronized void start() throws Exception { if (bootstrapContext == null) { Executor executor = getServiceUnit().getComponent().getExecutor(MessageExchange.Role.CONSUMER); WorkManager wm = new WorkManagerWrapper(executor); bootstrapContext = new SimpleBootstrapContext(wm); } resourceAdapter.start(bootstrapContext); activationSpec.setResourceAdapter(resourceAdapter); if (endpointFactory == null) { TransactionManager tm = (TransactionManager) getContext().getTransactionManager(); endpointFactory = new SingletonEndpointFactory(new MessageListener() { public void onMessage(Message message) { try { JmsJcaConsumerEndpoint.this.onMessage(message, null); } catch (JMSException e) { throw new ListenerExecutionFailedException("Unable to handle message", e); } } }, tm); } resourceAdapter.endpointActivation(endpointFactory, activationSpec); super.start(); }
private void initBpelServer() throws JBIException { if (__log.isDebugEnabled()) { __log.debug("ODE initializing"); } _ode._server = new BpelServerImpl(); // We don't want the server to automatically load deployed processes, // we'll do that explcitly _ode._eprContext = new EndpointReferenceContextImpl(_ode); _ode._mexContext = new MessageExchangeContextImpl(_ode); if (_ode._config.getThreadPoolMaxSize() == 0) _ode._executorService = Executors.newCachedThreadPool(); else _ode._executorService = Executors.newFixedThreadPool(_ode._config.getThreadPoolMaxSize()); _ode._scheduler = new SimpleScheduler(new GUID().toString(),new JdbcDelegate(_ode._dataSource), _ode._config.getProperties()); _ode._scheduler.setJobProcessor(_ode._server); _ode._scheduler.setExecutorService(_ode._executorService); _ode._scheduler.setTransactionManager((TransactionManager) _ode.getContext().getTransactionManager()); _ode._store = new ProcessStoreImpl(_ode._eprContext , _ode._dataSource, _ode._config.getDAOConnectionFactory(), _ode._config, false); registerExternalVariableModules(); _ode._store.loadAll(); _ode._server.setInMemDaoConnectionFactory(new org.apache.ode.bpel.memdao.BpelDAOConnectionFactoryImpl( _ode._scheduler, _ode._config.getInMemMexTtl())); _ode._server.setDaoConnectionFactory(_ode._daocf); _ode._server.setEndpointReferenceContext(_ode._eprContext); _ode._server.setMessageExchangeContext(_ode._mexContext); _ode._server.setBindingContext(new BindingContextImpl(_ode)); _ode._server.setScheduler(_ode._scheduler); _ode._server.setConfigProperties(_ode._config.getProperties()); _ode._server.init(); }
if (TRANSACTED_XA.equals(transacted)) { cont.setSessionTransacted(true); TransactionManager tm = (TransactionManager) getContext().getTransactionManager(); if (tm == null) { throw new IllegalStateException("No TransactionManager available");