Class MCRPacker

java.lang.Object
org.mycore.services.packaging.MCRPacker
Direct Known Subclasses:
MCRTransferPackagePacker

public abstract class MCRPacker extends Object
Base class for every Packer. You should implement pack() and rollback(). The will be initialized two times. One time to just call checkSetup() and one time to pack()
  • Field Details

  • Constructor Details

    • MCRPacker

      public MCRPacker()
  • Method Details

    • checkSetup

      public abstract void checkSetup() throws MCRUsageException, MCRAccessException
      should check if all required parameters are set!
      Throws:
      MCRUsageException - if parameters are illegal
      MCRAccessException - if the Users doesn't have the rights to use the Packer
    • pack

      public abstract void pack() throws ExecutionException
      This method will be called and the MCRPacker should start packing according to the getConfiguration() and getParameters()!
      WARNING: do all checks for parameters and user access in checkSetup(), because the packer is already stored in the DB if pack is called and the pack JOB runs a System-User instead of the User who produces the call.
      Throws:
      ExecutionException - Unable to pack
    • rollback

      public abstract void rollback()
      This method can be called in case of error and the MCRPacker should clean up trash from pack()
    • getConfiguration

      protected final Map<String,String> getConfiguration()
      Returns:
      a unmodifiable map with all properties (MCR.Packaging.Packer.MyPackerID. prefix will be removed from key) of this packer-id.
    • getParameters

      protected final Map<String,String> getParameters()
      Returns:
      a unmodifiable map with parameters of a specific MCRPackerJobAction.