コード例 #1
0
 @Override
 public void execute(final Object message) throws Exception {
   if (logger.isInfoEnabled()) {
     logger.info("In Ready state");
   }
   // ussdCall.tell(new Answer(), source);
   // Execute the received RCML here
   final UntypedActorContext context = getContext();
   final State state = fsm.state();
   if (downloadingRcml.equals(state)
       || downloadingFallbackRcml.equals(state)
       || processingInfoRequest.equals(state)) {
     response = ((DownloaderResponse) message).get();
     if (parser != null) {
       context.stop(parser);
       parser = null;
     }
     final String type = response.getContentType();
     if (type.contains("text/xml")
         || type.contains("application/xml")
         || type.contains("text/html")) {
       parser = parser(response.getContentAsString());
     } else if (type.contains("text/plain")) {
       parser = parser("<UssdMessage>" + response.getContentAsString() + "</UssdMessage>");
     } else {
       final StopInterpreter stop = new StopInterpreter();
       source.tell(stop, source);
       return;
     }
   }
   final GetNextVerb next = GetNextVerb.instance();
   parser.tell(next, source);
 }
コード例 #2
0
  ActorRef parser(final String xml) {
    final UntypedActorContext context = getContext();
    return context.actorOf(
        new Props(
            new UntypedActorFactory() {
              private static final long serialVersionUID = 1L;

              @Override
              public UntypedActor create() throws Exception {
                return new Parser(xml, self());
              }
            }));
  }
コード例 #3
0
  ActorRef downloader() {
    final UntypedActorContext context = getContext();
    return context.actorOf(
        new Props(
            new UntypedActorFactory() {
              private static final long serialVersionUID = 1L;

              @Override
              public UntypedActor create() throws Exception {
                return new Downloader();
              }
            }));
  }
コード例 #4
0
  ActorRef mailer(final Configuration configuration) {
    final UntypedActorContext context = getContext();
    return context.actorOf(
        new Props(
            new UntypedActorFactory() {
              private static final long serialVersionUID = 1L;

              @Override
              public Actor create() throws Exception {
                return new EmailService(configuration);
              }
            }));
  }
コード例 #5
0
 @Override
 public ActorRef actorOf(Props props) {
   return context.actorOf(props);
 }
コード例 #6
0
 @Override
 public ActorSystem getActorSystem() {
   return context.system();
 }
コード例 #7
0
 @Override
 public ActorSelection actorSelection(String path) {
   return context.actorSelection(path);
 }