public RespokeConnection getConnection ( String connectionID , String endpointID , boolean skipCreate ) { RespokeConnection connection = null ; if ( null != connectionID ) { RespokeEndpoint endpoint = getEndpoint ( endpointID , skipCreate ) ; if ( null != endpoint ) { for ( RespokeConnection eachConnection : endpoint . connections ) { if ( eachConnection . connectionID . equals ( connectionID ) ) { connection = eachConnection ; break ; } } if ( ( null == connection ) && ( ! skipCreate ) ) { connection = new RespokeConnection ( connectionID , endpoint ) ; endpoint . connections . add ( connection ) ; } } } return connection ; }
Find a Connection by id and return it . In most cases if we don t find it we will create it . This is useful in the case of dynamic endpoints where groups are not in use . Set skipCreate = true to return null if the Connection is not already known .