本文整理汇总了Java中javax.resource.NotSupportedException类的典型用法代码示例。如果您正苦于以下问题:Java NotSupportedException类的具体用法?Java NotSupportedException怎么用?Java NotSupportedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
NotSupportedException类属于javax.resource包,在下文中一共展示了NotSupportedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: endpointActivation
import javax.resource.NotSupportedException; //导入依赖的package包/类
/**
* This is called during the activation of a message endpoint.
*
* @param endpointFactory
* A message endpoint factory instance.
* @param spec
* An activation spec JavaBean instance.
* @throws ResourceException
* generic exception
*/
public void endpointActivation(MessageEndpointFactory endpointFactory,
ActivationSpec spec) throws ResourceException {
if (!equals(spec.getResourceAdapter())) {
throw new ResourceException(
"Activation spec not initialized with this ResourceAdapter instance ("
+ spec.getResourceAdapter() + " != " + this + ")");
}
if (!(spec instanceof RabbitmqActivationSpec)) {
throw new NotSupportedException(
"That type of ActivationSpec not supported: "
+ spec.getClass());
}
RabbitmqActivation activation = new RabbitmqActivation(this,
(RabbitmqActivationSpec) spec, endpointFactory);
activations.put((RabbitmqActivationSpec) spec, activation);
activation.start();
log.tracef("endpointActivation(%s, %s)", endpointFactory, spec);
}
示例2: build
import javax.resource.NotSupportedException; //导入依赖的package包/类
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;
}
示例3: getXAResource
import javax.resource.NotSupportedException; //导入依赖的package包/类
/**
* Get the XAResource for the connection.
*
* @return The XAResource for the connection.
* @throws ResourceException XA transaction not supported
*/
public XAResource getXAResource() throws ResourceException {
//
// Spec says a mc must always return the same XA resource,
// so we cache it.
//
if (!xaTransacted) {
throw new NotSupportedException("Non XA transaction not supported");
}
if (xaResource == null) {
xaResource = xaSession.getXAResource();
}
if (log.isTraceEnabled()) {
log.trace("XAResource=" + xaResource);
}
xaResource = new JmsXAResource(this, xaResource);
return xaResource;
}
示例4: getXAResource
import javax.resource.NotSupportedException; //导入依赖的package包/类
@Override
public XAResource getXAResource() throws ResourceException {
if (xaResource == null) {
throw new NotSupportedException("XAResource not available");
}
return new XAResourceProxy();
}
示例5: endpointActivation
import javax.resource.NotSupportedException; //导入依赖的package包/类
/**
* 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");
}
示例6: getLocalTransaction
import javax.resource.NotSupportedException; //导入依赖的package包/类
public LocalTransaction getLocalTransaction() throws ResourceException {
// JCA 1.0, section 6.1.10
// both LocalTransaction and XATransaction resource adapters
// support local transactions
// At the same time all transactions will enlist at least Hibernate
// session and database connection, so support for local transactions
// is really redundant.
throw new NotSupportedException("LocalTransaction is not supported!");
}
示例7: testTemplateExecuteWithCreatorAndRecordFactoryNotSupported
import javax.resource.NotSupportedException; //导入依赖的package包/类
@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();
}
示例8: getLocalTransaction
import javax.resource.NotSupportedException; //导入依赖的package包/类
/**
* 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;
}
}
示例9: getXAResource
import javax.resource.NotSupportedException; //导入依赖的package包/类
/**
* 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;
}
}
示例10: setTransactionTimeout
import javax.resource.NotSupportedException; //导入依赖的package包/类
/**
* 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");
}
}
示例11: getXAResources
import javax.resource.NotSupportedException; //导入依赖的package包/类
/**
* {@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];
}
示例12: update
import javax.resource.NotSupportedException; //导入依赖的package包/类
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);
}
示例13: getConnection
import javax.resource.NotSupportedException; //导入依赖的package包/类
public Connection getConnection(ConnectionSpec spec) throws ResourceException {
if (!(spec instanceof WebDAVConnectionSpec)) {
throw new NotSupportedException("Need a WebDAVConnectionSpec to create a connection!");
}
System.out.println("Getting connection with spec "+spec);
return (Connection) cm.allocateConnection(mcf, (WebDAVConnectionSpec)spec);
}
示例14: createMappedRecord
import javax.resource.NotSupportedException; //导入依赖的package包/类
@Override
public MappedRecord createMappedRecord(String name) throws ResourceException {
throw new NotSupportedException("The RecordFactory facility is not supported by the connector");
}
示例15: createIndexedRecord
import javax.resource.NotSupportedException; //导入依赖的package包/类
@Override
public IndexedRecord createIndexedRecord(String name) throws ResourceException {
throw new NotSupportedException("The RecordFactory facility is not supported by the connector");
}