Class AbstractOperation

java.lang.Object
net.messagevortex.router.operation.AbstractOperation
All Implemented Interfaces:
Serializable, Operation
Direct Known Subclasses:
AddRedundancy, IdMapOperation, RemoveRedundancy

public abstract class AbstractOperation extends Object implements Operation, Serializable
See Also:
  • Constructor Details

    • AbstractOperation

      public AbstractOperation()
  • Method Details

    • setInternalPayload

      public void setInternalPayload(InternalPayloadSpace payload)

      Puts a payload int the workspace.

      Specified by:
      setInternalPayload in interface Operation
      Parameters:
      payload - the internal payload of an identity to be registered within its workspace
    • canRun

      public abstract boolean canRun()
      Description copied from interface: Operation

      Checks if all prerequisiting fields do exist or can be provided by a subsequent operation.

      Specified by:
      canRun in interface Operation
      Returns:
      true if all prerequisits can potentially be satisfied
    • getIdentity

      public IdentityBlock getIdentity()
      Specified by:
      getIdentity in interface Operation
    • getUsagePeriod

      public UsagePeriod getUsagePeriod()
    • setUsagePeriod

      public UsagePeriod setUsagePeriod(UsagePeriod period)

      Sets the usage period of the respective operation.

      After expiry the accounting layer will remove this operation

      Parameters:
      period - the usage period in which the operation is valid
      Returns:
      the previously set usage period
    • isInUsagePeriod

      public boolean isInUsagePeriod()

      Checks if the operation is within its usage period.

      This method is called by the accounting layer when searching for expired operations.

      Specified by:
      isInUsagePeriod in interface Operation
      Returns:
      true if the operation did not expire yet.
    • execute

      public abstract int[] execute(int[] id)
      Description copied from interface: Operation

      Executes the operation and sets at least the provided set of id.

      This operation might trigger to execute prerequisiting operations.

      Specified by:
      execute in interface Operation
      Parameters:
      id - the namespace id to be set minimally
      Returns:
      array representing all ids which have been set