Package org.agilewiki.jactor

Examples of org.agilewiki.jactor.Actor


     * @param rp           The response processor.
     * @throws Exception Any uncaught exceptions raised while performing the operation.
     */
    @Override
    final public void call(final SimpleMachine stateMachine, final RP rp) throws Exception {
        Actor a = getTargetActor(stateMachine);
        Request r = getRequest(stateMachine);
        stateMachine.send(a, r, new RP() {
            @Override
            final public void processResponse(Object response) throws Exception {
                String rn = getResultName();
View Full Code Here


     */
    final public RESPONSE_TYPE send(JAFuture future, Actor targetActor)
            throws Exception {
        if (isTargetType(targetActor))
            return (RESPONSE_TYPE) future.send(targetActor, this);
        Actor parent = targetActor.getParent();
        while (parent != null) {
            if (isTargetType(parent))
                return (RESPONSE_TYPE) future.send(parent, this);
            parent = parent.getParent();
        }
        throw new UnsupportedOperationException(
                "request: " + getClass().getName() +
                        " target actor: " + targetActor.getClass().getName());
    }
View Full Code Here

            throws Exception {
        if (isTargetType(targetActor)) {
            targetActor.acceptRequest(requestSource, this, rp);
            return;
        }
        Actor parent = targetActor.getParent();
        while (parent != null) {
            if (isTargetType(parent)) {
                parent.acceptRequest(requestSource, this, rp);
                return;
            }
            parent = parent.getParent();
        }
        throw new UnsupportedOperationException(
                "request: " + getClass().getName() +
                        " target actor: " + targetActor.getClass().getName());
    }
View Full Code Here

            throws Exception {
        if (isTargetType(targetActor)) {
            targetActor.acceptEvent(JAEvent.requestSource, this);
            return;
        }
        Actor parent = targetActor.getParent();
        if (parent != null) {
            if (isTargetType(parent)) {
                parent.acceptEvent(JAEvent.requestSource, this);
                return;
            }
            parent = parent.getParent();
        }
        throw new UnsupportedOperationException(
                "request: " + getClass().getName() +
                        " target actor: " + targetActor.getClass().getName());
    }
View Full Code Here

            throws Exception {
        if (isTargetType(targetActor)) {
            targetActor.acceptEvent(requestSource, this);
            return;
        }
        Actor parent = targetActor.getParent();
        if (parent != null) {
            if (isTargetType(parent)) {
                parent.acceptEvent(requestSource, this);
                return;
            }
            parent = parent.getParent();
        }
        throw new UnsupportedOperationException(
                "request: " + getClass().getName() +
                        " target actor: " + targetActor.getClass().getName());
    }
View Full Code Here

    @Override
    public Object getProperty(String propertyName)
            throws Exception {
        if (properties.containsKey(propertyName))
            return properties.get(propertyName);
        Actor targetActor = getParent();
        if (targetActor != null)
            targetActor = targetActor.getMatch(Properties.class);
        if (targetActor == null)
            return null;
        return ((Properties) targetActor).getProperty(propertyName);
    }
View Full Code Here

            parent = new JAFactory();
            ((JAFactory) parent).initialize(mailbox);
        }
        super.initialize(mailbox, parent, actorFactory);

        Actor f = parent;
        while (!(f instanceof JAFactory)) f = f.getParent();
        JAFactory factory = (JAFactory) f;

        factory.registerActorFactory(JidFactory.fac);

        factory.registerActorFactory(BooleanJidFactory.fac);
View Full Code Here

        MailboxFactory mailboxFactory = JAMailboxFactory.newMailboxFactory(1);
        try {
            JidFactories factory = new JidFactories();
            factory.initialize(mailboxFactory.createMailbox());
            JAFuture future = new JAFuture();
            Actor l0 = (new ListJidFactory(JidFactories.STRING_LIST_JID_TYPE, StringJidFactory.fac)).
                    newActor(factory.getMailbox(), factory);
            int l0sl = GetSerializedLength.req.send(future, l0);
            assertEquals(8, l0sl);
            Actor l1 = (new CopyJID()).send(future, l0);
            int l1sl = GetSerializedLength.req.send(future, l1);
            assertEquals(8, l1sl);
            (new IAdd(0)).send(future, l1);
            l1sl = GetSerializedLength.req.send(future, l1);
            assertEquals(12, l1sl);
            Actor l2 = (new CopyJID()).send(future, l1);
            int l2sl = GetSerializedLength.req.send(future, l2);
            assertEquals(12, l2sl);
            Actor s0 = StringJidFactory.fac.newActor(factory.getMailbox(), factory);
            (new SetString("Hi")).send(future, s0);
            int s0sl = GetSerializedLength.req.send(future, s0);
            assertEquals(8, s0sl);
            byte[] s0bs = GetSerializedBytes.req.send(future, s0);
            assertEquals(8, s0bs.length);
View Full Code Here

public class Blob extends StringMapJid implements Main {
    @Override
    public void processRequest(Proc request, RP rp) throws Exception {
        initializeList();
        ActorJid aj = (ActorJid) kGet("fun");
        Actor a = aj.getValue();
        Proc.req.send(this, a, rp);
    }
View Full Code Here

            JAFuture future = new JAFuture();
            JidFactories factory = new JidFactories();
            factory.initialize(mailboxFactory.createMailbox());

            ActorJidFactory actorJidAFactory = new ActorJidFactory();
            Actor jidJid1 = actorJidAFactory.newActor(factory.getMailbox(), factory);
            int sl = GetSerializedLength.req.send(future, jidJid1);
            assertEquals(4, sl);
            Clear.req.send(future, jidJid1);
            sl = GetSerializedLength.req.send(future, jidJid1);
            assertEquals(4, sl);
            Actor jidJid1a = GetActor.req.send(future, jidJid1);
            assertNull(jidJid1a);
            Actor rpa = (new ResolvePathname("")).send(future, jidJid1);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid1);
            rpa = (new ResolvePathname("0")).send(future, jidJid1);
            assertNull(rpa);
            Actor jidJid11 = (new CopyJID()).send(future, jidJid1);
            assertNotNull(jidJid11);
            sl = GetSerializedLength.req.send(future, jidJid11);
            assertEquals(4, sl);
            rpa = (new ResolvePathname("")).send(future, jidJid11);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid11);
            rpa = (new ResolvePathname("0")).send(future, jidJid11);
            assertNull(rpa);

            StringJidFactory stringJidAFactory = StringJidFactory.fac;
            Actor string1 = stringJidAFactory.newActor(factory.getMailbox(), factory);
            (new SetString("abc")).send(future, string1);
            byte[] sb = GetSerializedBytes.req.send(future, string1);
            (new SetActorBytes(stringJidAFactory, sb)).send(future, jidJid1);
            Actor sj = GetActor.req.send(future, jidJid1);
            assertEquals("abc", GetString.req.send(future, sj));

            Actor jidJid2 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            sl = GetSerializedLength.req.send(future, jidJid2);
            assertEquals(4, sl);
            SetActor sjvj = new SetActor(JidFactories.JID_TYPE);
            sjvj.send(future, jidJid2);
            MakeActor mjvj = new MakeActor(JidFactories.JID_TYPE);
            boolean made = mjvj.send(future, jidJid2);
            assertEquals(false, made);
            Actor jidJid2a = GetActor.req.send(future, jidJid2);
            assertNotNull(jidJid2a);
            sl = GetSerializedLength.req.send(future, jidJid2a);
            assertEquals(0, sl);
            sl = GetSerializedLength.req.send(future, jidJid2);
            assertEquals(14, sl);
            rpa = (new ResolvePathname("")).send(future, jidJid2);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid2);
            rpa = (new ResolvePathname("0")).send(future, jidJid2);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid2a);
            Actor jidJid22 = (new CopyJID()).send(future, jidJid2);
            Clear.req.send(future, jidJid2);
            sl = GetSerializedLength.req.send(future, jidJid2);
            assertEquals(4, sl);
            jidJid2a = GetActor.req.send(future, jidJid2);
            assertNull(jidJid2a);
            assertNotNull(jidJid22);
            sl = GetSerializedLength.req.send(future, jidJid22);
            assertEquals(14, sl);
            rpa = (new ResolvePathname("")).send(future, jidJid22);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid22);
            rpa = (new ResolvePathname("0")).send(future, jidJid22);
            assertNotNull(rpa);
            sl = GetSerializedLength.req.send(future, rpa);
            assertEquals(0, sl);

            Actor jidJid3 = ActorJidFactory.fac.newActor(factory.getMailbox(), factory);
            sl = GetSerializedLength.req.send(future, jidJid3);
            assertEquals(4, sl);
            MakeActor mjvjj = new MakeActor(JidFactories.ACTOR_JID_TYPE);
            made = mjvjj.send(future, jidJid3);
            assertEquals(true, made);
            made = mjvjj.send(future, jidJid3);
            assertEquals(false, made);
            Actor jidJid3a = GetActor.req.send(future, jidJid3);
            assertNotNull(jidJid3a);
            sl = GetSerializedLength.req.send(future, jidJid3a);
            assertEquals(4, sl);
            sl = GetSerializedLength.req.send(future, jidJid3);
            assertEquals(30, sl);
            made = mjvj.send(future, jidJid3a);
            assertEquals(true, made);
            made = mjvj.send(future, jidJid3a);
            assertEquals(false, made);
            Actor jidJid3b = GetActor.req.send(future, jidJid3a);
            assertNotNull(jidJid3b);
            sl = GetSerializedLength.req.send(future, jidJid3b);
            assertEquals(0, sl);
            sl = GetSerializedLength.req.send(future, jidJid3a);
            assertEquals(14, sl);
            sl = GetSerializedLength.req.send(future, jidJid3);
            assertEquals(40, sl);
            rpa = (new ResolvePathname("")).send(future, jidJid3);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid3);
            rpa = (new ResolvePathname("0")).send(future, jidJid3);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid3a);
            rpa = (new ResolvePathname("0/0")).send(future, jidJid3);
            assertNotNull(rpa);
            assertEquals(rpa, jidJid3b);
            Actor jidJid33 = (new CopyJID()).send(future, jidJid3);
            Clear.req.send(future, jidJid3a);
            sl = GetSerializedLength.req.send(future, jidJid3a);
            assertEquals(4, sl);
            sl = GetSerializedLength.req.send(future, jidJid3);
            assertEquals(30, sl);
            jidJid3b = GetActor.req.send(future, jidJid3a);
            assertNull(jidJid2a);
            Actor jidJid3aa = GetActor.req.send(future, jidJid3);
            assertEquals(jidJid3a, jidJid3aa);
            assertNotNull(jidJid33);
            sl = GetSerializedLength.req.send(future, jidJid33);
            assertEquals(40, sl);
            rpa = (new ResolvePathname("")).send(future, jidJid33);
View Full Code Here

TOP

Related Classes of org.agilewiki.jactor.Actor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.