예제 #1
0
        /**
         * Initialises the connection to the BNS
         *
         * @param bnsNode
         *            The NodeID of the BNS Node
         * @//throws JCSPNetworkException
         *             Thrown if something goes wrong in the underlying architecture
         */
        public static void initialise(NodeID bnsNode)
        ////throws JCSPNetworkException
        {
            // First check that we are not already initialised
            if (BNS.initialised)
            {
                throw new JCSPNetworkException("The BNS is already initialised");
            }

            // We are initialised. Attempt to do so.
            // First, we need to create the BNSService
            BNS.service = new BNSService(bnsNode);

            // Now set initialised to true
            BNS.initialised = true;

            // We are now connected
        }
예제 #2
0
        /**
         * Initialises the connection to the BNS
         *
         * @param bnsNode
         *            The NodeAddress of the BNS Node
         * @//throws JCSPNetworkException
         *             Thrown if something goes wrong in the underlying architecture
         */
        public static void initialise(NodeAddress bnsNode)
        ////throws JCSPNetworkException
        {
            // First check that we are not already initialised
            if (BNS.initialised)
            {
                throw new JCSPNetworkException("The BNS is already initialised");
            }

            // We are initialised. Attempt to do so.
            // First, we need to connect to the BNS Node
            Link link = LinkFactory.getLink(bnsNode);

            // Now create the BNSService
            BNS.service = new BNSService(link.getRemoteNodeID());

            // Now set initialised to true
            BNS.initialised = true;

            // We are now connected
        }