Metadata Annotations
Java EE Connector Architecture provides a set of annotations to minimize the need for deployment descriptors.
-
The
@Connectorannotation can be used by the resource adapter developer to specify that the JavaBeans component is a resource adapter JavaBeans component. This annotation is used for providing metadata about the capabilities of the resource adapter. Optionally, you can provide a JavaBeans component implementing theResourceAdapterinterface, as in the following example:@Connector( displayName = "TrafficResourceAdapter", vendorName = "Java EE Tutorial", version = "7.0" ) public class TrafficResourceAdapter implements ResourceAdapter, Serializable { ... } -
The
@ConnectionDefinitionannotation defines a set of connection interfaces and classes pertaining to a particular connection type, as in the following example:@ConnectionDefinition( connectionFactory = ConnectionFactory.class, connectionFactoryImpl = TradeConnectionFactory.class, connection = Connection.class, connectionImpl = TradeConnection.class ) public class TradeManagedConnectionFactory ... { ... } -
The
@AdministeredObjectannotation designates a JavaBeans component as an administered object. -
The
@Activationannotation contains configuration information pertaining to inbound connectivity from an EIS instance, as in the following example:@Activation( messageListeners = { TrafficListener.class } ) public class TrafficActivationSpec implements ActivationSpec, Serializable { ... @ConfigProperty() /* port to listen to requests from the EIS */ private String port; ... } -
The
@ConfigPropertyannotation can be used on JavaBeans components to provide additional configuration information that may be used by the deployer and resource adapter provider. The preceding example code shows several@ConfigPropertyannotations. -
The
@ConnectionFactoryDefinitionannotation is a resource definition annotation that is used to define a connector connection factory and register it in JNDI under the name specified in the mandatorynameannotation element. The mandatoryinterfaceNameannotation element specifies the fully qualified name of the connection factory interface class. ThetransactionSupportannotation element specifies the level of transaction support the connection factory needs to support. TheminPoolSizeandmaxPoolSizeannotation elements specify the minimum or maximum number of connections that should be allocated for a connection pool that backs this connection factory resource. Additional properties associated with the connection factory being defined can be specified through thepropertieselement.Since repeated annotations are not allowed, the
@ConnectionFactoryDefinitionsannotation acts as a container for multiple connector connection factory definitions. Thevalueannotation element contains the multiple connector connection factory definitions. -
The
@AdministeredObjectDefinitionannotation is a resource definition annotation that is used to define an administered object and register it in JNDI under the name specified in the mandatorynameannotation element. The mandatory fully qualified name of the administered object’s class must be indicated by theclassNameelement. Additional properties that must be configured in the administered object can be specified through thepropertieselement.Since repeated annotations are not allowed, the
@AdministeredObjectDefinitionsannotation acts as a container for multiple administered object definitions. Thevalueannotation element contains the multiple administered object definitions.
The specification allows a resource adapter to be developed in mixed-mode form, that is the ability for a resource adapter developer to use both metadata annotations and deployment descriptors in applications. An application assembler or deployer may use the deployment descriptor to override the metadata annotations specified by the resource adapter developer.
The deployment descriptor for a resource adapter, if present, is named
ra.xml. The metadata-complete attribute defines whether the
deployment descriptor for the resource adapter module is complete or
whether the class files available to the module and packaged with the
resource adapter need to be examined for annotations that specify
deployment information.
For the complete list of annotations and JavaBeans components provided in the Java EE platform, see the Java EE Connector Architecture 1.7 specification.