Package javax.resource.cci

Examples of javax.resource.cci.MappedRecord


        return builder.parse(is);
    }

    @Override
    protected String extractString(MappedRecordBindingData binding) throws Exception {
        MappedRecord content = binding.getRecord();
        return String.class.cast(content.get(KEY));
    }
View Full Code Here


        _composer = getMessageComposer(MappedRecordBindingData.class);
    }
   
    @Override
    public Message handle(Exchange exchange, Connection conn, Interaction interact) throws Exception {
        MappedRecord record = getRecordFactory().createMappedRecord(MappedRecordHandler.class.getName());
        MappedRecord outRecord = (MappedRecord) interact.execute(getInteractionSpec(), getMessageComposer(MappedRecordBindingData.class).decompose(exchange, new MappedRecordBindingData(record)).getRecord());
        return _composer.compose(new MappedRecordBindingData(outRecord), exchange);
    }
View Full Code Here

    }
   
    @Override
    public Record onMessage(Record record) {
        SynchronousInOutHandler inOutHandler = new SynchronousInOutHandler();
        MappedRecord sourceRecord = MappedRecord.class.cast(record);
        try {
            MappedRecordBindingData bindingData = new MappedRecordBindingData(sourceRecord);
            String operation = _selector != null ? _selector.selectOperation(bindingData).getLocalPart() : null;
            Exchange exchange = createExchange(operation, inOutHandler);
            exchange.send(_composer.compose(bindingData, exchange));

            exchange = inOutHandler.waitForOut(_waitTimeout);
            MappedRecord returnRecord = _recordFactory.createMappedRecord(_recordName);
            returnRecord.setRecordShortDescription(_description);
            return _composer.decompose(exchange, new MappedRecordBindingData(returnRecord)).getRecord();
        } catch (Exception e) {
            throw new SwitchYardException(e);
        }
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    @Override
    public void mapFrom(MappedRecordBindingData source, Context context) throws Exception {
        MappedRecord record = source.getRecord();
        String recordName = record.getRecordName();
        if (recordName != null) {
            context.setProperty(JCAConstants.CCI_RECORD_NAME_KEY, recordName).addLabels(MAPPED_RECORD_LABELS);
        }
        String recordDescription = record.getRecordShortDescription();
        if (recordDescription != null) {
            context.setProperty(JCAConstants.CCI_RECORD_SHORT_DESC_KEY, recordDescription).addLabels(MAPPED_RECORD_LABELS);
        }
    }
View Full Code Here

     * {@inheritDoc}
     */
    @SuppressWarnings("unchecked")
    @Override
    public void mapTo(Context context, MappedRecordBindingData target) throws Exception {
        MappedRecord record = target.getRecord();
        for (Property property : context.getProperties()) {
            String name = property.getName();
            Object value = property.getValue();
            if (value == null) {
                continue;
            }
            if (name.equals(JCAConstants.CCI_RECORD_NAME_KEY)) {
                record.setRecordName(value.toString());
            } else if (name.equals(JCAConstants.CCI_RECORD_SHORT_DESC_KEY)) {
                record.setRecordShortDescription(value.toString());
            } else if (matches(name)) {
                record.put(name, value);
            }
        }
    }
View Full Code Here

  @Test
  public void testCreateMappedRecord() throws ResourceException {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    RecordFactory recordFactory = mock(RecordFactory.class);
    MappedRecord mappedRecord = mock(MappedRecord.class);

    given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
    given(recordFactory.createMappedRecord("name")).willReturn(mappedRecord);

    CciTemplate ct = new CciTemplate(connectionFactory);
View Full Code Here

TOP

Related Classes of javax.resource.cci.MappedRecord

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.