12.11.2014 Views

web server - Borland Technical Publications

web server - Borland Technical Publications

web server - Borland Technical Publications

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Application development overview<br />

// Create an Interaction instance<br />

javax.resource.cci.Interaction ix = ct.createInteraction();<br />

// Create a new instance of the respective InteractionSpec<br />

com.shme.shmeAdapter.InteractionSpecImpl ixSpec = new<br />

com.shme.shmeAdapter.InteractionSpecImpl();<br />

ixSpec.setFunctionName( "S_EXEC" );<br />

ixSpec.setInteractionVerb( javax.resource.cci.InteractionSpec.SYNC_SEND_RECEIVE<br />

);<br />

// ...<br />

// Get a RecordFactory instance<br />

javax.resource.cci.RecordFactory recFactory = // ... get a RecordFactory<br />

// Create a generic MappedRecord using the RecordFactory instance. This record<br />

// instance acts as an input to the execution of an interaction. The name of<br />

the<br />

// Record acts as a pointer to the metadata for a specific record type<br />

javax.resource.cci.MappedRecord input = recFactory.createMappedRecord(<br />

"ShmeExecRecord" );<br />

// Populate the generic MappedRecord instance with input values. The component<br />

// code adds values based on the metadata it has accessed from the metadata<br />

// repository<br />

input.put( "", new String( "S_APP01" );<br />

input.put( "", // ... );<br />

// ...<br />

// Create a generic IndexedRecord to hold output values that are set by the<br />

// execution of the interaction<br />

javax.resource.cci.IndexedRecord output =<br />

recFactory.createIndexedRecord( "ShmeExecRecord" );<br />

// Execute the Interaction<br />

boolean response = ix.execute( ixSpec, input, output );<br />

// Extract data from the output IndexedRecord. Note that type mapping is done<br />

// in the generic IndexedRecord by mean of the type mapping information in the<br />

// metadata repository. Since the component uses generic methods on the<br />

// IndexedRecord, the component code performs the required type casting<br />

java.util.Iterator iter = output.iterator();<br />

while ( iter != null && iter.hasNext() )<br />

{<br />

// Get a record element and extract value ...<br />

}<br />

// Set up the requirements for the ResultSet returned by the execution of<br />

// an Interaction. This step is optional. Default values are used if<br />

// requirements are not explicitly set.<br />

com.shme.shmeAdapter.InteractionSpecImpl rsIxSpec =<br />

new com.shme.shmeAdapter.InteractionSpecImpl();<br />

rsIxSpec.setFetchSize( 20 );<br />

rsIxSpec,setResultSetType( javax.resource.cci.ResultSet.TYPE_SCROLL_INSENSITIVE<br />

);<br />

// Execute an Interaction that returns a ResultSet<br />

javax.resource.cci.ResultSet rSet =<br />

(javax.resource.cci.ResultSet)ix.execute( rsIxSpec, input );<br />

Chapter 27: Using VisiConnect 273

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!