10.10@Destroy
The following Java code defines the @Destroy annotation:
package org.oasisopen.sca.annotation;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Target(METHOD)
@Retention(RUNTIME)
public @interface Destroy {
}
The @Destroy annotation is used to denote a single Java class method that will be called when the scope defined for the implementation class ends. A method annotated with @Destroy can have any access modifier and MUST have a void return type and no arguments. [JCA90004]
If there is a method annotated with @Destroy that matches the criteria for the annotation, the SCA runtime MUST call the annotated method when the scope defined for the implementation class ends. [JCA90005]
The following snippet shows a sample for a destroy method definition.
@Destroy
public void myDestroyMethod() {
…
}
10.11@EagerInit
The following Java code defines the @EagerInit annotation:
package org.oasisopen.sca.annotation;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Target(TYPE)
@Retention(RUNTIME)
public @interface EagerInit {
}
The @EagerInit annotation is used to mark the Java class of a COMPOSITE scoped implementation for eager initialization. When marked for eager initialization with an @EagerInit annotation, the composite scoped instance MUST be created when its containing component is started. [JCA90007]
10.12@Init
The following Java code defines the @Init annotation:
package org.oasisopen.sca.annotation;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Target(METHOD)
@Retention(RUNTIME)
public @interface Init {
}
The @Init annotation is used to denote a single Java class method that is called when the scope defined for the implementation class starts. A method marked with the @Init annotation can have any access modifier and MUST have a void return type and no arguments. [JCA90008]
If there is a method annotated with @Init that matches the criteria for the annotation, the SCA runtime MUST call the annotated method after all property and reference injection is complete. [JCA90009]
The following snippet shows an example of an init method definition.
@Init
public void myInitMethod() {
…
}
10.13@Integrity
The following Java code defines the @Integrity annotation:
package org.oasisopen.sca.annotation;
import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import static org.oasisopen.sca.Constants.SCA_PREFIX;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Inherited
@Target({TYPE, FIELD, METHOD, PARAMETER})
@Retention(RUNTIME)
@Intent(Integrity.INTEGRITY)
public @interface Integrity {
String INTEGRITY = SCA_PREFIX + "integrity";
String INTEGRITY_MESSAGE = INTEGRITY + ".message";
String INTEGRITY_TRANSPORT = INTEGRITY + ".transport";
/**
* List of integrity qualifiers (such as "message" or "transport").
*
* @return integrity qualifiers
*/
@Qualifier
String[] value() default "";
}
The @Integrity annotation is used to indicate that the invocation requires integrity (i.e. no tampering of the messages between client and service). See the SCA Policy Framework Specification [POLICY] for details on the meaning of the intent. See the section on Application of Intent Annotations for samples of how intent annotations are used in Java.
10.14@Intent
The following Java code defines the @Intent annotation:
package org.oasisopen.sca.annotation;
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Target({ANNOTATION_TYPE})
@Retention(RUNTIME)
public @interface Intent {
/**
* The qualified name of the intent, in the form defined by
* {@link javax.xml.namespace.QName#toString}.
* @return the qualified name of the intent
*/
String value() default "";
/**
* The XML namespace for the intent.
* @return the XML namespace for the intent
*/
String targetNamespace() default "";
/**
* The name of the intent within its namespace.
* @return name of the intent within its namespace
*/
String localPart() default "";
}
The @Intent annotation is used for the creation of new annotations for specific intents. It is not expected that the @Intent annotation will be used in application code.
See the section "How to Create Specific Intent Annotations" for details and samples of how to define new intent annotations.
Share with your friends: |