Class SchedulerRestService

java.lang.Object
org.opencastproject.scheduler.endpoint.SchedulerRestService

@Path("/recordings") public class SchedulerRestService extends Object
REST Endpoint for Scheduler Service
  • Field Details

    • serverUrl

      protected String serverUrl
    • serviceUrl

      protected String serviceUrl
  • Constructor Details

    • SchedulerRestService

      public SchedulerRestService()
  • Method Details

    • setService

      public void setService(SchedulerService service)
      Method to set the service this REST endpoint uses
      Parameters:
      service -
    • unsetService

      public void unsetService(SchedulerService service)
      Method to unset the service this REST endpoint uses
      Parameters:
      service -
    • setProlongingService

      public void setProlongingService(CaptureNowProlongingService prolongingService)
      Method to set the prolonging service this REST endpoint uses
      Parameters:
      prolongingService -
    • unsetProlongingService

      public void unsetProlongingService(CaptureNowProlongingService prolongingService)
      Method to unset the prolonging service this REST endpoint uses
      Parameters:
      prolongingService -
    • setCaptureAgentStateService

      public void setCaptureAgentStateService(CaptureAgentStateService agentService)
      Method to set the capture agent state service this REST endpoint uses
      Parameters:
      agentService -
    • unsetCaptureAgentStateService

      public void unsetCaptureAgentStateService(CaptureAgentStateService agentService)
      Method to unset the capture agent state service this REST endpoint uses
      Parameters:
      agentService -
    • setWorkspace

      public void setWorkspace(Workspace workspace)
      Method to set the workspace this REST endpoint uses
      Parameters:
      workspace -
    • activate

      public void activate(org.osgi.service.component.ComponentContext cc)
      The method that will be called, if the service will be activated
      Parameters:
      cc - The ComponentContext of this service
    • getMediaPackageXml

      @GET @Produces("text/xml") @Path("{id:.+}/mediapackage.xml") public javax.ws.rs.core.Response getMediaPackageXml(@PathParam("id") String eventId) throws UnauthorizedException
      Gets a XML with the media package for the specified event.
      Parameters:
      eventId - The unique ID of the event.
      Returns:
      media package XML for the event
      Throws:
      UnauthorizedException
    • getDublinCoreMetadataXml

      @GET @Produces("text/xml") @Path("{id:.+}/dublincore.xml") public javax.ws.rs.core.Response getDublinCoreMetadataXml(@PathParam("id") String eventId) throws UnauthorizedException
      Gets a XML with the Dublin Core metadata for the specified event.
      Parameters:
      eventId - The unique ID of the event.
      Returns:
      Dublin Core XML for the event
      Throws:
      UnauthorizedException
    • getDublinCoreMetadataJSON

      @GET @Produces("application/json") @Path("{id:.+}/dublincore.json") public javax.ws.rs.core.Response getDublinCoreMetadataJSON(@PathParam("id") String eventId) throws UnauthorizedException
      Gets a Dublin Core metadata for the specified event as JSON.
      Parameters:
      eventId - The unique ID of the event.
      Returns:
      Dublin Core JSON for the event
      Throws:
      UnauthorizedException
    • getTechnicalMetadataJSON

      @GET @Produces("text/xml") @Path("{id:.+}/technical.json") public javax.ws.rs.core.Response getTechnicalMetadataJSON(@PathParam("id") String eventId) throws UnauthorizedException
      Gets a XML with the media package for the specified event.
      Parameters:
      eventId - The unique ID of the event.
      Returns:
      media package XML for the event
      Throws:
      UnauthorizedException
    • getWorkflowConfiguration

      @GET @Produces("text/plain") @Path("{id:.+}/workflow.properties") public javax.ws.rs.core.Response getWorkflowConfiguration(@PathParam("id") String eventId) throws UnauthorizedException
      Gets the workflow configuration for the specified event.
      Parameters:
      eventId - The unique ID of the event.
      Returns:
      the workflow configuration
      Throws:
      UnauthorizedException
    • getCaptureAgentMetadata

      @GET @Produces("text/plain") @Path("{id:.+}/agent.properties") public javax.ws.rs.core.Response getCaptureAgentMetadata(@PathParam("id") String eventId) throws UnauthorizedException
      Gets java Properties file with technical metadata for the specified event.
      Parameters:
      eventId - The unique ID of the event.
      Returns:
      Java Properties File with the metadata for the event
      Throws:
      UnauthorizedException
    • deleteEvent

      @DELETE @Path("{id:.+}") @Produces("text/plain") public javax.ws.rs.core.Response deleteEvent(@PathParam("id") String eventId) throws UnauthorizedException
      Removes the specified event. Returns true if the event was found and could be removed.
      Parameters:
      eventId - The unique ID of the event.
      Returns:
      true if the event was found and could be deleted.
      Throws:
      UnauthorizedException
    • getCalendar

      @GET @Produces("text/calendar") @Path("calendars") public javax.ws.rs.core.Response getCalendar(@QueryParam("agentid") String captureAgentId, @QueryParam("seriesid") String seriesId, @QueryParam("cutoff") Long cutoff, @Context javax.servlet.http.HttpServletRequest request)
      Gets the iCalendar with all (even old) events for the specified filter.
      Parameters:
      captureAgentId - The ID that specifies the capture agent.
      seriesId - The ID that specifies series.
      Returns:
      an iCalendar
    • getCalendarJson

      @GET @Produces("application/json") @Path("calendar.json") public javax.ws.rs.core.Response getCalendarJson(@QueryParam("agentid") String captureAgentId, @QueryParam("cutoff") Long cutoff, @QueryParam("timestamp") Boolean timestamp, @Context javax.servlet.http.HttpServletRequest request)
    • getLastModified

      @GET @Produces("text/plain") @Path("{id}/lastmodified") public javax.ws.rs.core.Response getLastModified(@PathParam("id") String agentId)
    • removeOldScheduledRecordings

      @POST @Path("/removeOldScheduledRecordings") public javax.ws.rs.core.Response removeOldScheduledRecordings(@FormParam("buffer") long buffer) throws UnauthorizedException
      Throws:
      UnauthorizedException
    • addEvent

      @POST @Path("/") public javax.ws.rs.core.Response addEvent(@FormParam("start") long startTime, @FormParam("end") long endTime, @FormParam("agent") String agentId, @FormParam("users") String users, @FormParam("mediaPackage") String mediaPackageXml, @FormParam("wfproperties") String workflowProperties, @FormParam("agentparameters") String agentParameters, @FormParam("source") String schedulingSource) throws UnauthorizedException
      Creates new event based on parameters. All times and dates are in milliseconds.
      Throws:
      UnauthorizedException
    • addMultipleEvents

      @POST @Path("/multiple") public javax.ws.rs.core.Response addMultipleEvents(@FormParam("rrule") String rruleString, @FormParam("start") long startTime, @FormParam("end") long endTime, @FormParam("duration") long duration, @FormParam("tz") String tzString, @FormParam("agent") String agentId, @FormParam("users") String users, @FormParam("templateMp") MediaPackage templateMp, @FormParam("wfproperties") String workflowProperties, @FormParam("agentparameters") String agentParameters, @FormParam("source") String schedulingSource) throws UnauthorizedException
      Creates new event based on parameters. All times and dates are in milliseconds.
      Throws:
      UnauthorizedException
    • updateEvent

      @PUT @Path("{id}") public javax.ws.rs.core.Response updateEvent(@PathParam("id") String eventID, @FormParam("start") Long startTime, @FormParam("end") Long endTime, @FormParam("agent") String agentId, @FormParam("users") String users, @FormParam("mediaPackage") String mediaPackageXml, @FormParam("wfproperties") String workflowProperties, @FormParam("agentparameters") String agentParameters) throws UnauthorizedException
      Throws:
      UnauthorizedException
    • currentRecording

      @GET @Path("currentRecording/{agent}") @Produces("text/xml") public javax.ws.rs.core.Response currentRecording(@PathParam("agent") String agentId) throws UnauthorizedException
      Throws:
      UnauthorizedException
    • upcomingRecording

      @GET @Path("upcomingRecording/{agent}") @Produces("text/xml") public javax.ws.rs.core.Response upcomingRecording(@PathParam("agent") String agentId) throws UnauthorizedException
      Throws:
      UnauthorizedException
    • eventCount

      @GET @Path("eventCount") @Produces("text/plain") public javax.ws.rs.core.Response eventCount() throws UnauthorizedException
      Throws:
      UnauthorizedException
    • getEventsAsList

      @GET @Produces({"application/xml","application/json"}) @Path("recordings.{type:xml|json}") public javax.ws.rs.core.Response getEventsAsList(@PathParam("type") String type, @QueryParam("agent") String device, @QueryParam("startsfrom") Long startsFromTime, @QueryParam("startsto") Long startsToTime, @QueryParam("endsfrom") Long endsFromTime, @QueryParam("endsto") Long endsToTime) throws UnauthorizedException
      Throws:
      UnauthorizedException
    • getConflictingEventsJson

      @GET @Produces("application/json") @Path("conflicts.json") public javax.ws.rs.core.Response getConflictingEventsJson(@QueryParam("agent") String device, @QueryParam("rrule") String rrule, @QueryParam("start") Long startDate, @QueryParam("end") Long endDate, @QueryParam("duration") Long duration, @QueryParam("timezone") String timezone) throws UnauthorizedException
      Throws:
      UnauthorizedException
    • getConflicts

      @GET @Produces({"application/xml","application/json"}) @Path("conflicts.{type:xml|json}") public javax.ws.rs.core.Response getConflicts(@PathParam("type") String type, @QueryParam("agent") String device, @QueryParam("rrule") String rrule, @QueryParam("start") Long startDate, @QueryParam("end") Long endDate, @QueryParam("duration") Long duration, @QueryParam("timezone") String timezone) throws UnauthorizedException
      Throws:
      UnauthorizedException
    • updateRecordingState

      @PUT @Path("{id}/recordingStatus") public javax.ws.rs.core.Response updateRecordingState(@PathParam("id") String id, @FormParam("state") String state) throws NotFoundException
      Throws:
      NotFoundException
    • getRecordingState

      @GET @Produces("application/json") @Path("{id}/recordingStatus") public javax.ws.rs.core.Response getRecordingState(@PathParam("id") String id) throws NotFoundException
      Throws:
      NotFoundException
    • removeRecording

      @DELETE @Path("{id}/recordingStatus") public javax.ws.rs.core.Response removeRecording(@PathParam("id") String id) throws NotFoundException
      Throws:
      NotFoundException
    • getAllRecordings

      @GET @Produces("application/json") @Path("recordingStatus") public javax.ws.rs.core.Response getAllRecordings()
    • currentCapture

      @GET @Path("capture/{agent}") @Produces("application/json") public javax.ws.rs.core.Response currentCapture(@PathParam("agent") String agentId) throws NotFoundException
      Prolonging service
      Throws:
      NotFoundException
    • upcomingCapture

      @GET @Path("capture/{agent}/upcoming") @Produces("application/json") public javax.ws.rs.core.Response upcomingCapture(@PathParam("agent") String agentId) throws NotFoundException
      Throws:
      NotFoundException
    • startCapture

      @POST @Path("capture/{agent}") public javax.ws.rs.core.Response startCapture(@PathParam("agent") String agentId, @FormParam("workflowDefinitionId") String wfId) throws NotFoundException, UnauthorizedException
      Throws:
      NotFoundException
      UnauthorizedException
    • stopCapture

      @DELETE @Path("capture/{agent}") @Produces("text/plain") public javax.ws.rs.core.Response stopCapture(@PathParam("agent") String agentId) throws NotFoundException, UnauthorizedException
      Throws:
      NotFoundException
      UnauthorizedException
    • prolongCapture

      @PUT @Path("capture/{agent}/prolong") @Produces("text/plain") public javax.ws.rs.core.Response prolongCapture(@PathParam("agent") String agentId) throws NotFoundException, UnauthorizedException
      Throws:
      NotFoundException
      UnauthorizedException
    • getEventListAsJsonString

      public String getEventListAsJsonString(List<MediaPackage> mpList) throws SchedulerException
      Serializes mediapackage schedule metadata into JSON array string.
      Returns:
      serialized array as json array string
      Throws:
      SchedulerException - if parsing list into JSON format fails