swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

java method signature for eventOccurredOn


From: Steve Brophy
Subject: java method signature for eventOccurredOn
Date: Wed, 10 May 2000 08:53:09 -0400

Hello,

I'm trying to use the VarProbe 'setObjectToNotify()', but I can't get the
declaration of the 'eventOccurredOn' method correct.  This is using Java on
an NT system.

At runtime, the call to setObjectToNotify gives the error 'JavaProxy does
not implement standard probe hook message'.  If I change to make my class
extended from SwarmObjectImpl, then the superclass SwarmObject method is
recognized, and the runtime proceeds until the call to
SwarmObject.eventOccurred... which reports that "subclass should override".

I'm missing something on how to make my java function result in a JavaProxy
which gives an override match with the objective c method from SwarmObject,
and haven't been able to find it in the java swarm ref guide.

1.  Does the match for override depend only on the method name and return
type, or are all the parameter types also involved, what should I try next?

2.  Somewhat related question, am I using casts correctly to get access to
the SETTING Phase methods like 'setObjectToNotify' call below?  I end up
doing similar things for 'setNonInteractive' and 'setHideResult' calls.

thanks for the help, below is a sample showing how I tried declaring the
method:

// need to override Objective C method:
// - eventOccurredOn: (id) anObject via: (id) aProbe 
//              withProbeType: (const char *) aProbeType
//              on: (const char *) probedElement
//              ofType: (char) dataType withData: (void *) data {...}

import swarm.Globals;
import swarm.objectbase.EmptyProbeMapImpl;
import swarm.objectbase.ProbeMap;
import swarm.objectbase.SwarmObjectImpl;
import swarm.objectbase.VarProbe;
import swarm.objectbase.VarProbeImpl;

// class Node extends SwarmObjectImpl
// (in fuller program, could also extend from SwarmObjectImpl
// to see the other error message, but doesn't run in this
// smaller example)
class Node {
    public int var1;
    public Node() {
        // super(Globals.env.globalZone);
        ProbeMap pmap = new EmptyProbeMapImpl(
                                Globals.env.globalZone, getClass());
        VarProbe vprobe =
                Globals.env.probeLibrary.getProbeForVariable$inClass(
                                "var1", getClass());
        ((VarProbeImpl) vprobe).setObjectToNotify(this);
        pmap.addProbe(vprobe);
        Globals.env.probeLibrary.setProbeMap$For(pmap, getClass());
    }

    public Object eventOccurredOn$via$withProbeType$on$ofType$withData(
                Object anObject,
                VarProbe aProbe,
                String aProbeType,
                String probedElement,
                char datatype,  // also tried byte and int
                byte[] data) {
        System.out.println("Event occurred.");
        return this;
    }
}

public class ProbeNotify {
    public static void main(String[] args) {
        Globals.env.initSwarm("probenotify", "00", "smb", args);
        Node node = new Node();
        Globals.env.probeDisplayManager.createProbeDisplayFor(node);
        Globals.env.probeDisplayManager.update();
    }
}

thanks,
Steve Brophy, ERIM



                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]