Connect the device to a link

@param link
@throws TooManyConnectionException
8260
public void connectToLink(Link link) throws ShanksException {
        if (!this.linksList.contains(link)) {
            this.linksList.add(link);
            logger.finer("Device " + this.getID()
                    + " is now connected to Link " + link.getID());
            link.connectDevice(this);
        }
    }
510516
public void init(VirtualConnection inVC, HttpOutboundChannel channel) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Init on link: " + this + " " + inVC);
        }
        super.init(inVC);
        this.myChannel = channel;
        this.bIsActive = true;
        setEnableReconnect(this.myChannel.getHttpConfig().allowsRetries());
        setAllowReconnect(true);
    }
259088
public void setLinkManager(LinkManager linkManager)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "setLinkManager", linkManager);
    
    _localisationManager.getTRMFacade().setLinkManager(linkManager);

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
       SibTr.exit(tc, "setLinkManager");
  }
664468
def _try_connect(self, connection_string):
        """"""
        if self._parse_conn_string(connection_string):
            self._trigger_callback('on_disconnect', self.id, self._connection_id)

            self.stop_sync()

            if self._mux_func is not None:
                self._mux_func(self._channel)

            if self._device_info is None:
                raise ArgumentError("Missing device name or alias, specify using device=name in port string "
                                    "or -c device=name in connect_direct or debug command",
                                    known_devices=[x for x in DEVICE_ALIASES.keys()])

            try:
                self.jlink = pylink.JLink()
                self.jlink.open(serial_no=self._jlink_serial)
                self.jlink.set_tif(pylink.enums.JLinkInterfaces.SWD)
                self.jlink.connect(self._device_info.jlink_name)
                self.jlink.set_little_endian()
            except pylink.errors.JLinkException as exc:
                if exc.code == exc.VCC_FAILURE:
                    raise HardwareError("No target power detected", code=exc.code,
                                        suggestion="Check jlink connection and power wiring")

                raise
            except:
                raise

            self._control_thread = JLinkControlThread(self.jlink)
            self._control_thread.start()

            self.set_config('probe_required', True)
            self.set_config('probe_supported', True)
1158664
public final synchronized Link getNextLink(Link link)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getNextLink", link);

        Link nextLink = null;

        if (link == null)
        {
            nextLink = _dummyHead.getNextPhysicalLink();
        }
        else
        {
            // Defect 493652/PK59872
            // If the link provided is PhysicallyUnlinked then it is 
            // likely that another thread has removed it while our 
            // thread was inspecting it. In order to avoid stopping
            // in the middle of a find/removeFirstMatching search we
            // need to start from the beginning of the list again.
            if (link.isPhysicallyUnlinked())
            {
                nextLink = _dummyHead.getNextPhysicalLink();

                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Current link is PhysicallyUnlinked so returning to beginning of list.");
            }
            else
            {
                nextLink = link.getNextPhysicalLink();
            }
        }

        while (nextLink != null && nextLink.isLogicallyUnlinked())
        {
            nextLink = nextLink.getNextPhysicalLink();
        }

        if (nextLink == _dummyTail)
        {
            nextLink = null;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getNextLink", nextLink);
        return nextLink;
    }
583832
public void deleteMQLink(String mqLinkUuid) 
    throws SINotPossibleInCurrentConfigurationException, 
           SIResourceException, 
           SIConnectionLostException, 
           SIException, 
           SIBExceptionBase 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "deleteMQLink", mqLinkUuid);    
    destinationManager.deleteMQLinkLocalization(new SIBUuid8(mqLinkUuid));
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "deleteMQLink");  
  }
1060079
@SuppressWarnings("unchecked")
    @Internal
    protected final void setLinks(Map<String, Object> links) {
        for (Map.Entry<String, Object> entry : links.entrySet()) {
            String name = entry.getKey();
            Object value = entry.getValue();
            if (value instanceof Map) {
                Map<String, Object> linkMap = (Map<String, Object>) value;
                link(name, linkMap);
            }
        }
    }
1321284
@Override
    public void addConnectionListener(SICoreConnectionListener listener)
                    throws SIConnectionDroppedException,
                    SIConnectionUnavailableException {

        checkValid();

        _delegateConnection.addConnectionListener(listener);

    }
65151
public function clickLink($link)
    {
        $link = $this->fixStepArgument($link);
        $this->getSession()->getPage()->clickLink($link);
    }
625887
private void attachConnectionListener(Conversation conversation, SICoreConnection conn) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "attachConnectionListener",
                        new Object[]
                        {
                         conversation,
                         conn
                        });

        // The connection listener is saved in the link level attachement so that each connection that
        // uses the same physical link uses the same connection listener

        // So get the connection listener from the link level state and register ourselves with it
        ServerLinkLevelState linkState = (ServerLinkLevelState) conversation.getLinkLevelAttachment(); //d173544
        ServerSICoreConnectionListener listener = linkState.getSICoreConnectionListener();

        listener.addSICoreConnection(conn, conversation);
        // Finally attach it to the actual core connection
        // Start f173765.2
        try {
            conn.addConnectionListener(listener);
        } catch (SIException e) {
            FFDCFilter.processException(e,
                                        CLASS_NAME + ".attachConnectionListener",
                                        CommsConstants.SERVERTRANSPORTRECEIVELISTENER_CONNGET_01,
                                        this);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Unable to register connection listener", e);
        }
        // End f173765.2

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "attachConnectionListener");
    }
