javax.resource.NotSupportedException Java Examples

The following examples show how to use javax.resource.NotSupportedException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuestionFactory.java    From gazpachoquest with GNU General Public License v3.0 6 votes vote down vote up
public QuestionComponent build(Integer questionnaireId, QuestionDTO questionDTO) throws NotSupportedException {
    AbstractQuestionComponent questionComponent = null;
    switch (questionDTO.getType()) {
    case S:
        questionComponent = question.select(ShortFreeTextQuestion.class).get();
        break;
    case F:
        throw new NotSupportedException("Question Type " + questionDTO.getType() + " not supported");
    case L:
        questionComponent = question.select(ListRadioQuestion.class).get();
        break;
    case M:
        questionComponent = question.select(CheckboxListQuestion.class).get();
        break;
    case N:
        questionComponent = question.select(NumericQuestion.class).get();
        break;
    case T:
        throw new NotSupportedException("Question Type " + questionDTO.getType() + " not supported");
    default:
        throw new NotSupportedException("Question Type " + questionDTO.getType() + " not supported");
    }
    questionComponent.setQuestionDTO(questionDTO);
    questionComponent.init();
    return questionComponent;
}
 
Example #2
Source File: LazyManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns an <code>javax.resource.spi.LocalTransaction</code> instance.
 *
 * @return LocalTransaction instance
 * @throws ResourceException generic exception if operation fails
 */
public LocalTransaction getLocalTransaction() throws ResourceException
{
   if (!localTransaction || xaTransaction)
   {
      throw new NotSupportedException("LocalTransaction not supported");
   }
   else
   {
      return lazyLocalTransaction;
   }
}
 
Example #3
Source File: SpringContextResourceAdapter.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * 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");
}
 
Example #4
Source File: CciTemplateTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@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();
}
 
Example #5
Source File: SpringContextResourceAdapter.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * 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");
}
 
Example #6
Source File: XAResourceRecoveryInflowImpl.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public XAResource[] getXAResources()
{
   try
   {
      XAResource[] result = resourceAdapter.getXAResources(new ActivationSpec[] {activationSpec});

      if (result == null || result.length == 0)
         return result;

      XAResource[] newResult = new XAResource[result.length];
      for (int i = 0; i < result.length; i++)
      {
         newResult[i] = new XAResourceWrapperImpl(result[i], productName, productVersion);
      }
      return newResult;
   }
   catch (NotSupportedException nse)
   {
      // Ignore
   }
   catch (ResourceException re)
   {
      log.exceptionDuringCrashRecoveryInflow(resourceAdapter.getClass().getName(), activationSpec, re);
   }

   return new XAResource[0];
}
 
Example #7
Source File: CciTemplateTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@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();
}
 
Example #8
Source File: SpringContextResourceAdapter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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");
}
 
Example #9
Source File: SpringContextResourceAdapter.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * 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");
}
 
Example #10
Source File: CciTemplateTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #11
Source File: QuestionnaireView.java    From gazpachoquest with GNU General Public License v3.0 5 votes vote down vote up
public void update(QuestionnairePageDTO page) {
    questionsLayout.removeAllComponents();

    List<SectionDTO> sections = page.getSections();

    for (SectionDTO sectionDTO : sections) {
        if (sectionInfoVisible && page.isSectionInfoAvailable()) {
            final Label sectionTile = new Label(sectionDTO.getLanguageSettings().getTitle());
            sectionTile.addStyleName(Reindeer.LABEL_H2);
            questionsLayout.addComponent(sectionTile);
        }
        List<QuestionDTO> questions = sectionDTO.getQuestions();
        for (QuestionDTO questionDTO : questions) {
            QuestionComponent questionComponent;
            try {
                questionComponent = QuestionFactory.build(questionnaireId, questionDTO);
                questionsLayout.addComponent(questionComponent);
            } catch (NotSupportedException e) {
                logger.warn(e.getMessage());
            }
        }

    }

    HorizontalLayout buttonsLayout = new HorizontalLayout();

    if (page.getMetadata().isNotFirst()) {
        previousButton.addClickListener(this);
        buttonsLayout.addComponent(previousButton);
    }

    if (page.getMetadata().isNotLast()) {
        nextButton.addClickListener(this);
        buttonsLayout.addComponent(nextButton);
    }
    questionsLayout.addComponent(buttonsLayout);
}
 
Example #12
Source File: XAResourceRecoveryInflowImpl.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public XAResource[] getXAResources()
{
   try
   {
      XAResource[] result = resourceAdapter.getXAResources(new ActivationSpec[] {activationSpec});

      if (result == null || result.length == 0)
         return result;

      XAResource[] newResult = new XAResource[result.length];
      for (int i = 0; i < result.length; i++)
      {
         newResult[i] = new XAResourceWrapperImpl(result[i], productName, productVersion);
      }
      return newResult;
   }
   catch (NotSupportedException nse)
   {
      // Ignore
   }
   catch (ResourceException re)
   {
      log.exceptionDuringCrashRecoveryInflow(resourceAdapter.getClass().getName(), activationSpec, re);
   }

   return new XAResource[0];
}
 
