public class PortForwardManagerAuthority extends java.lang.Object implements PortForwardManager
Constructor and Description |
---|
PortForwardManagerAuthority() |
PortForwardManagerAuthority(Entity owningEntity) |
Modifier and Type | Method and Description |
---|---|
int |
acquirePublicPort(java.lang.String publicIpId)
Reserves a unique public port on the given publicIpId.
|
int |
acquirePublicPort(java.lang.String publicIpId,
Location l,
int privatePort)
Reserves a unique public port for the purpose of forwarding to the given target,
associated with a given location for subsequent lookup purpose.
|
PortMapping |
acquirePublicPortExplicit(java.lang.String publicIpId,
int port)
Returns old mapping if it existed, null if it is new.
|
void |
associate(java.lang.String publicIpId,
int publicPort,
Location l,
int privatePort)
Records a location and private port against a publicIp and public port,
to support
PortForwardManager.lookup(Location, int) . |
boolean |
forgetPortMapping(PortMapping m) |
PortMapping |
forgetPortMapping(java.lang.String publicIpId,
int publicPort)
Clears the given port mapping, returning the mapping if there was one.
|
boolean |
forgetPublicIpHostname(java.lang.String publicIpId)
Clears a previous call to
PortForwardManager.recordPublicIpHostname(String, String) . |
java.util.Collection<PortMapping> |
getLocationPublicIpIds(Location l)
returns the subset of port mappings associated with a given location
|
PortMapping |
getPortMappingWithPrivateSide(Location l,
int privatePort)
Returns the mapping to a given private port, or null if none.
|
java.util.Collection<PortMapping> |
getPortMappingWithPublicIpId(java.lang.String publicIpId)
Returns the subset of port mappings associated with a given public IP ID.
|
PortMapping |
getPortMappingWithPublicSide(java.lang.String publicIpId,
int publicPort)
Returns the port mapping for a given publicIpId and public port.
|
com.google.common.net.HostAndPort |
getPublicHostAndPort(PortMapping m)
Returns the public host and port for use accessing the given mapping.
|
java.lang.String |
getPublicIpHostname(java.lang.String publicIpId)
Returns a recorded public hostname or address.
|
void |
injectOwningEntity(Entity owningEntity) |
boolean |
isClient()
Returns true if this implementation is a client which is immutable/safe for serialization
i.e.
|
com.google.common.net.HostAndPort |
lookup(Location l,
int privatePort)
Returns the public ip hostname and public port for use contacting the given endpoint.
|
void |
recordPublicIpHostname(java.lang.String publicIpId,
java.lang.String hostnameOrPublicIpAddress)
Records a public hostname or address to be associated with the given publicIpId for lookup purposes.
|
java.lang.String |
toString() |
public PortForwardManagerAuthority()
public PortForwardManagerAuthority(Entity owningEntity)
public void injectOwningEntity(Entity owningEntity)
public int acquirePublicPort(java.lang.String publicIpId)
Often followed by PortForwardManager.associate(String, int, Location, int)
to enable PortForwardManager.lookup(Location, int)
.
acquirePublicPort
in interface PortForwardManager
public PortMapping acquirePublicPortExplicit(java.lang.String publicIpId, int port)
acquirePublicPortExplicit
in interface PortForwardManager
public PortMapping getPortMappingWithPublicSide(java.lang.String publicIpId, int publicPort)
getPortMappingWithPublicSide
in interface PortForwardManager
public java.util.Collection<PortMapping> getPortMappingWithPublicIpId(java.lang.String publicIpId)
getPortMappingWithPublicIpId
in interface PortForwardManager
public PortMapping forgetPortMapping(java.lang.String publicIpId, int publicPort)
forgetPortMapping
in interface PortForwardManager
public boolean forgetPortMapping(PortMapping m)
forgetPortMapping
in interface PortForwardManager
PortForwardManager.forgetPortMapping(String, int)
public void recordPublicIpHostname(java.lang.String publicIpId, java.lang.String hostnameOrPublicIpAddress)
Conceivably this may have to be access-location specific.
recordPublicIpHostname
in interface PortForwardManager
public java.lang.String getPublicIpHostname(java.lang.String publicIpId)
getPublicIpHostname
in interface PortForwardManager
public boolean forgetPublicIpHostname(java.lang.String publicIpId)
PortForwardManager.recordPublicIpHostname(String, String)
.forgetPublicIpHostname
in interface PortForwardManager
public com.google.common.net.HostAndPort getPublicHostAndPort(PortMapping m)
Conceivably this may have to be access-location specific.
getPublicHostAndPort
in interface PortForwardManager
public int acquirePublicPort(java.lang.String publicIpId, Location l, int privatePort)
If already allocated, returns the previously allocated.
acquirePublicPort
in interface PortForwardManager
public com.google.common.net.HostAndPort lookup(Location l, int privatePort)
Will return null if:
lookup
in interface PortForwardManager
PortForwardManager.recordPublicIpHostname(String, String)
public void associate(java.lang.String publicIpId, int publicPort, Location l, int privatePort)
PortForwardManager.lookup(Location, int)
.
Superfluous if PortForwardManager.acquirePublicPort(String, Location, int)
was used,
but strongly recommended if PortForwardManager.acquirePublicPortExplicit(String, int)
was used
e.g. if the location is not known ahead of time.
associate
in interface PortForwardManager
public java.util.Collection<PortMapping> getLocationPublicIpIds(Location l)
getLocationPublicIpIds
in interface PortForwardManager
public PortMapping getPortMappingWithPrivateSide(Location l, int privatePort)
PortForwardManager
getPortMappingWithPrivateSide
in interface PortForwardManager
public java.lang.String toString()
toString
in class java.lang.Object
public boolean isClient()
PortForwardManager
isClient
in interface PortForwardManager