示例#1
0
 /**
  * @param name
  * @param addr
  * @return NodeKey for this Node
  * @//throws JCSPNetworkException
  */
 public NodeKey init(String name, NodeAddress addr)
 ////throws JCSPNetworkException
 {
     Node.log.log(this.GetType(), "Node initialisation begun");
     if (this.initialized)
     {
         throw new JCSPNetworkException("Node already initialised");
     }
     this.initialized = true;
     LinkServer.start(addr);
     this.nodeID = new NodeID(name, addr);
     this.nk     = new NodeKey();
     NodeAddress.installProtocol(addr.getProtocol(), addr.getProtocolID());
     Node.log.log(this.GetType(), "Node initialisation complete");
     return(this.nk);
 }
示例#2
0
        /**
         * @param factory
         * @return NodeKey for this Node
         * @//throws JCSPNetworkException
         */
        public NodeKey init(NodeFactory factory)
        ////throws JCSPNetworkException
        {
            Node.log.log(this.GetType(), "Node initialisation begun");
            if (this.initialized)
            {
                throw new JCSPNetworkException("Node already initialised");
            }
            NodeAddress localAddr = factory.initNode(this);

            this.nodeID      = new NodeID("", localAddr);
            this.initialized = true;
            this.nk          = new NodeKey();
            Link toServer = LinkFactory.getLink(factory.cnsAddress);

            CNS.CNS.initialise(toServer.remoteID);
            BNS.BNS.initialise(toServer.remoteID);
            return(this.nk);
        }