Package com.inductiveautomation.ignition.gateway.config.actions
Resource Configuration Actions
This package contains the interfaces and classes for defining resource configuration actions, which are what
equips a ResourceTypeMeta with the ability to perform
CRUD operations and more as defined in
ResourceAction. All ResourceTypeMetas by
default include all non validating
DefaultResourceActions by default, so in most cases
nothing is needed to be done on your part.
ResourceActions are responsible for doing all the necessary work for taking a request and saving it to the
configuration system. For example, creating a new resource like a Driver or Database connection and turning that
request into a Resource which is then saved in the
configuration system.
Defining these ResourceActions happens when defining the ResourceTypeMeta for your resource. via the
ResourceActionSet builder. This build is exposed
through the
DefaultResourceTypeMeta.Builder.buildActionSet(java.util.function.Consumer<com.inductiveautomation.ignition.gateway.config.actions.ResourceActionSet.Builder>)
method.
The default implementation handles all of this for you, leaning on that particular resource's
ResourceTypeMeta definition. With that being said, there are
typically three use cases for interacting with resource actions:
Preventing an Action
Preventing an action (for example, Rename) is as simple as
ResourceTypeMeta.newBuilder(MyResourceConfiguration.class)
.resourceType(MyResourceConfiguration.RESOURCE_TYPE)
.categoryNameKey("Resources.MyNewResource")
.buildActionSet(builder -> builder
.rename(null)
)
[...]
Performing Additional Validation
Sometimes you might want to validate the configuration or settings of the resource prior to saving it to the configuration system. For example, you might want to ensure that a resource's configuration has some unique field across all resources of the same type. In this case, you can use the validating actions on the actions, likeResourceActionSet.Builder.withValidatingCreate(java.util.function.Function<com.inductiveautomation.ignition.gateway.config.actions.DefaultResourceActions.CreateResources<R>, java.util.Optional<com.inductiveautomation.ignition.gateway.config.actions.ResourceAction.ValidationFailure>>)
ResourceTypeMeta.newBuilder(MyResourceConfiguration.class)
.resourceType(MyResourceConfiguration.RESOURCE_TYPE)
.categoryNameKey("Resources.MyNewResource")
.buildActionSet(builder -> builder
.renameValidate(resource -> validateFooField(resource))
)
[...]
Custom Implementation
This is typically not recommended as the Default actions should cover most use cases. However, if you need to you can implement the appropriateResourceAction
yourself. You can delegate to the default implementation using the
ResourceActionSet.DEFAULT implementations.
-
ClassDescriptionDefault implementations of each member of
ResourceAction, which provide the standard CRUD operations for a given resource type.The Default implementation of Copy.Not for direct useUsed internally by the Copy implementation for validation.The main wrapperDefaultResourceActions.ValidatingCopyprovides when validating a resource on copy.The Default implementation of Create.An object which wraps the necessary detailsDefaultResourceActions.ValidatingMoveprovides when validating a resource on Create.An object which wraps the necessary detailsDefaultResourceActions.ValidatingMoveprovides when validating resources on Create.The Default implementation of Modify.An object which wraps the necessary detailsDefaultResourceActions.ValidatingModifyprovides when validating a resource on Modify.An object which wraps the necessary detailsDefaultResourceActions.ValidatingModifyprovides when validating resources on Modify.The Default implementation of Move.Not for direct useUsed internally by the Move implementation for validation.An object which wraps the necessary detailsDefaultResourceActions.ValidatingMoveprovides when validating a resource on Move.The Default implementation of Rename.Not for direct useUsed internally by the Rename implementation for validation.An object which wraps the necessary detailsDefaultResourceActions.ValidatingRenameprovides when validating a resource on rename.Performs the default Copy operation but allows for validation of the resource prior to the resource being committed to the configuration system to be persisted.Performs the default Create operation but allows for validation of the resource prior to the resource being committed to the configuration system to be persisted.Performs the default Modify operation but allows for validation of the resource prior to the resource being committed to the configuration system to be persisted.Performs the default Move operation but allows for validation of the resource prior to the resource being committed to the configuration system to be persisted.Performs the default Rename operation but allows for validation of the resource prior to the resource being committed to the configuration system to be persisted.This sealed interface represents all supported resource "capabilities".An immutable collection ofResourceActions, with type-safe getters for easy consumption in subsystems.The response to aResourceActionthat does not affect anything outside this resource.The response to aResourceActionthat does affect other resources, such as when a resource is deleted, renamed, or otherwise modified in a way that requires other resources to be updated or references to be checked.