Class SnapshotResource


  • @Component
    @Path("/snapshot")
    public class SnapshotResource
    extends Object
    Defines the REST resource layer for interacting with the Snapshot processing engine.
    Author:
    Daniel Bernstein Date: Feb 4, 2014
    • Constructor Summary

      Constructors 
      Constructor Description
      SnapshotResource​(org.duracloud.snapshot.service.SnapshotJobManager jobManager, org.duracloud.snapshot.service.SnapshotManager snapshotManager, org.duracloud.snapshot.db.repo.SnapshotRepo snapshotRepo, org.duracloud.snapshot.db.repo.SnapshotContentItemRepo snapshotContentItemRepo, org.duracloud.snapshot.service.EventLog eventLog, org.duracloud.snapshot.service.impl.StoreClientHelper storeClientHelper)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      javax.ws.rs.core.Response cancel​(String snapshotId)  
      javax.ws.rs.core.Response complete​(String snapshotId, org.duracloud.snapshot.dto.bridge.CompleteSnapshotBridgeParameters params)
      Notifies the bridge that the snapshot transfer from the bridge storage to the preservation storage is complete.
      javax.ws.rs.core.Response create​(String snapshotId, org.duracloud.snapshot.dto.bridge.CreateSnapshotBridgeParameters params)  
      javax.ws.rs.core.Response error​(String snapshotId, org.duracloud.snapshot.dto.bridge.SnapshotErrorBridgeParameters params)
      Notifies the bridge that the snapshot process is not able to continue due to an error which cannot be resolved by the system processing the snapshot data.
      javax.ws.rs.core.Response getContent​(String snapshotId, Integer page, Integer pageSize, String prefix)  
      javax.ws.rs.core.Response getHistory​(String snapshotId, Integer page, Integer pageSize)  
      javax.ws.rs.core.Response getSnapshot​(String snapshotId)  
      javax.ws.rs.core.Response list​(String host, String storeId, org.duracloud.snapshot.dto.SnapshotStatus status)
      Returns a list of snapshots.
      protected List<org.duracloud.snapshot.db.model.Snapshot> listSnapshots​(String host, String storeId, org.duracloud.snapshot.dto.SnapshotStatus status)  
      javax.ws.rs.core.Response restart​(String snapshotId)  
      javax.ws.rs.core.Response updateHistory​(String snapshotId, org.duracloud.snapshot.dto.bridge.UpdateSnapshotHistoryBridgeParameters params)
      Updates a snapshot's history
    • Constructor Detail

      • SnapshotResource

        @Autowired
        public SnapshotResource​(org.duracloud.snapshot.service.SnapshotJobManager jobManager,
                                org.duracloud.snapshot.service.SnapshotManager snapshotManager,
                                org.duracloud.snapshot.db.repo.SnapshotRepo snapshotRepo,
                                org.duracloud.snapshot.db.repo.SnapshotContentItemRepo snapshotContentItemRepo,
                                org.duracloud.snapshot.service.EventLog eventLog,
                                org.duracloud.snapshot.service.impl.StoreClientHelper storeClientHelper)
    • Method Detail

      • list

        @GET
        @Produces("application/json")
        public javax.ws.rs.core.Response list​(@QueryParam("host")
                                              String host,
                                              @QueryParam("storeId")
                                              String storeId,
                                              @QueryParam("status")
                                              org.duracloud.snapshot.dto.SnapshotStatus status)
        Returns a list of snapshots.
        Returns:
      • listSnapshots

        protected List<org.duracloud.snapshot.db.model.Snapshot> listSnapshots​(String host,
                                                                               String storeId,
                                                                               org.duracloud.snapshot.dto.SnapshotStatus status)
      • getSnapshot

        @Path("{snapshotId}")
        @GET
        @Produces("application/json")
        public javax.ws.rs.core.Response getSnapshot​(@PathParam("snapshotId")
                                                     String snapshotId)
      • restart

        @Path("{snapshotId}/restart")
        @POST
        @Produces("application/json")
        public javax.ws.rs.core.Response restart​(@PathParam("snapshotId")
                                                 String snapshotId)
      • cancel

        @Path("{snapshotId}/cancel")
        @POST
        @Produces("application/json")
        public javax.ws.rs.core.Response cancel​(@PathParam("snapshotId")
                                                String snapshotId)
                                         throws org.duracloud.snapshot.SnapshotException
        Throws:
        org.duracloud.snapshot.SnapshotException
      • create

        @Path("{snapshotId}")
        @PUT
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response create​(@PathParam("snapshotId")
                                                String snapshotId,
                                                org.duracloud.snapshot.dto.bridge.CreateSnapshotBridgeParameters params)
      • complete

        @Path("{snapshotId}/complete")
        @POST
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response complete​(@PathParam("snapshotId")
                                                  String snapshotId,
                                                  org.duracloud.snapshot.dto.bridge.CompleteSnapshotBridgeParameters params)
        Notifies the bridge that the snapshot transfer from the bridge storage to the preservation storage is complete. Also sets a snapshot's alternate id's if they are passed in.
        Parameters:
        snapshotId -
        params -
        Returns:
      • error

        @Path("{snapshotId}/error")
        @POST
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response error​(@PathParam("snapshotId")
                                               String snapshotId,
                                               org.duracloud.snapshot.dto.bridge.SnapshotErrorBridgeParameters params)
        Notifies the bridge that the snapshot process is not able to continue due to an error which cannot be resolved by the system processing the snapshot data.
        Parameters:
        snapshotId -
        params -
        Returns:
      • getContent

        @Path("{snapshotId}/content")
        @GET
        @Produces("application/json")
        public javax.ws.rs.core.Response getContent​(@PathParam("snapshotId")
                                                    String snapshotId,
                                                    @QueryParam("page")
                                                    Integer page,
                                                    @QueryParam("pageSize")
                                                    Integer pageSize,
                                                    @QueryParam("prefix")
                                                    String prefix)
      • getHistory

        @Path("{snapshotId}/history")
        @GET
        @Produces("application/json")
        public javax.ws.rs.core.Response getHistory​(@PathParam("snapshotId")
                                                    String snapshotId,
                                                    @QueryParam("page")
                                                    Integer page,
                                                    @QueryParam("pageSize")
                                                    Integer pageSize)
      • updateHistory

        @Path("{snapshotId}/history")
        @POST
        @Consumes("application/json")
        @Produces("application/json")
        public javax.ws.rs.core.Response updateHistory​(@PathParam("snapshotId")
                                                       String snapshotId,
                                                       org.duracloud.snapshot.dto.bridge.UpdateSnapshotHistoryBridgeParameters params)
        Updates a snapshot's history
        Parameters:
        snapshotId - - a snapshot's ID or it's alternate ID
        params - - JSON object that contains the history String and a Boolean of whether this request is using a snapshot's ID or an alternate ID
        Returns: