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



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

10.6@ComponentName


The following Java code defines the @ComponentName 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 java.lang.annotation.Retention;

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

@Retention(RUNTIME)

public @interface ComponentName {
}

The @ComponentName annotation is used to denote a Java class field or setter method that is used to inject the component name.

The following snippet shows a component name field definition sample.

@ComponentName

private String componentName;

The following snippet shows a component name setter method sample.


@ComponentName

public void setComponentName(String name) {

//…

}

10.7@Confidentiality


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



public @interface Confidentiality {

String CONFIDENTIALITY = SCA_PREFIX + "confidentiality";

String CONFIDENTIALITY_MESSAGE = CONFIDENTIALITY + ".message";

String CONFIDENTIALITY_TRANSPORT = CONFIDENTIALITY + ".transport";


/**

* List of confidentiality qualifiers such as "message" or

* "transport".

*

* @return confidentiality qualifiers



*/

@Qualifier

String[] value() default "";

}

The @Confidentiality annotation is used to indicate the need for confidentiality. 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.8@Constructor


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

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

import java.lang.annotation.Retention;

import java.lang.annotation.Target;
@Target(CONSTRUCTOR)

@Retention(RUNTIME)



public @interface Constructor { }

The @Constructor annotation is used to mark a particular constructor to use when instantiating a Java component implementation. If a constructor of an implementation class is annotated with @Constructor and the constructor has parameters, each of these parameters MUST have either a @Property annotation or a @Reference annotation. [JCA90003]

The following snippet shows a sample for the @Constructor annotation.

public class HelloServiceImpl implements HelloService {

      public HelloServiceImpl(){
   ...
   }

   @Constructor


   public HelloServiceImpl(@Property(name="someProperty")
String someProperty ){
   ...
   }

        public String hello(String message) {


                ...
     }
}

10.9@Context


The following Java code defines the @Context 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.RetentionPolicy.RUNTIME;

import java.lang.annotation.Retention;

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

@Retention(RUNTIME)

public @interface Context {



}

The @Context annotation is used to denote a Java class field or a setter method that is used to inject a composite context for the component. The type of context to be injected is defined by the type of the Java class field or type of the setter method input argument; the type is either ComponentContext or RequestContext.

The @Context annotation has no attributes.

The following snippet shows a ComponentContext field definition sample.



@Context

protected ComponentContext context;

The following snippet shows a RequestContext field definition sample.



@Context

protected RequestContext context;

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   ...   11   12   13   14   15   16   17   18   ...   25




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

    Main page