Class AbstractExtensionPoint<S>

java.lang.Object
com.inductiveautomation.ignition.gateway.config.AbstractExtensionPoint<S>
All Implemented Interfaces:
ExtensionPoint<S>, Comparable<ExtensionPoint<S>>
Direct Known Subclasses:
AbstractEmailProfileExtensionPoint, AlarmNotificationProfileExtensionPoint, AuditProfileType, OpcConnectionExtensionPoint, ScheduleExtensionPoint, ServiceConnectorExtensionPoint, TagProviderExtensionPoint, UserSourceExtensionPoint

public abstract class AbstractExtensionPoint<S> extends Object implements ExtensionPoint<S>
  • Field Details

    • typeId

      protected final String typeId
    • nameKey

      protected final String nameKey
    • descriptionKey

      protected final String descriptionKey
    • gson

      protected final com.inductiveautomation.ignition.common.gson.Gson gson
    • validator

      protected final ResourceValidator<S> validator
  • Constructor Details

    • AbstractExtensionPoint

      protected AbstractExtensionPoint(String typeId, String nameKey, String descriptionKey)
  • Method Details

    • addReferenceProperty

      protected void addReferenceProperty(String propertyName, Consumer<ReferenceFinderBuilder<S>> build)
      Add a reference finder to this extension point. A reference finder is able to identify a reference stored in this extension point's settings object that references another named configuration resource. For example, supposed your extension point's settings object references a database connection. You could add a reference finder like this:
           addReferenceProperty("databaseConnection", ref -> ref
                   .targetType(DatasourceManager.DATABASE_CONNECTION_RESOURCE)
                   .match((settings, name) -> name.equals(settings.getDatabaseConnection()))
                   .onUpdate((settings, newName) -> settings.copyWithDatabaseConnection(newName))
               );
       
    • getReferenceFinders

      public Collection<ReferenceFinder<S>> getReferenceFinders(ResourceType type)
      Description copied from interface: ExtensionPoint
      Get the reference finders for this extension point. Reference finders are used to find properties within this extension point type's settings object that reference other resources. By finding these references, referential integrity can be maintained when resources are renamed or deleted.
      Specified by:
      getReferenceFinders in interface ExtensionPoint<S>
    • buildGson

      protected com.inductiveautomation.ignition.common.gson.Gson buildGson()
    • customizeGson

      protected void customizeGson(com.inductiveautomation.ignition.common.gson.GsonBuilder builder)
      Override this to customize the Gson instance used to encode/decode settings.
    • buildValidator

      protected ResourceValidator<S> buildValidator()
      Builds a validator for the extension point type's settings config object. Default implementation delegates to validate(Object, ValidationErrors.Builder), the intended target for implementations to override.
    • validate

      protected void validate(S settings, ValidationErrors.Builder errors)
      Provides an opportunity to validate the extension point type's settings config object. If any errors are added to the ValidationErrors.Builder, the settings object will be considered invalid and will be rejected.
    • getSettingsValidator

      public Optional<ResourceValidator<S>> getSettingsValidator()
      Description copied from interface: ExtensionPoint
      If present, will be used to further validate a settings object after ExtensionPoint.decode(JsonElement) succeeds.
      Specified by:
      getSettingsValidator in interface ExtensionPoint<S>
    • typeId

      public final String typeId()
      Description copied from interface: ExtensionPoint
      The unique type identifier for this extension point. Must be unique within the resource type.
      Specified by:
      typeId in interface ExtensionPoint<S>
    • name

      public String name(Locale locale)
      Description copied from interface: ExtensionPoint
      The human-readable name of this extension point.
      Specified by:
      name in interface ExtensionPoint<S>
    • description

      public String description(Locale locale)
      Description copied from interface: ExtensionPoint
      A description of this extension point.
      Specified by:
      description in interface ExtensionPoint<S>
    • decode

      public S decode(com.inductiveautomation.ignition.common.gson.JsonElement json) throws DecodingException
      Description copied from interface: ExtensionPoint
      Decode the settings object from the given JsonElement.
      Specified by:
      decode in interface ExtensionPoint<S>
      Parameters:
      json - the JsonElement to decode.
      Returns:
      the decoded settings object.
      Throws:
      DecodingException - if the settings object could not be decoded or this extension point does not have a settings type.
    • encode

      public com.inductiveautomation.ignition.common.gson.JsonElement encode(S settings)
      Description copied from interface: ExtensionPoint
      Encode the settings object to a JsonElement.
      Specified by:
      encode in interface ExtensionPoint<S>