Service Component Architecture sca-j common Annotations and apis Specification Version 1 Committee Draft 03 – Rev1 + Issue 127



Download 0.81 Mb.
Page14/25
Date09.08.2017
Size0.81 Mb.
#29164
1   ...   10   11   12   13   14   15   16   17   ...   25

10.2@AsyncInvocation


The following Java code defines the @AsyncInvocation annotation:
package org.oasisopen.sca.annotation;
import static java.lang.annotation.ElementType.METHOD;

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, METHOD})

@Retention(RUNTIME)

@Intent(AsyncInvocation.ASYNCINVOCATION)



public @interface AsyncInvocation {

String ASYNCINVOCATION = SCA_PREFIX + "asyncInvocation";




boolean value() default true;

}

The @AsyncInvocation annotation is used to indicate that the operations of a Java interface uses the long-running request-response pattern as described in the SCA Assembly specification.


10.3@Authentication


The following Java code defines the @Authentication 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(Authentication.AUTHENTICATION)



public @interface Authentication {

String AUTHENTICATION = SCA_PREFIX + "authentication";

String AUTHENTICATION_MESSAGE = AUTHENTICATION + ".message";

String AUTHENTICATION_TRANSPORT = AUTHENTICATION + ".transport";


/**

* List of authentication qualifiers (such as "message"

* or "transport").

*

* @return authentication qualifiers



*/

@Qualifier

String[] value() default "";

}

The @Authentication annotation is used to indicate the need for authentication. 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.4@Authorization


The following Java code defines the @Authorization 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;
/**

* The @Authorization annotation is used to indicate that

* an authorization policy is required.

*/

@Inherited



@Target({TYPE, FIELD, METHOD, PARAMETER})

@Retention(RUNTIME)

@Intent(Authorization.AUTHORIZATION)

public @interface Authorization {

String AUTHORIZATION = SCA_PREFIX + "authorization";

}

The @Authorization annotation is used to indicate the need for an authorization policy. 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.5@Callback


The following Java code defines the @Callback 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.TYPE;

import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

import java.lang.annotation.Target;
@Target({TYPE, METHOD, FIELD})

@Retention(RUNTIME)

public @interface Callback {
Class value() default Void.class;

}

The @Callback annotation is used to annotate a service interface or to annotate a Java class (used to define an interface) with a callback interface by specifying the Java class object of the callback interface as an attribute.

The @Callback annotation has the following attribute:


The @Callback annotation can also be used to annotate a method or a field of an SCA implementation class, in order to have a callback object injected. When used to annotate a method or a field of an implementation class for injection of a callback object, the@Callback annotation MUST NOT specify any attributes. [JCA90046] When used to annotate a method or a field of an implementation class for injection of a callback object, the type of the method or field MUST be the callback interface of at least one bidirectional service offered by the implementation class. [JCA90054] When used to annotate a setter method or a field of an implementation class for injection of a callback object, the SCA runtime MUST inject a callback reference proxy into that method or field when the Java class is initialized, if the component is invoked via a service which has a callback interface and where the type of the setter method or field corresponds to the type of the callback interface. [JCA90058]

The @Callback annotation MUST NOT appear on a setter method or a field of a Java implementation class that has COMPOSITE scope. [JCA90057]

An example use of the @Callback annotation to declare a callback interface follows:

package somepackage;

import org.oasisopen.sca.annotation.Callback;
import org.oasisopen.sca.annotation.Remotable;

@Remotable

@Callback(MyServiceCallback.class)

public interface MyService {
void someMethod(String arg);

}
@Remotable



public interface MyServiceCallback {
void receiveResult(String result);

}

In this example, the implied component type is:



<componentType xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200903" >


<interface.java interface="somepackage.MyService"

callbackInterface="somepackage.MyServiceCallback"/>



componentType>


Directory: committees -> download.php
download.php -> Emergency Interoperability Consortium Membership Meeting
download.php -> Technical Communicators, Get ready: Here comes Augmented Reality! Rhonda Truitt
download.php -> Oasis set tc
download.php -> Iepd analyze Requirements Use Cases for edxl situation reporting messages Draft Version 4
download.php -> Technical Committee: oasis transformational Government Framework tc chair
download.php -> Ibops protocol Version 0 Working Draft 2 9 March 2015 Technical Committee
download.php -> Reliability of Messages Sent as Responses over an Underlying Request-response Protocol
download.php -> Scenario Two – Hurricane Warning
download.php -> Technical Committee: oasis augmented Reality in Information Products (arip) tc chairs
download.php -> This is intended as a Non-Standards Track Work Product. [Type the document title]

Download 0.81 Mb.

Share with your friends:
1   ...   10   11   12   13   14   15   16   17   ...   25




The database is protected by copyright ©ininet.org 2024
send message

    Main page