public class OperatorArtifactManager extends Object
Operators that require artifacts from the Artifact Management Server (AMS) use the
OperatorArtifactManager
interface to manage their artifacts.
Operators obtain an OperatorArtifactManager
instance using the
Operator.getArtifactManager()
method. The OperatorArtifactManager
instance returned manages artifacts for the operator that requested the instance.
To receive artifacts from AMS, an operator:
registerArtifactNotifier()
to register an artifact notifier for
each type of artifact used by the operator. An operator receives its artifacts via
its artifact notifiers.registerForArtifact()
for each artifact required by the operator.
Artifacts are uniquely identified by the artifact's type, name, and version. When an operator requests an artifact it must specify all three of these attributes. When specifying the artifact's version the operator can either request a specific version of the artifact or request the latest version of the artifact (as defined by AMS). Operators that request the latest version of the artifact receive updates (via its artifact notifier) whenever a new version of the artifact becomes the latest version.
Modifier and Type | Method and Description |
---|---|
ArtifactNotifier |
registerArtifactNotifier(String artifactType,
ArtifactNotifier notifier)
Add an artifact notifier for the specified artifact type.
|
void |
registerForArtifact(ArtifactDescriptor artifactDescriptor)
Registers the operator to receive the specified artifact from the Artifact Management Server (AMS).
|
ArtifactNotifier |
unregisterArtifactNotifier(String artifactType)
Clears the operator's artifact notifier for the specified artifact type
|
void |
unregisterForArtifact(ArtifactDescriptor artifactDescriptor)
Unregisters the operator from the specified artifact
|
public ArtifactNotifier registerArtifactNotifier(String artifactType, ArtifactNotifier notifier)
Methods in an artifact notifier are invoked when the operator's artifacts are received
from the Artifact Management Server (AMS). The operator can optionally use
the registerForAritfact()
method to request specific artifacts from AMS
though AMS can send artifacts to the operator whether or not the operator calls
registerForArtifact()
.
Operators can register notifiers for any number of artifact types. The same notifier instance can be used for multiple artifact types.
artifactType
- Artifact type. Must be a valid AMS artifact type identifier.notifier
- Operator's artifact notifier for the artifact typeArtifactNotifier
public ArtifactNotifier unregisterArtifactNotifier(String artifactType)
Unregister automatically occurs when the JVM shutdowns.
artifactType
- Artifact typepublic void registerForArtifact(ArtifactDescriptor artifactDescriptor) throws ArtifactException
This method is used to request an artifact from the AMS. Use an AritfactDescriptor
instance to describe the artifact. An artifact is described using its artifact type,
name, and version attributes. These attributes must be valid type, name, and version identifiers
on the AMS being used otherwise the operator never receives the artifact.
To request the latest version of an artifact set the version attribute to the value
ArtifactDescriptor.LATEST_VERSION
.
Operators receive the artifact via the artifact notifier installed with
registerArtifactNotifier()
. It is undefined whether the artifact notifier
is called before or after registerForArtifact()
returns. Use
ArtifactDescriptor.setRequiredAtStartup()
to specify whether or not the
operator requires the artifact to be available before the operator starts.
Operators that request the latest version of an artifact receive a notification whenever a new latest version of the artifact becomes available from AMS.
registerForArtifact()
must be called before the operator has started (i.e. the
operator must be in the runtime state of NOT_YET_STARTED
).
No action is taken if the operator has already registered for this artifact.
artifactDescriptor
- Description of the artifactArtifactException
- If an artifact notifier does not exist for the requested artifact or if
it is too late in the Operator's life cycle to register an artifact.ArtifactDescriptor
,
ArtifactNotifier
public void unregisterForArtifact(ArtifactDescriptor artifactDescriptor)
No action is taken if the operator is not registered the artifact.
Unregister automatically occurs when the JVM shutdowns.
artifactDescriptor
- Description of the artifactCopyright © 2015–2019 Cloud Software Group, Inc.. All rights reserved.