Annotations

Annotations are used to designate classes that require credential information and to indicate which fields of the class are to be assigned (injected) credential data. The system infrastructure injects credential data into class fields as necessary to allow the extension access to credentials when needed. For example, a component runtime class will have credential data injected before each execute() cycle with credentials for the user associated with that particular execution.

@Privileged annotation

The @Privileged annotation can be applied only to a class definition, and it must be applied to the class named in the metamodel XML descriptor. For example, it cannot be on a superclass or any other class directly or indirectly loaded from the metamodel JAR file. This annotation has no arguments.

If a class does not have this annotation, any other privilege-related annotations in the class (such as @CredentialServiceReference) are ignored.

@CredentialServiceReference annotation

The @CredentialServiceReference annotation can be applied only to fields in a class that has the @Privileged annotation. It can be used only on class fields, not on local variables. Class fields with this annotation must be non-static, private, transient, and be of the type com.engineous.sdk.security.CredentialService. These requirements are checked at runtime; violations will not cause a compile-time error. It is not useful to have this annotation on more than one field in a class, but there is nothing that prevents such usage.

The @CredentialServiceReference annotation has no arguments. The field associated with this annotation will be set (injected) with a reference to a CredentialService object after the class is instantiated (constructor is called), but before any other methods are invoked on the class. The extension can use the CredentialService to obtain the various types of credentials that the service supports. The annotated field will always (after construction) have a valid, non-null reference to a CredentialService. However, that service will supply credentials only at specific times, depending on the type of extension (see the table below). If the service is called at a time when the credentials are not available—for example, if a component calls the service during its initialize() method—the service will throw a CredentialNotAvailableException.

Type

Method

Credentials Available?

Component

Constructor

initialize()

configEnvironment()

preExecute()

execute()

postExecute()

destroy()

No

No

Yes

Yes

Yes

Yes

No

ComponentEditor

All methods except constructor

Yes

Plug-in

initialize()

preExecute()

postExecute()

destroy()

Any method called by the parent component or component editor

No

Yes

Yes

No

Yes if calling method has credentials available; otherwise, no

DataHandler

getInputStream()

getOutputStream()

setResourceName()

getResourceName()

getFileSize()

All other methods

Yes

Yes

Yes

Yes

Yes

No

DataHandlerEditor

All methods except constructor

Yes