Interaction (Java EE 5)

Java EE API


javax.resource.cci Interface Interaction


public interface Interaction


javax.resource.cci.Interaction 使组件能够执行 EIS 函数。Interaction 实例支持采用以下方式与 EIS 实例交互:
  • 带有输入 Record、输出 Record 和 InteractionSpec 的 execute 方法。此方法执行 InteractionSpec 表示的 EIS 函数并更新输出 Record
  • 带有输入 Record 和 InteractionSpec 的 execute 方法。此方法实现执行 InteractionSpec 表示的 EIS 函数并生成输出 Record 作为返回值。

Interaction 实例是从 Connection 创建的,需要维持与 Connection 实例的关联。close 方法释放 Interaction 的资源适配器维护的所有资源。关闭 Interaction 实例时不应该关闭关联的 Connection 实例。

英文文档:

The javax.resource.cci.Interaction enables a component to execute EIS functions. An Interaction instance supports the following ways of interacting with an EIS instance:

  • execute method that takes an input Record, output Record and an InteractionSpec. This method executes the EIS function represented by the InteractionSpec and updates the output Record
  • execute method that takes an input Record and an InteractionSpec. This method implementation executes the EIS function represented by the InteractionSpec and produces the output Record as a return value.

An Interaction instance is created from a Connection and is required to maintain its association with the Connection instance. The close method releases all resources maintained by the resource adapter for the Interaction. The close of an Interaction instance should not close the associated Connection instance.

Since:
0.8
Version:
0.8
Author:
Rahul Sharma
See Also:
ResultSet

Method Summary
 void
 void
 Record
 boolean
 Connection
 ResourceWarning
 

Method Detail

public void close() throws ResourceException
关闭当前 Interaction,释放资源适配器为此实例保留的所有资源。关闭 Interaction 实例时不关闭关联的 Connection 实例。建议显式关闭 Interaction 实例,以释放所有占用的资源。
ThrowsResourceException: 无法关闭 Interaction 实例。对已关闭的 Interaction 调用 close 也应该抛出该异常。
英文文档:

close

void close()
           throws ResourceException
Closes the current Interaction and release all the resources held for this instance by the resource adapter. The close of an Interaction instance does not close the associated Connection instance. It is recommended that Interaction instances be closed explicitly to free any held resources.

Throws:
ResourceException - Failed to close the Interaction instance. Invoking close on an already closed Interaction should also throw this exception.

public Connection getConnection()
获取与 Interaction 关联的 Connection。
return 与 Interaction 关联的 Connection 实例
英文文档:

getConnection

Connection getConnection()
Gets the Connection associated with the Interaction.

Returns:
Connection instance associated with the Interaction

public boolean execute(InteractionSpec ispec, Record input, Record output) throws ResourceException
执行 InteractionSpec 表示的交互。这种形式的调用获取输入 Record 并更新输出 Record。
ispec 表示目标 EIS 数据/函数模块的 InteractionSpec
input 输入 Record
output 输出 Record
return 如果成功执行了 EIS 函数并更新了输出 Record,则返回 true;否则返回 false
ThrowsResourceException: 如果执行操作失败,则抛出该异常。错误情况的示例有:
  • 资源适配器内部错误、特定于 EIS 的错误或者通信错误
  • 无效的 InteractionSpec、输入或输出记录结构规范
  • 使用输入或输出 Record 时出错
  • 与此 Interaction 关联的无效连接
ThrowsNotSupportedException: 不支持该操作
英文文档:

execute

boolean execute(InteractionSpec ispec,
                Record input,
                Record output)
                throws ResourceException
Executes an interaction represented by the InteractionSpec. This form of invocation takes an input Record and updates the output Record.

Parameters:
ispec - InteractionSpec representing a target EIS data/function module
input - Input Record
output - Output Record
Returns:
true if execution of the EIS function has been successful and output Record has been updated; false otherwise
Throws:
ResourceException - Exception if execute operation fails. Examples of error cases are:
  • Resource adapter internal, EIS-specific or communication error
  • Invalid specification of an InteractionSpec, input or output record structure
  • Errors in use of input or output Record
  • Invalid connection associated with this Interaction
NotSupportedException - Operation not supported

public Record execute(InteractionSpec ispec, Record input) throws ResourceException
执行 InteractionSpec 表示的交互。如果成功执行了 Interaction,则这种形式的调用获取输入 Record 并返回输出 Record。
ispec 表示目标 EIS 数据/函数模块的 InteractionSpec
input 输入 Record
return 如果成功执行了 EIS 函数,则返回输出 Record;否则返回 null
ThrowsResourceException: 如果执行操作失败,则抛出该异常。错误情况的示例有:
  • 资源适配器内部错误、特定于 EIS 的错误或者通信错误
  • 无效的 InteractionSpec 或输入记录结构规范
  • 使用输入 Record 或创建输出 Record 时出错
  • 与此 Interaction 关联的无效连接
ThrowsNotSupportedException: 不支持该操作
英文文档:

execute

Record execute(InteractionSpec ispec,
               Record input)
               throws ResourceException
Executes an interaction represented by the InteractionSpec. This form of invocation takes an input Record and returns an output Record if the execution of the Interaction has been successfull.

Parameters:
ispec - InteractionSpec representing a target EIS data/function module
input - Input Record
Returns:
output Record if execution of the EIS function has been successful; null otherwise
Throws:
ResourceException - Exception if execute operation fails. Examples of error cases are:
  • Resource adapter internal, EIS-specific or communication error
  • Invalid specification of an InteractionSpec or input record structure
  • Errors in use of input Record or creation of an output Record
  • Invalid connection associated with this Interaction
NotSupportedException - Operation not supported

public ResourceWarning getWarnings() throws ResourceException
获取与此 Interaction 实例关联的警告链中的第一个 ResourceWarning。
return 位于警告链顶部的 ResourceWarning
ThrowsResourceException: 无法获取与 Interaction 关联的 ResourceWarning
英文文档:

getWarnings

ResourceWarning getWarnings()
                            throws ResourceException
Gets the first ResourceWarning from the chain of warnings associated with this Interaction instance.

Returns:
ResourceWarning at top of the warning chain
Throws:
ResourceException - Failed to get ResourceWarnings associated with Interaction

public void clearWarnings() throws ResourceException
清除此 Interaction 实例报告的所有警告。调用此方法后,在为此 Interaction 报告新的警告之前,getWarnings 方法将一直返回 null。
ThrowsResourceException: 无法清除与 Interaction 关联的 ResourceWarning
英文文档:

clearWarnings

void clearWarnings()
                   throws ResourceException
Clears all the warning reported by this Interaction instance. After a call to this method, the method getWarnings will return null until a new warning is reported for this Interaction.

Throws:
ResourceException - Failed to clear ResourceWarnings associated with Interaction


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!