Metadata Annotations (original) (raw)

Java EE Connector Architecture provides a set of annotations to minimize the need for deployment descriptors.

@Connector(  
    displayName = "TrafficResourceAdapter",  
    vendorName = "Java EE Tutorial",  
    version = "7.0"  
)  
public class TrafficResourceAdapter implements ResourceAdapter,  
                                               Serializable {  
    ...  
}  
@ConnectionDefinition(  
    connectionFactory = ConnectionFactory.class,  
    connectionFactoryImpl = TradeConnectionFactory.class,  
    connection = Connection.class,  
    connectionImpl = TradeConnection.class  
)  
public class TradeManagedConnectionFactory ... {  
    ...  
}  
@Activation(  
        messageListeners = { TrafficListener.class }  
)  
public class TrafficActivationSpec implements ActivationSpec,  
                                              Serializable {  
    ...  
    @ConfigProperty()  
    /* port to listen to requests from the EIS */  
    private String port;  
    ...  
}  

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 namedra.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.