Interface ResourceTypeMeta<R>

Type Parameters:
R - The type that represents this class's config, usually an immutable record class that is naturally Gson-serializable.
All Known Implementing Classes:
DefaultResourceTypeMeta

public interface ResourceTypeMeta<R>
A ResourceTypeMeta provides metadata and performs delegate actions that pertain to a particular type of configuration resource.
  • Method Details

    • getResourceType

      ResourceType getResourceType()
      Returns:
      The type of the resource that this meta is for
    • getPreferredCollection

      default String getPreferredCollection()
      The collection name of the preferred storage location for this resource type. In other words, if a user creates a new instance of this resource, which collection should it be stored in by default?

      Typically, this should be either ConfigurationManager.CORE if the resource should be roaming (the default behavior) or ConfigurationManager.LOCAL if the resource is host-local.

    • getResourceCategoryName

      String getResourceCategoryName(Locale locale)
      A human-friendly name for the resources of this type. For example, "Database Connections" or "Devices"
    • getResourceDisplayName

      default String getResourceDisplayName(ResourceId id, Locale locale)
      A human-friendly name for this resource.
    • getIconPath

      default Optional<String> getIconPath(@Nullable ResourceId resource)
      Relative URL to an icon for this resource, e.g. "/res/my-module/resource.png".
      Parameters:
      resource - The resource to get the icon for, or null to get a generic icon for this resource type.
    • isSingleton

      default boolean isSingleton()
      Returns:
      true if this resource type represents a singleton resource. Default is false.
    • isExtensionPoint

      default boolean isExtensionPoint()
      Returns:
      true if this resource type represents an extension point. Default is false.
    • getPath

      @Nonnull default ResourcePath getPath(@Nullable String name)
      Returns the ResourcePath for a resource of this type. If the resource type is a singleton, the name parameter is ignored and must be null. If the resource is not a singleton, the name parameter is required.
    • getExtensionPointCollection

      default Optional<ExtensionPointCollection<?>> getExtensionPointCollection()
      Returns:
      the ExtensionPointCollection that contains all the extension points of this type, if this resource type is an extension point. Otherwise, return an empty optional.
    • getStatusDelegate

      default ResourceStatusDelegate getStatusDelegate()
      Returns:
      the ResourceStatusDelegate that can be used to obtain healthchecks and metrics for this resource type and instances of this resource type.
    • getDefaultConfig

      default Optional<R> getDefaultConfig()
      Returns:
      A copy of the resource config object that should be used as the default or prototype for this resource. In other words, it would contain the default or initial settings for a new resource of this type.
    • getCodec

      ResourceCodec<R> getCodec()
      Get the ResourceCodec that can be used to encode and decode resources of this type.

      If this ResourceTypeMeta provides a ResourceRouteDelegate this codec must be a subclass of JsonResourceCodec.

      Returns:
      The ResourceCodec that can be used to encode and decode resources of this type between their serialized Resource form, and the configuration object form represented by <R>
    • getResourceActionSet

      default ResourceActionSet getResourceActionSet()
      Returns a special pseudo-set declaring how to perform various actions for this resource type. This is a meta-capability that can be consumed by downstream sources - at present, the REST API and scripting, via the system.config namespace.
      See Also:
    • getRouteDelegate

      default Optional<ResourceRouteDelegate<R>> getRouteDelegate()
      Returns:
      the ResourceRouteDelegate that is used to generate routes for this resource type. If this method returns an empty optional, no routes will be generated for this resource type.
    • getScriptDelegate

      default Optional<ResourceScriptDelegate> getScriptDelegate()
      Returns:
      the ResourceScriptDelegate that is used to define and handle scripting functions for this resource type. If this method returns an empty optional, no scripting implementations will be available for this type.
    • getReferenceDelegate

      default ResourceReferenceDelegate<R> getReferenceDelegate()
      Returns:
      the ResourceReferenceDelegate that is used to define and handle references to other resources from this resource type. By default, no references to other resources are defined.
    • getEntityDelegate

      default ResourceEntityDelegate getEntityDelegate()
      Returns:
      the ResourceEntityDelegate that is used to generate entities for this resource type.
    • getAuditDelegate

      default ResourceAuditDelegate getAuditDelegate()
      Returns:
      The ResourceAuditDelegate that is used to define and handle auditing events for this resource type.
    • newBuilder

      static <T> DefaultResourceTypeMeta.Builder<T> newBuilder(Class<T> recordType)
      Creates a new builder for standard (named or singleton) resources. You must set the resource type, and you may also configure:
      Parameters:
      recordType - The type of the record class that represents the configuration of this resource.
      Returns:
      a new DefaultResourceTypeMeta.Builder.
    • newExtensionPointBuilder

      static <T extends ExtensionPointProfileConfig> DefaultResourceTypeMeta.ExtensionPointBuilder<T> newExtensionPointBuilder(Class<T> recordType)
      Creates a new builder for extension point resources.
      Parameters:
      recordType - the record class used for the extension point profile config.
      Returns:
      a new DefaultResourceTypeMeta.ExtensionPointBuilder.