495334
public void connectDevice(Device device) throws ShanksException {
        if (this.linkedDevices.size() < deviceCapacity) {
            if (!this.linkedDevices.contains(device)) {
                this.linkedDevices.add(device);
                device.connectToLink(this);
                logger.finer("Link " + this.getID() + " has Device "
                        + device.getID() + " in its linked device list.");
            } else {
                logger.finer("Link " + this.getID() + " already has Device "
                        + device.getID() + " in its linked device list.");
            }
        } else {
            if (!this.linkedDevices.contains(device)) {
                logger.warning("Link " + this.getID()
                        + " is full of its capacity. Device " + device.getID()
                        + " was not included in its linked device list.");
                throw new TooManyConnectionException(this);
            } else {
                logger.finer("Link " + this.getID() + " already has Device "
                        + device.getID() + " in its linked device list.");
            }
        }
    }
652166
void undoAdd(Link newLink)
                    throws ObjectManagerException {
        final String methodName = "undoAdd";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, new Object[] { newLink });

        // Detach this Link from the list.
        if (newLink.next == null) { // Are we the tail of list?
            tail = newLink.previous;
        } else { // Not tail of the list.
            // Join up the backwards Link.
            Link nextLink = (Link) newLink.next.getManagedObject();
            nextLink.previous = newLink.previous;
        } // if at tail of list.

        if (newLink.previous == null) { // Are we the head of list?
            head = newLink.next;
        } else { // Not head of the list.
            // Join up the forwards Link.
            Link previousLink = (Link) newLink.previous.getManagedObject();
            previousLink.next = newLink.next;
        } // if at head of list.

        // Reset the availableHead.
        availableHead = head;
        skipToBeDeleted();
        decrementSize(); // Adjust list length. 

        // Give back all of the remaining space.
        owningToken.objectStore.reserve((int) -reservedSpaceInStore, false);

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
303504
@Override
    public Promise<Void> unlink(String link) {
        return adapter.toPromise(handler -> vertx.fileSystem().unlink(link, handler));
    }
57425
public final void append(final AbstractItemLink link) throws SevereMessageStoreException
    {
        if (link.isItemStreamLink())
        {
            _itemStreams.append(link);
        }
        else
        {
            throw new SevereMessageStoreException("Cannot add this directly to message store");
        }
    }
1022592
protected void connect() throws RpcException {
        if (_state.equals(State.CONNECTED)) {
            return;
        }

        final ChannelFuture oldChannelFuture = _channelFuture;

        if (LOG.isDebugEnabled()) {
            String logPrefix = _usePrivilegedPort ? "usePrivilegedPort " : "";
            LOG.debug("{}connecting to {}", logPrefix, getRemoteAddress());
        }
        _state = State.CONNECTING;

        if (_usePrivilegedPort) {
            _channel = bindToPrivilegedPort();
            _channelFuture = _channel.connect(getRemoteAddress());
        } else {
            _channelFuture = _clientBootstrap.connect();
            _channel = _channelFuture.getChannel();
        }

        NioSocketChannelConfig cfg = (NioSocketChannelConfig) _channel.getConfig();
        cfg.setWriteBufferHighWaterMark(MAX_SENDING_QUEUE_SIZE);

        _channelFuture.addListener(new ChannelFutureListener() {
            /* (non-Javadoc)
             * @see org.jboss.netty.channel.ChannelFutureListener#operationComplete(org.jboss.netty.channel.ChannelFuture)
             */
            public void operationComplete(ChannelFuture future) {
                if (_channelFuture.isSuccess()) {
                    _state = State.CONNECTED;
                    oldChannelFuture.setSuccess();
                } else {
                    _state = State.DISCONNECTED;
                    oldChannelFuture.cancel();
                }

            }
        });

    }
700413
protected function prepareLink(string &$link = null): void
	{
		if ($link !== null) {
			if (Strings::endsWith($link, ':default')) {
				$link = substr($link, 0, -7);
			}
			$pos = strrpos($link, ':');
			if ($pos !== strlen($link)) {
				$link = substr($link, 0, $pos + 1);
			}
		}
	}
1311174
public synchronized void connect(BluetoothDevice device, boolean past)
            throws IOException, InterruptedException {
        // Cancel any thread attempting to make a connection
        if (mState == STATE_CONNECTING) {
            if (mConnectThread != null) {
                mConnectThread.cancel();
                mConnectThread = null;
            }
        }

        // Cancel any thread currently running a connection
        if (mEngConnectedThread != null) {
            mEngConnectedThread.cancel();
            mEngConnectedThread = null;
        }
        if (mImpConnectedThread != null) {
            mImpConnectedThread.cancel();
            mImpConnectedThread = null;
        }

        mPast = past;

        // Start the thread to connect with the given device
        try {
            mConnectThread = new ConnectThread(device);
            mConnectThread.start();
        } catch (IOException e) {
            e.printStackTrace();
            connectionFailed();
            setState(STATE_NONE);
        }
        setState(STATE_CONNECTING);
    }