Example #13
Source File: ExecutionContext.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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");
   }
}
 
Example #14
Source File: LazyManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Returns an <code>javax.transaction.xa.XAresource</code> instance. 
 *
 * @return XAResource instance
 * @throws ResourceException generic exception if operation fails
 */
public XAResource getXAResource() throws ResourceException
{
   if (!xaTransaction || localTransaction)
   {
      throw new NotSupportedException("GetXAResource not supported not supported");
   }
   else
   {
      return lazyXAResource;
   }
}
 
Example #15
Source File: SampleManagedConnection.java    From tomee with Apache License 2.0 4 votes vote down vote up
public XAResource getXAResource() throws ResourceException {
    throw new NotSupportedException("getXAResource() not supported");
}
 
Example #16
Source File: NotSupportedRecordFactory.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public IndexedRecord createIndexedRecord(String name) throws ResourceException {
	throw new NotSupportedException("The RecordFactory facility is not supported by the connector");
}
 
Example #17
Source File: AutoConnectionTrackerTest.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public LocalTransaction getLocalTransaction() throws ResourceException {
    throw new NotSupportedException("getLocalTransaction() not supported");
}
 
Example #18
Source File: HelloWorldConnectionImpl.java    From ci.maven with Apache License 2.0 4 votes vote down vote up
/**
 * @see Connection#getResultSetInfo()
 */
public ResultSetInfo getResultSetInfo() throws ResourceException {

	throw new NotSupportedException(RESULT_SETS_NOT_SUPPORTED);
}
 
Example #19
Source File: SampleManagedConnection.java    From tomee with Apache License 2.0 4 votes vote down vote up
public LocalTransaction getLocalTransaction() throws ResourceException {
    throw new NotSupportedException("getLocalTransaction() not supported");
}
 
Example #20
Source File: HelloWorldConnectionImpl.java    From ci.maven with Apache License 2.0 4 votes vote down vote up
/**
 * @see Connection#getLocalTransaction()
 */
public LocalTransaction getLocalTransaction() throws ResourceException {

	throw new NotSupportedException(TRANSACTIONS_NOT_SUPPORTED);
}
 
Example #21
Source File: SampleManagedConnection.java    From tomee with Apache License 2.0 4 votes vote down vote up
public LocalTransaction getLocalTransaction() throws ResourceException {
    throw new NotSupportedException("getLocalTransaction() not supported");
}
 
Example #22
Source File: SampleManagedConnection.java    From tomee with Apache License 2.0 4 votes vote down vote up
public XAResource getXAResource() throws ResourceException {
    throw new NotSupportedException("getXAResource() not supported");
}
 
Example #23
Source File: SampleManagedConnection.java    From tomee with Apache License 2.0 4 votes vote down vote up
public LocalTransaction getLocalTransaction() throws ResourceException {
    throw new NotSupportedException("getLocalTransaction() not supported");
}
 
Example #24
Source File: HelloWorldRecordFactoryImpl.java    From ci.maven with Apache License 2.0 4 votes vote down vote up
/**
 * @see RecordFactory#createMappedRecord(String)
 */
public MappedRecord createMappedRecord(String recordName)
	throws ResourceException {

	throw new NotSupportedException(MAPPED_RECORD_NOT_SUPPORTED_ERROR);
}
 
Example #25
Source File: HelloWorldInteractionImpl.java    From ci.maven with Apache License 2.0 4 votes vote down vote up
/**
 * @see Interaction#execute(InteractionSpec, Record)
 */
public Record execute(InteractionSpec ispec, Record input)
	throws ResourceException {

	throw new NotSupportedException(EXECUTE_WITH_INPUT_RECORD_ONLY_NOT_SUPPORTED);
}
 
Example #26
Source File: TestManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public XAResource getXAResource() throws ResourceException
{
   throw new NotSupportedException("getXAResource() not supported");
}
 
Example #27
Source File: TestManagedConnection.java    From ironjacamar with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public LocalTransaction getLocalTransaction() throws ResourceException
{
   throw new NotSupportedException("getLocalTransaction() not supported");
}
 
Example #28
Source File: JcaExecutorServiceManagedConnection.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public LocalTransaction getLocalTransaction() throws ResourceException {
  throw new NotSupportedException("LocalTransaction not supported");
}
 
Example #29
Source File: JcaExecutorServiceManagedConnection.java    From camunda-bpm-platform with Apache License 2.0 4 votes vote down vote up
public XAResource getXAResource() throws ResourceException {
  throw new NotSupportedException("GetXAResource not supported not supported");
}
 
Example #30
Source File: HelloWorldManagedConnectionImpl.java    From ci.maven with Apache License 2.0 4 votes vote down vote up
/**
 * @see ManagedConnection#getLocalTransaction()
 */
public LocalTransaction getLocalTransaction() throws ResourceException {

	throw new NotSupportedException(TRANSACTIONS_NOT_SUPPORTED_ERROR);
}