GetConnection Utility Functions

Functions

HashMap< Integer, AppPort > com.mobiledgex.matchingengine.AppConnectionManager.getUdpMap (AppClient.FindCloudletReply findCloudletReply)
 
HashMap< Integer, AppPort > com.mobiledgex.matchingengine.AppConnectionManager.getTCPMap (AppClient.FindCloudletReply findCloudletReply)
 
AppPort com.mobiledgex.matchingengine.AppConnectionManager.validatePublicPort (AppClient.FindCloudletReply findCloudletReply, AppPort appPort, int portNum)
 
String com.mobiledgex.matchingengine.AppConnectionManager.createUrl (FindCloudletReply findCloudletReply, AppPort appPort, int desiredPortNum, String protocol, String path)
 
String com.mobiledgex.matchingengine.AppConnectionManager.getHost (FindCloudletReply findCloudletReply, AppPort appPort)
 
int com.mobiledgex.matchingengine.AppConnectionManager.getPort (AppPort appPort, int portNum) throws InvalidPortException
 

Detailed Description

Function Documentation

◆ createUrl()

String com.mobiledgex.matchingengine.AppConnectionManager.createUrl ( FindCloudletReply  findCloudletReply,
AppPort  appPort,
int  desiredPortNum,
String  protocol,
String  path 
)

Convenience method to create, from an AppPort, the http prefix URL of an particular location's AppInst.

Parameters
findCloudletReply(FindCloudletReply): A FindCloudletReply for the current location.
appPort(AppPort): This is the AppPort you want to connect to, based on the unmapped internal port number.
desiredPortNum(int): This is the desired internal port number of where the AppInst is actually made available in a particular cloudlet region. It may not match the appPort mapped public port number. If <= 0, it defaults to the first public port.
protocol(String): The L7 protocol (eg. http, https, ws)
path(String): Path to be appended at the end of the url. Defaults to "" if null is provided.
Returns
String: completed URL, or null if invalid.

Example

String protocol = one.getTls() ? "https" : "http";
url = appConnect.createUrl(findCloudletReply, one, one.getPublicPort(), protocol, null);

◆ getHost()

String com.mobiledgex.matchingengine.AppConnectionManager.getHost ( FindCloudletReply  findCloudletReply,
AppPort  appPort 
)

Returns the host of the developers app backend based on the findCloudletReply and appPort provided. This function is called by L4 GetConnection functions, but can be called by developers if they are using their own communication client (use GetPort as well)

◆ getPort()

int com.mobiledgex.matchingengine.AppConnectionManager.getPort ( AppPort  appPort,
int  portNum 
) throws InvalidPortException

Returns the port of the developers app backend service based on the appPort provided. An optional desiredPort parameter is provided if the developer wants a specific port within their appPort port range (if none provided, the function will default to the public_port field in the AppPort). This function is called by L4 GetConnection functions, but can be called by developers if they are using their own communication client (use GetHost as well).

◆ getTCPMap()

HashMap< Integer, AppPort > com.mobiledgex.matchingengine.AppConnectionManager.getTCPMap ( AppClient.FindCloudletReply  findCloudletReply)

Returns a Dictionary mapping a TCP port that the developer specified when creating their app through MobiledgeX console to an AppPort object. This AppPort object will contain relevant information necessary to connect to the desired port. This object will be used in GetConnection functions.

Parameters
findCloudletReply(FindCloudletReply)
Returns
HashMap<Integer, AppPort>

◆ getUdpMap()

HashMap< Integer, AppPort > com.mobiledgex.matchingengine.AppConnectionManager.getUdpMap ( AppClient.FindCloudletReply  findCloudletReply)

Returns a Dictionary mapping a UDP port that the developer specified when creating their app through MobiledgeX console to an AppPort object. This AppPort object will contain relevant information necessary to connect to the desired port. This object will be used in GetConnection functions.

Parameters
findCloudletReply(FindCloudletReply)
Returns
HashMap<Integer, AppPort>

◆ validatePublicPort()

AppPort com.mobiledgex.matchingengine.AppConnectionManager.validatePublicPort ( AppClient.FindCloudletReply  findCloudletReply,
AppPort  appPort,
int  portNum 
)

With the given FindCloudletReply, verify the AppPort and sub port in port range is good, and return it.

Parameters
findCloudletReply(FindCloudletReply)
appPort(AppPort)
portNum(int)
Returns
AppPort: appPort that matches spec.