/** * This implementation always throws a NotSupportedException. */ @Override public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws ResourceException { throw new NotSupportedException("SpringContextResourceAdapter does not support message endpoints"); }
@Override protected String[] bindConnectionFactory(String deployment, final String jndi, Object cf) throws Throwable { // AS7-2222: Just hack it if (cf instanceof javax.resource.Referenceable) { ((javax.resource.Referenceable)cf).setReference(new Reference(jndi)); } // don't register because it's one during add operation return new String[] { jndi }; }
/** * Returns a detailed message string describing this exception. * * @return a detailed message string. */ public String getMessage() { String msg = super.getMessage(); String ec = getErrorCode(); if ((msg == null) && (ec == null)) { return null; } if ((msg != null) && (ec != null)) { return (msg + ", error code: " + ec); } return ((msg != null) ? msg : ("error code: " + ec)); } }
throws ResourceException { if (!isActive) { throw new ResourceException( "JCAConnectionManagerImpl::allocateConnection::No valid Connection available"); } catch (PoolException ex) { throw new ResourceException( String.format( "JCAConnectionManagerImpl:: allocateConnection : in getting connection from pool due to %s", XAResource xar = conn.getXAResource(); txn.enlistResource(xar); throw new ResourceException( String.format("JCAConnectionManagerImpl:: allocateConnection : in transaction due to %s", ex.getMessage()), ex); } catch (SystemException ex) { throw new ResourceException( String.format( "JCAConnectionManagerImpl:: allocateConnection :system exception due to %s", ex); return conn.getConnection(subject, reqInfo);
@Test public void testTemplateExecuteWithCreatorAndRecordFactoryNotSupported() throws ResourceException { ConnectionFactory connectionFactory = mock(ConnectionFactory.class); Connection connection = mock(Connection.class); Interaction interaction = mock(Interaction.class); Record inputRecord = mock(Record.class); final Record outputRecord = mock(Record.class); InteractionSpec interactionSpec = mock(InteractionSpec.class); given(connectionFactory.getConnection()).willReturn(connection); given(connectionFactory.getRecordFactory()).willThrow(new NotSupportedException("not supported")); given(connection.createInteraction()).willReturn(interaction); given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true); CciTemplate ct = new CciTemplate(connectionFactory); ct.setOutputRecordCreator(new RecordCreator() { @Override public Record createRecord(RecordFactory recordFactory) { assertTrue(recordFactory instanceof NotSupportedRecordFactory); return outputRecord; } }); ct.execute(interactionSpec, inputRecord); verify(interaction).execute(interactionSpec, inputRecord, outputRecord); verify(interaction).close(); verify(connection).close(); }
public void associateConnection(Object connection) throws ResourceException { if (connection == null) { throw new ResourceException("Null connection handle"); } if (!(connection instanceof JcaExecutorServiceConnectionImpl)) { throw new ResourceException("Wrong connection handle"); } this.connection = (JcaExecutorServiceConnectionImpl) connection; }
/** * Creates a new connection for the managed connection pool. * * @return the managed connection from the EIS as ManagedConnection object. */ @Override public Object getNewPoolConnection() throws PoolException { ManagedConnection manConn = null; try { manConn = connFactory.createManagedConnection(sub, connReqInfo); } catch (ResourceException rex) { rex.printStackTrace(); throw new PoolException( "ManagedPoolCacheImpl::getNewConnection: Exception in creating new Managed PooledConnection", rex); } manConn .addConnectionEventListener((javax.resource.spi.ConnectionEventListener) connEventListner); return manConn; }
/** * Destroys the underline physical connection to EIS. * * @param connectionObject connection Object. */ @Override void destroyPooledConnection(Object connectionObject) { try { ((ManagedConnection) connectionObject) .removeConnectionEventListener((ConnectionEventListener) connEventListner); ((ManagedConnection) connectionObject).destroy(); connectionObject = null; } catch (ResourceException rex) { if (logger.isTraceEnabled()) { logger.trace( "ManagedPoolcacheImpl::destroyPooledConnection:Exception in closing the connection.Ignoring it. The exeption is {}", rex.getMessage(), rex); } } } }
throws ResourceException { if (!isActive) { throw new ResourceException( "FacetsJCAConnectionManagerImpl::allocateConnection::No valid Connection available"); } catch (PoolException ex) { ex.printStackTrace(); throw new ResourceException( String.format( "FacetsJCAConnectionManagerImpl:: allocateConnection : in getting connection from pool due to %s", XAResource xar = conn.getXAResource(); txn.enlistResource(xar); java.util.List resList = (List) xalistThreadLocal.get(); "FacetsJCAConnectionManagerImpl:: An Exception was caught while allocating a connection due to %s", ex.getMessage()); throw new ResourceException(exception, ex); } catch (SystemException ex) { throw new ResourceException( String.format( "FacetsJCAConnectionManagerImpl:: allocateConnection :system exception due to %s", ex); return conn.getConnection(subject, reqInfo);
@Override public Connection getConnection(ConnectionSpec connectionSpec) throws ResourceException { throw new NotSupportedException( "SingleConnectionFactory does not support custom ConnectionSpec"); }
public Object createConnectionFactory() throws ResourceException { throw new ResourceException("This resource adapter doesn't support non-managed environments"); }
((javax.resource.Referenceable)ao).setReference(new Reference(jndi));
@Override public IndexedRecord createIndexedRecord(String name) throws ResourceException { throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); }
((javax.resource.Referenceable)cf).setReference(new Reference(jndi));
@Override public MappedRecord createMappedRecord(String name) throws ResourceException { throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); }
@Override public Connection getConnection(ConnectionSpec connectionSpec) throws ResourceException { throw new NotSupportedException( "SingleConnectionFactory does not support custom ConnectionSpec"); }
/** * This implementation always throws a NotSupportedException. */ @Override public void endpointActivation(MessageEndpointFactory messageEndpointFactory, ActivationSpec activationSpec) throws ResourceException { throw new NotSupportedException("SpringContextResourceAdapter does not support message endpoints"); }
@Override public MappedRecord createMappedRecord(String name) throws ResourceException { throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); }
@Override public IndexedRecord createIndexedRecord(String name) throws ResourceException { throw new NotSupportedException("The RecordFactory facility is not supported by the connector"); }
/** * Set the transaction timeout value for a imported transaction. * * @param timeout transaction timeout value in seconds. Only positive * non-zero values are accepted. Other values are illegal and are * rejected with a <code>NotSupportedException</code>. * * @throws NotSupportedException thrown to indicate an illegal timeout * value. */ public void setTransactionTimeout(long timeout) throws NotSupportedException { if (timeout > 0) { this.transactionTimeout = timeout; } else { throw new NotSupportedException("Illegal timeout value"); } }