Class RemoteEventContext

    • Constructor Detail

      • RemoteEventContext

        public RemoteEventContext​(String host,
                                  int port,
                                  String bindingKey,
                                  ContextInterface embeddedContext,
                                  String eventProducerBindingKey)
                           throws RemoteException,
                                  AlreadyBoundException
        Constructs a new RemoteContext. Register the new context in the RMI registry. When the RMI registry does not exist yet, it will be created, but only on the local host. Remote creation of a registry on another computer is not possible. Any attempt to do so will cause an AccessException to be fired.
        Parameters:
        host - String; the host where the RMI registry resides or will be created. Creation is only possible on localhost.
        port - int; the port where the RMI registry can be found or will be created
        bindingKey - the key under which this context will be bound in the RMI registry
        embeddedContext - ContextInterface; the underlying context
        eventProducerBindingKey - String; the key under which the event producer will be bound
        Throws:
        RemoteException - when there is a problem with the RMI registry
        AlreadyBoundException - when there is already another object bound to the bindingKey
        NullPointerException - when host, path, or bindingKey is null
        IllegalArgumentException - when port < 0 or port > 65535
        AccessException - when there is an attempt to create a registry on a remote host
      • RemoteEventContext

        public RemoteEventContext​(URL registryURL,
                                  ContextInterface embeddedContext,
                                  String eventProducerBindingKey)
                           throws RemoteException,
                                  AlreadyBoundException
        Constructs a new RemoteContext. Register the new context in the RMI registry. When the host has not been specified in the URL, 127.0.0.1 will be used. When the port has not been specified in the URL, the default RMI port 1099 will be used. When the RMI registry does not exist yet, it will be created, but only on the local host. Remote creation of a registry on another computer is not possible. Any attempt to do so will cause an AccessException to be fired.
        Parameters:
        registryURL - URL; the URL of the registry, e.g., "http://localhost:1099" or "http://130.161.185.14:28452"
        embeddedContext - ContextInterface; the underlying context
        eventProducerBindingKey - String; the key under which the event producer will be bound
        Throws:
        RemoteException - when there is a problem with the RMI registry
        AlreadyBoundException - when there is already another object bound to the bindingKey
        NullPointerException - when registryURL, bindingKey, or embeddedContext is null
        AccessException - when there is an attempt to create a registry on a remote host
    • Method Detail

      • addListener

        public boolean addListener​(EventListener listener,
                                   String absolutePath,
                                   ContextScope contextScope,
                                   int position)
                            throws RemoteException,
                                   NameNotFoundException,
                                   InvalidNameException,
                                   NotContextException,
                                   NamingException,
                                   NullPointerException
        Add a listener for the provided scope as strong reference to the specified position of a queue of listeners.
        Specified by:
        addListener in interface EventContextInterface
        Parameters:
        listener - EventListener; the listener which is interested at events of eventType.
        absolutePath - String; the absolute path of the context or object to subscribe to
        contextScope - ContextScope; the part of the tree that the listener is aimed at (current node, current node and keys, subtree).
        position - int; the position of the listener in the queue.
        Returns:
        the success of adding the listener. If a listener was already added, or an illegal position is provided false is returned.
        Throws:
        RemoteException - if a network connection failure occurs.
        NameNotFoundException - when the absolutePath could not be found in the parent context, or when an intermediate context does not exist
        InvalidNameException - when the scope is OBJECT_SCOPE, but the key points to a (sub)context
        NotContextException - when the scope is LEVEL_SCOPE, OBJECT_LEVEL_SCOPE or SUBTREE_SCOPE, and the key points to an ordinary object
        NamingException - as an overarching exception for context errors
        NullPointerException - when one of the arguments is null
      • addListener

        public boolean addListener​(EventListener listener,
                                   String absolutePath,
                                   ContextScope contextScope,
                                   int position,
                                   ReferenceType referenceType)
                            throws RemoteException,
                                   NameNotFoundException,
                                   InvalidNameException,
                                   NotContextException,
                                   NamingException,
                                   NullPointerException
        Add a listener for the provided scope to the specified position of a queue of listeners.
        Specified by:
        addListener in interface EventContextInterface
        Parameters:
        listener - EventListener; which is interested at certain events,
        absolutePath - String; the absolute path of the context or object to subscribe to
        contextScope - ContextScope; the part of the tree that the listener is aimed at (current node, current node and keys, subtree).
        position - int; the position of the listener in the queue
        referenceType - ReferenceType; whether the listener is added as a strong or as a weak reference.
        Returns:
        the success of adding the listener. If a listener was already added or an illegal position is provided false is returned.
        Throws:
        RemoteException - if a network connection failure occurs.
        NameNotFoundException - when the absolutePath could not be found in the parent context, or when an intermediate context does not exist
        InvalidNameException - when the scope is OBJECT_SCOPE, but the key points to a (sub)context
        NotContextException - when the scope is LEVEL_SCOPE, OBJECT_LEVEL_SCOPE or SUBTREE_SCOPE, and the key points to an ordinary object
        NamingException - as an overarching exception for context errors
        NullPointerException - when one of the arguments is null