diff options
author | randomdan <randomdan@localhost> | 2014-03-12 22:57:57 +0000 |
---|---|---|
committer | randomdan <randomdan@localhost> | 2014-03-12 22:57:57 +0000 |
commit | 3960e9f61a53d930697cd2e6166b1adb15bf19a1 (patch) | |
tree | 4052196fb7aeb817a5ef4185a281765b9d102fb8 | |
parent | Add the p2pvr Ice <-> Project2 type converters (diff) | |
download | p2pvr-3960e9f61a53d930697cd2e6166b1adb15bf19a1.tar.bz2 p2pvr-3960e9f61a53d930697cd2e6166b1adb15bf19a1.tar.xz p2pvr-3960e9f61a53d930697cd2e6166b1adb15bf19a1.zip |
Expose more of the interface
Gracefully handle not found problems
-rw-r--r-- | p2pvr/ice/p2pvr.ice | 18 | ||||
-rw-r--r-- | p2pvr/lib/schedules.cpp | 1 | ||||
-rw-r--r-- | p2pvr/lib/si.cpp | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/p2pvr/ice/p2pvr.ice b/p2pvr/ice/p2pvr.ice index 61c0e32..bd79cb1 100644 --- a/p2pvr/ice/p2pvr.ice +++ b/p2pvr/ice/p2pvr.ice @@ -6,7 +6,11 @@ #include "dvbsi.ice" module P2PVR { + ["project2:type"] + exception NotFound { }; + // Something that we have recorded. + ["project2:type"] class Recording { int RecordingId; string StorageAddress; @@ -21,6 +25,7 @@ module P2PVR { sequence<Recording> RecordingList; // Something that defines what we would like to record. + ["project2:type"] class Schedule { int ScheduleId; optional(1) int ServiceId; @@ -35,6 +40,7 @@ module P2PVR { sequence<Schedule> ScheduleList; // Ids for something to record + ["project2:type"] class ScheduledToRecord { int ScheduleId; int ServiceId; @@ -51,6 +57,7 @@ module P2PVR { idempotent void UpdateEvents(short type); }; + ["project2:type"] exception StorageException { string path; string message; @@ -67,14 +74,18 @@ module P2PVR { idempotent int NewRecording(Recording rec); ["project2:task"] idempotent void DeleteRecording(int recordingId); + ["project2:rows"] idempotent RecordingList GetRecordings(); }; interface Schedules { ["project2:task"] idempotent void DeleteSchedule(int scheduleId); - idempotent Schedule GetSchedule(int scheduleId); + ["project2:rows"] + idempotent Schedule GetSchedule(int scheduleId) throws NotFound; + ["project2:rows"] idempotent ScheduleList GetSchedules(); + ["project2:rows"] idempotent ScheduledToRecordList GetScheduledToRecord(); idempotent int UpdateSchedule(Schedule newSchedule); ["project2:task"] @@ -92,10 +103,10 @@ module P2PVR { ["project2:rows"] idempotent DVBSI::ServiceList GetServices(); ["project2:rows"] - idempotent DVBSI::Service GetService(int id); + idempotent DVBSI::Service GetService(int id) throws NotFound; // Get events ["project2:rows"] - idempotent DVBSI::Event GetEvent(int serviceId, int eventId); + idempotent DVBSI::Event GetEvent(int serviceId, int eventId) throws NotFound; ["project2:rows"] idempotent DVBSI::Events EventsOnNow(); ["project2:rows"] @@ -103,6 +114,7 @@ module P2PVR { }; interface Recorder { + ["project2:task"] idempotent void RefreshSchedules(); }; }; diff --git a/p2pvr/lib/schedules.cpp b/p2pvr/lib/schedules.cpp index d13b231..99d4983 100644 --- a/p2pvr/lib/schedules.cpp +++ b/p2pvr/lib/schedules.cpp @@ -452,6 +452,7 @@ Schedules::GetSchedule(int id, const Ice::Current &) P2PVR::ScheduleList schedules; SqlContainerCreator<P2PVR::ScheduleList, P2PVR::Schedule> cct(schedules); cct.populate(Select(Schedules_selectById, id).second); + if (schedules.empty()) throw P2PVR::NotFound(); return schedules.front(); } diff --git a/p2pvr/lib/si.cpp b/p2pvr/lib/si.cpp index 5640fe8..b358f72 100644 --- a/p2pvr/lib/si.cpp +++ b/p2pvr/lib/si.cpp @@ -93,6 +93,7 @@ SI::GetService(int id, const Ice::Current&) DVBSI::ServiceList rtn; SqlContainerCreator<DVBSI::ServiceList, DVBSI::Service> cc(rtn); cc.populate(Select(SI_servicesSelectById, id).second); + if (rtn.empty()) throw P2PVR::NotFound(); return rtn.front(); } @@ -102,6 +103,7 @@ SI::GetEvent(int serviceId, int eventId, const Ice::Current &) DVBSI::Events rtn; SqlContainerCreator<DVBSI::Events, DVBSI::Event> cc(rtn); cc.populate(Select(SI_eventById, serviceId, eventId).second); + if (rtn.empty()) throw P2PVR::NotFound(); return rtn.front(); } |