All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mdk_runtime.QuarkRuntimeWebSockets Maven / Gradle / Ivy

There is a newer version: 2.0.37
Show newest version
/* Quark 1.0.452 run at 2016-11-10 18:39:58.222591 */
package mdk_runtime;

/**
 * WebSocket that uses current Quark runtime as temporary expedient.
 *
 */
public class QuarkRuntimeWebSockets implements WebSockets, io.datawire.quark.runtime.QObject {
    public static quark.reflect.Class quark_List_mdk_runtime_WSActor__ref = datawire_mdk_md.Root.quark_List_mdk_runtime_WSActor__md;
    public static quark.reflect.Class mdk_runtime_QuarkRuntimeWebSockets_ref = datawire_mdk_md.Root.mdk_runtime_QuarkRuntimeWebSockets_md;
    public io.datawire.quark.runtime.Logger logger = quark.Functions._getLogger("protocol");
    public mdk_runtime.actors.MessageDispatcher dispatcher;
    public java.util.ArrayList connections = new java.util.ArrayList(java.util.Arrays.asList(new Object[]{}));
    public QuarkRuntimeWebSockets() {}
    public mdk_runtime.promise.Promise connect(String url, mdk_runtime.actors.Actor originator) {
        (this.logger).debug(((("" + (originator))) + ("requested connection to ")) + (url));
        mdk_runtime.promise.PromiseResolver factory = new mdk_runtime.promise.PromiseResolver((this).dispatcher);
        QuarkRuntimeWSActor actor = new QuarkRuntimeWSActor(url, originator, factory);
        (this.connections).add(actor);
        ((this).dispatcher).startActor(actor);
        return (factory).promise;
    }
    public void onStart(mdk_runtime.actors.MessageDispatcher dispatcher) {
        (this).dispatcher = dispatcher;
    }
    public void onMessage(mdk_runtime.actors.Actor origin, Object message) {}
    public void onStop() {
        Integer idx = 0;
        while ((idx) < ((this.connections).size())) {
            ((this).dispatcher).tell(this, new WSClose(), ((this).connections).get(idx));
            idx = (idx) + (1);
        }
    }
    public String _getClass() {
        return "mdk_runtime.QuarkRuntimeWebSockets";
    }
    public Object _getField(String name) {
        if ((name)==("logger") || ((Object)(name) != null && ((Object) (name)).equals("logger"))) {
            return (this).logger;
        }
        if ((name)==("dispatcher") || ((Object)(name) != null && ((Object) (name)).equals("dispatcher"))) {
            return (this).dispatcher;
        }
        if ((name)==("connections") || ((Object)(name) != null && ((Object) (name)).equals("connections"))) {
            return (this).connections;
        }
        return null;
    }
    public void _setField(String name, Object value) {
        if ((name)==("logger") || ((Object)(name) != null && ((Object) (name)).equals("logger"))) {
            (this).logger = (io.datawire.quark.runtime.Logger) (value);
        }
        if ((name)==("dispatcher") || ((Object)(name) != null && ((Object) (name)).equals("dispatcher"))) {
            (this).dispatcher = (mdk_runtime.actors.MessageDispatcher) (value);
        }
        if ((name)==("connections") || ((Object)(name) != null && ((Object) (name)).equals("connections"))) {
            (this).connections = (java.util.ArrayList) (value);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy