Class OperatorArtifactManager


  • public class OperatorArtifactManager
    extends Object
    Manages an operator's artifacts.

    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:

    • Invokes registerArtifactNotifier() to register an artifact notifier for each type of artifact used by the operator. An operator receives its artifacts via its artifact notifiers.
    • Invokes 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.

    Since:
    10.2
    • Method Detail

      • registerArtifactNotifier

        public ArtifactNotifier registerArtifactNotifier​(String artifactType,
                                                         ArtifactNotifier notifier)
        Add an artifact notifier for the specified artifact type.

        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.

        Parameters:
        artifactType - Artifact type. Must be a valid AMS artifact type identifier.
        notifier - Operator's artifact notifier for the artifact type
        Returns:
        the previously installed artifact notifier for the operator and artifact type or null if no notifier was previously installed.
        See Also:
        ArtifactNotifier
      • unregisterArtifactNotifier

        public ArtifactNotifier unregisterArtifactNotifier​(String artifactType)
        Clears the operator's artifact notifier for the specified artifact type

        Unregister automatically occurs when the JVM shutdowns.

        Parameters:
        artifactType - Artifact type
        Returns:
        the previously installed artifact notifier for the operator and artifact type or null if no notifier was previously installed.
      • registerForArtifact

        public void registerForArtifact​(ArtifactDescriptor artifactDescriptor)
                                 throws ArtifactException
        Registers the operator to receive the specified artifact from the Artifact Management Server (AMS).

        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.

        Parameters:
        artifactDescriptor - Description of the artifact
        Throws:
        ArtifactException - 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.
        See Also:
        ArtifactDescriptor, ArtifactNotifier
      • unregisterForArtifact

        public void unregisterForArtifact​(ArtifactDescriptor artifactDescriptor)
        Unregisters the operator from the specified artifact

        No action is taken if the operator is not registered the artifact.

        Unregister automatically occurs when the JVM shutdowns.

        Parameters:
        artifactDescriptor - Description of the artifact