@Override public void onReceive(final Object message) throws Exception { boolean _equals = Objects.equal(message, Greeter.Msg.DONE); if (_equals) { this.log.info("DONE!"); UntypedActorContext _context = this.getContext(); ActorRef _self = this.getSelf(); _context.stop(_self); } else { boolean _equals_1 = Objects.equal(message, "me"); if (_equals_1) { this.log.info("hello,tung!"); this.unhandled(message); } else { this.unhandled(message); } } }
@Override public void onReceive(Object rawMessage) throws Exception { // log.info("Page got: "+rawMessage.getClass().getCanonicalName()); if (rawMessage instanceof ComponentMessage){ // log.info("Handelling Request"); Future<String> rendered = null; try { final ComponentMessage message = (ComponentMessage)rawMessage; rendered = future(new Callable<String>() { public String call() throws Exception { IWidget component = components.get(message.getRouteToken()).getConstructor(Map.class, ActorRef.class, UntypedActorContext.class).newInstance(routers, getSender(), context()); component.initialise(message.getParameters().toArray(new Object[0])); return build(component); } }, context().dispatcher()); } catch (Exception e){ rendered = Futures.failed(e); } akka.pattern.Patterns.pipe(rendered, this.getContext().dispatcher()).to(getSender()); } else { unhandled(rawMessage); } }
@Override public void onReceive(Object rawMessage) throws Exception { // log.info("Renderer got: "+rawMessage.getClass().getCanonicalName()); if (rawMessage instanceof RenderMessage){ RenderMessage message = (RenderMessage)rawMessage; //final ActorRef coordinatingActor, final UntypedActorContext actorContext Class<? extends IRenderer> renderer = renderers.get(message.getRenderer()); Constructor<? extends IRenderer> constr = renderer.getConstructor(Map.class, ActorRef.class, UntypedActorContext.class, VelocityEngine.class); IRenderer page = constr.newInstance(routers, getSender(), this.context(), engine); Future<String> rendered = null; if (message.getTemplateName() != null){ rendered = page.render(message.getTemplateName(), message.getContext()); } else { rendered = page.render(message.getContext()); } //log.info("Rendered: "+rendered); akka.pattern.Patterns.pipe(rendered, this.getContext().dispatcher()).to(getSender()); //getSender().tell(rendered, getSelf()); } else { unhandled(rawMessage); } }
@Override public void onReceive(Object rawMessage) throws Exception { // log.info("PersistanceHandler got: "+rawMessage.getClass().getCanonicalName()); if (rawMessage instanceof PersistanceMessage){ PersistanceMessage message = (PersistanceMessage)rawMessage; String task_name = message.getPersistanceTask(); Class<? extends IDataAccessor> calculationClass = persistanceTasks.get(task_name); Constructor<? extends IDataAccessor> constr = calculationClass.getConstructor(Map.class, ActorRef.class, UntypedActorContext.class, Connection.class); IDataAccessor persistor = constr.newInstance(routers, getSender(), this.context(), this.connection); Future<Object> result = (Future<Object>) persistor.performTask(message.getArgs().toArray(new Object[0]));//.calculate(message.getArgs().toArray(new Object[0])); //Pattern. akka.pattern.Patterns.pipe(result, this.getContext().dispatcher()).to(getSender()); // Map<String, ?> result = persistor.performTask(message.getArgs().toArray()); // getSender().tell(result, getSelf()); } else { unhandled(rawMessage); } }
@Override public void onReceive(Object rawMessage) throws Exception { // log.info("CalculationHandler got: "+rawMessage.getClass().getCanonicalName()); if (rawMessage instanceof CalculationMessage){ CalculationMessage message = (CalculationMessage)rawMessage; String task_name = message.getTaskName(); // log.info("CalculationHandler requested method task_name: "+task_name); Class<? extends ICalculation> calculationClass = calculations.get(task_name); Constructor<? extends ICalculation> constr = calculationClass.getConstructor(Map.class, ActorRef.class, UntypedActorContext.class); ICalculation calculation = constr.newInstance(routers, getSender(), this.context()); Future<Object> result = (Future<Object>) calculation.calculate(message.getArgs().toArray(new Object[0])); //Pattern. akka.pattern.Patterns.pipe(result, this.getContext().dispatcher()).to(getSender()); //getSender().tell(result, getSelf()); } else { unhandled(rawMessage); } }
private IPage loadPage(String path, String method, String query, Header[] headers, byte[] content) throws PageNotFoundException, InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { Map<String, String> parameters = new HashMap<String, String>(); for (PageRoute route: pages){ if (route.getTemplate().match(path, parameters)){ IPage page = route.getPageClass().getConstructor(Map.class, ActorRef.class, UntypedActorContext.class).newInstance(routers, getSender(), this.context()); page.initialise(path, method, query, headers, content, parameters ); return page; } } throw new PageNotFoundException(String.format("Page matching [%s] not found", path)); }
@Override public void onReceive(Object rawMessage) throws Exception { // log.info("TaskHandler got: "+rawMessage.getClass().getCanonicalName()); if (rawMessage instanceof TaskMessage){ TaskMessage message = (TaskMessage)rawMessage; String task_name = message.getTaskName(); Class<? extends ITask> taskClass = tasks.get(task_name); Constructor<? extends ITask> constr = taskClass.getConstructor(Map.class, ActorRef.class, UntypedActorContext.class); ITask task = constr.newInstance(routers, getSender(), this.context()); task.act(message.getArgs().toArray(new Object[0])); } else { unhandled(rawMessage); } }
public synchronized Optional<ActorRef> findActor(final UntypedActorContext context, final String path) { final ActorSelection sel = context.actorSelection(path); try { final Future<ActorRef> fut = sel.resolveOne(TIMEOUT); final ActorRef ref = Await.result(fut, TIMEOUT.duration()); LOG.debug("Actor [{}] is existing in context [{}], use this actor", path, context.system()); return Optional.of(ref); } catch (final Exception e) { LOG.debug("Actor [{}] is not existing or answering in context [{}]", path, context.system()); return Optional.empty(); } }
ShardTransactionActorFactory(ShardDataTree dataTree, DatastoreContext datastoreContext, String txnDispatcherPath, ActorRef shardActor, UntypedActorContext actorContext, ShardStats shardMBean, String shardName) { this.dataTree = Preconditions.checkNotNull(dataTree); this.datastoreContext = Preconditions.checkNotNull(datastoreContext); this.txnDispatcherPath = Preconditions.checkNotNull(txnDispatcherPath); this.shardMBean = Preconditions.checkNotNull(shardMBean); this.actorContext = Preconditions.checkNotNull(actorContext); this.shardActor = Preconditions.checkNotNull(shardActor); this.shardName = Preconditions.checkNotNull(shardName); }
@Override public void preStart() { UntypedActorContext _context = this.getContext(); Props _create = Props.create(Greeter.class); final ActorRef greeter = _context.actorOf(_create, "greeter"); ActorRef _self = this.getSelf(); greeter.tell(Greeter.Msg.GREET, _self); }
public FormParser(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); parsers.put("application/x-www-form-urlencoded", new FormEncoding()); parsers.put("application/json", new JsonEncoding()); //multipart/form-data }
public PersistanceBase(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext, Connection connection) { super(routers, coordinatingActor, actorContext); this.connection = connection; }
public ConcurrantCallable(final Map<Layers, ActorRef> routers, final ActorRef coordinatingActor, final UntypedActorContext actorContext){ this.coordinatingActor = coordinatingActor; setActorContext(actorContext); this.routers = routers; taskList = Collections.synchronizedList(new ArrayList<Future<Object>>()); awaitListeners = new CopyOnWriteArraySet<Promise<Object>>(); }
public RendererBase(final Map<Layers, ActorRef> routers, final ActorRef coordinatingActor, final UntypedActorContext actorContext, final VelocityEngine engine){ super(routers, coordinatingActor, actorContext); this.engine = engine; }
public AbstractTask(final UntypedActorContext parentContext) { checkNotNull(parentContext); this.parentContext = parentContext; }
public <T> AbstractTask(final TaskCallback<T> callback, final UntypedActorContext parentContext) { checkNotNull(callback); checkNotNull(parentContext); this.callback = callback; this.parentContext = parentContext; }
protected UntypedActorContext getParentContext() { if (parentContext == null) { throw new UnsupportedOperationException("Context of parent is not set"); } return parentContext; }
public void executeTask(final TaskAllocation task, final UntypedActorContext context, final Object msg) { final ActorRef taskActor = context.actorOf(springExtension.props(task.getActorName()), getTaskId()); taskActor.forward(msg, context); }
public <T> void executeTask(final TaskAllocation task, final UntypedActorContext context, final Object msg, final TaskCallback<T> callback) { final ActorRef taskActor = context.actorOf(springExtension.props(task.getActorName(), callback), getTaskId()); taskActor.forward(msg, context); }
public void executeTaskInContext(final TaskAllocation task, final UntypedActorContext context, final Object msg) { final ActorRef taskActor = context.actorOf(springExtension.props(task.getActorName(), context), getTaskId()); taskActor.forward(msg, context); }
public CancelTimeoutTask(final UntypedActorContext parentContext) { super(parentContext); }
public StartTimeoutTask(final UntypedActorContext parentContext) { super(parentContext); }
public SendMessagesTask(final UntypedActorContext parentContext) { super(parentContext); }
public ProcessInitializeTask(final UntypedActorContext parentContext) { super(parentContext); }
public CookieParser(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); }
public DefaultRenderer(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext, VelocityEngine engine) { super(routers, coordinatingActor, actorContext, engine); // TODO Auto-generated constructor stub }
public TaskBase(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); // TODO Auto-generated constructor stub }
public UntypedActorContext getActorContext() { return actorContext; }
public void setActorContext(UntypedActorContext context) { actorContext = context; }
public WidgetBase(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); }
public PageBase(final Map<Layers, ActorRef> routers, final ActorRef coordinatingActor, final UntypedActorContext actorContext){ super(routers, coordinatingActor, actorContext); }
public CalculationBase(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); }
public ProfilePage(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); }
public ProfileTask(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); }
public ProfileWidget(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); }
public ProfileCalculation(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext) { super(routers, coordinatingActor, actorContext); }
public ProfileRenderer(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext, VelocityEngine engine) { super(routers, coordinatingActor, actorContext, engine); }
public ProfileDataAccessor(Map<Layers, ActorRef> routers, ActorRef coordinatingActor, UntypedActorContext actorContext, Connection connection) { super(routers, coordinatingActor, actorContext, connection); // TODO Auto-generated constructor stub }