The Java EE 6 Tutorial, Volume I

Example 3: @Activation Annotation

The following deployment descriptor snippet describes the messaging capabilities of a resource adapter:

<messageadapter>
<messagelistener>
<messagelistener-type>samples.mailra.api.JavaMailMessageListener</messagelistener-type>
<activationspec>
<activationspec-class>samples.mailra.ra.inbound.ActivationSpecImpl</activationspec-class>
required-config-property>
	<config-property-name>serverName</config-property-name>
</required-config-property>
<required-config-property>
	<config-property-name>userName</config-property-value>
</required-config-property>
<required-config-property>
	<config-property-name>password</config-property-value>
</required-config-property>
<required-config-property>
<config-property-name>folderName</config-property-value>
</required-config-property>
<required-config-property>
<description>Normally imap or pop3</description>
<config-property-name>protocol</config-property-name>
<config-property-value>IMAP</config-property-value>
</required-config-property>
</activationspec>
</messagelistener>
</messageadapter>

The equivalent metadata annotation is as follows:

@Activation(
        messageListeners = {samples.mailra.api.JavaMailMessageListener.class}

)
public class ActivationSpecImpl implements javax.resource.spi.ActivationSpec,
                                           java.io.Serializable
{
...
 @ConfigProperty()
    // serverName property value
    private String serverName = new String("");

    @ConfigProperty()
    // userName property value
    private String userName = new String("");

    @ConfigProperty()
    // password property value
    private String password = new String("");

    @ConfigProperty()
    // folderName property value
    private String folderName = new String("Inbox");

    // protocol property value
    // Normally imap or pop3
    @ConfigProperty(
            description = "Normally imap or pop3"
    )
    private String protocol = new String("imap");


...
...
}