| @@ -361,14 +361,13 @@ public abstract class Broadcast | |||
| job.startTime = now; | |||
| } | |||
| // Service the jobs | |||
| // But first get dependent resource | |||
| // which includes allocation from capacity. Only returns when the required allocation | |||
| // is obtained. Example, RTP port allocation, limit due to total number of allowable calls. | |||
| ServicePrerequisites prerequisites = secureServicePrerequisites(); | |||
| try | |||
| { | |||
| // Service the jobs | |||
| // But first get dependent resource | |||
| // which includes allocation from capacity. Only returns when the required allocation | |||
| // is obtained. Example, RTP port allocation, limit due to total number of allowable calls. | |||
| ServicePrerequisites prerequisites = secureServicePrerequisites(); | |||
| int transactions = processJobs(batch, serviceProviderPeer, prerequisites); | |||
| incrementTransactions(transactions); | |||
| } | |||
| @@ -538,6 +537,7 @@ public abstract class Broadcast | |||
| // Return regular or error response | |||
| String responseXML = getResponseXML(myException); | |||
| PrintWriter writer; | |||
| response.setContentType("application/xml;charset=UTF-8"); | |||
| try | |||
| { | |||
| writer = response.getWriter(); | |||
| @@ -646,8 +646,9 @@ public abstract class Broadcast | |||
| * Obtains the required components to support a service; e.g. RTP port, or a place | |||
| * in maximum total number of calls. Does not return till the reequired prerequisites are obtained. | |||
| * @return null, if no prerequisite is required, as in the case of email and sms engines. | |||
| * @throws Exception | |||
| */ | |||
| abstract protected ServicePrerequisites secureServicePrerequisites(); | |||
| abstract protected ServicePrerequisites secureServicePrerequisites() throws Exception; | |||
| abstract public void closeServiceProvider(Object serviceProvider); | |||
| @@ -386,53 +386,64 @@ public abstract class CommEngine extends HttpServlet | |||
| CommonLogger.alarm.error("Cannot write a reply: " + e); | |||
| return; | |||
| } | |||
| String get = (String)request.getParameter("get"); | |||
| if (get == null) | |||
| try | |||
| { | |||
| String get = (String)request.getParameter("get"); | |||
| if (get == null) | |||
| { | |||
| throw new Exception("No 'get' parameter in HTTP GET quierysring"); | |||
| } | |||
| if (get.equalsIgnoreCase("status")) | |||
| { | |||
| response.setContentType("application/xml"); | |||
| getStatus(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("cancel_broadcast")) | |||
| { | |||
| cancelBroadcast(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("pause_broadcast")) | |||
| { | |||
| pauseBroadcast(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("resume_broadcast")) | |||
| { | |||
| resumeBroadcast(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("configuration")) | |||
| { | |||
| getConfiguration(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("configure")) | |||
| { | |||
| configure(request, out); | |||
| } | |||
| else | |||
| { | |||
| out.write(get + " not supported"); | |||
| } | |||
| out.close(); | |||
| } | |||
| catch (Exception e) | |||
| { | |||
| myLogger.warn("While handling HTTP GETE: " + e.getMessage(), e); | |||
| // Return http status BAD REQUEST | |||
| int httpStatus = HttpServletResponse.SC_BAD_REQUEST; | |||
| try | |||
| { | |||
| response.sendError(httpStatus); | |||
| } | |||
| catch (IOException e) | |||
| catch (IOException e1) | |||
| { | |||
| myLogger.warn("Unnable to return HTTP error code " + httpStatus); | |||
| myLogger.warn("Unnable to return HTTP error code " + httpStatus, e1); | |||
| } | |||
| return; | |||
| } | |||
| if (get.equalsIgnoreCase("status")) | |||
| { | |||
| getStatus(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("cancel_broadcast")) | |||
| { | |||
| cancelBroadcast(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("pause_broadcast")) | |||
| { | |||
| pauseBroadcast(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("resume_broadcast")) | |||
| { | |||
| resumeBroadcast(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("configuration")) | |||
| { | |||
| getConfiguration(request, out); | |||
| } | |||
| else if (get.equalsIgnoreCase("configure")) | |||
| { | |||
| configure(request, out); | |||
| } | |||
| else | |||
| { | |||
| out.write(get + " not supported"); | |||
| } | |||
| out.close(); | |||
| } | |||
| /** | |||
| * | |||
| * | |||
| * Writes configuration in JSON string to out | |||
| * @param request | |||
| * @param out | |||
| @@ -23,7 +23,8 @@ import altk.common.engine.util.UTF8BenevolentDecoder; | |||
| public abstract class XMLSAXBroadcast extends Broadcast | |||
| { | |||
| protected String rootNodeName; | |||
| protected class BaseParserHandler extends DefaultHandler | |||
| { | |||
| /** | |||
| @@ -52,6 +53,7 @@ public abstract class XMLSAXBroadcast extends Broadcast | |||
| { | |||
| // Initialize characters to start collecting | |||
| characters = new StringBuffer(); | |||
| if (rootNodeName == null) rootNodeName = qName; | |||
| if (qName.equals("recipient")) | |||
| { | |||