public class Gateways
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Gateways.Events
Events fired when gateway collection is changed.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Gateway gateway)
Add new gateway
|
boolean |
addAll(java.util.Collection<Gateway> gateways)
Add new gateways
|
void |
addValuedListener(ValuedListener<Gateways.Events,Gateway> valuedListener) |
void |
clear()
Remove all gateways
|
boolean |
contains(Gateway gateway)
Search for an existing gateway
|
static java.lang.String |
convertDelayToHumanString(long delay,
boolean inMilliseconds)
Convert message delay to more human readable string delay.
|
Gateway |
get(java.lang.String gatewayName)
Find gateway by name.
|
java.util.TreeSet<Gateway> |
getAll()
Get collection of all gateways sorted by name
|
java.util.HashSet<DeprecatedGateway> |
getDeprecatedGateways()
Get set of currently deprecated gateways
|
java.util.TreeSet<Gateway> |
getFavorites()
Get gateways marked as favorites
|
java.util.TreeSet<Gateway> |
getHidden()
Get gateways marked as hidden
|
static Gateways |
getInstance()
Get shared instance
|
java.util.TreeSet<Gateway> |
getVisible()
Get just the visible (non-hidden) gateways
|
boolean |
isEmpty()
Return if there are no gateways
|
static boolean |
isFakeGateway(java.lang.String gatewayName)
Returns whether the gateway is a fake one (used just for development
purposes).
|
static boolean |
isNumberPreferred(Gateway gateway,
java.lang.String number)
Returns whether gateway matches the number with its preferred prefixes.
|
static boolean |
isNumberSupported(Gateway gateway,
java.lang.String number)
Returns whether gateway matches the number with its supported prefixes.
|
static GatewayInfo |
parseInfo(java.net.URL script)
Parse GatewayInfo implementation from the provided URL.
|
boolean |
remove(Gateway gateway)
Remove existing gateway
|
boolean |
removeAll(java.util.Collection<Gateway> gateways)
Remove existing gateways
|
void |
removeValuedListener(ValuedListener<Gateways.Events,Gateway> valuedListener) |
void |
setDeprecatedGateways(java.util.Set<DeprecatedGateway> deprecatedGateways)
Set currently deprecated gateways.
|
int |
size()
Return number of gateways
|
Tuple<java.util.ArrayList<Gateway>,java.lang.Boolean> |
suggestGateway(java.lang.String number)
Guess gateway according to phone number or phone number prefix.
|
public void addValuedListener(ValuedListener<Gateways.Events,Gateway> valuedListener)
public void removeValuedListener(ValuedListener<Gateways.Events,Gateway> valuedListener)
public static Gateways getInstance()
public java.util.TreeSet<Gateway> getAll()
public boolean add(Gateway gateway)
gateway
- new gateway, not nullCollection.add(E)
public boolean addAll(java.util.Collection<Gateway> gateways)
gateways
- collection of gateways, not null, no null elementCollection.addAll(java.util.Collection<? extends E>)
public boolean remove(Gateway gateway)
gateway
- gateway to be removed, not nullCollection.remove(java.lang.Object)
public boolean removeAll(java.util.Collection<Gateway> gateways)
gateways
- collection of gateways to be removed, not null, no null elementCollection.removeAll(java.util.Collection<?>)
public void clear()
public boolean contains(Gateway gateway)
gateway
- gateway to be searched, not nullCollection.contains(java.lang.Object)
public int size()
Collection.size()
public boolean isEmpty()
Collection.isEmpty()
public java.util.HashSet<DeprecatedGateway> getDeprecatedGateways()
public void setDeprecatedGateways(java.util.Set<DeprecatedGateway> deprecatedGateways)
public Gateway get(java.lang.String gatewayName)
gatewayName
- Name of the gateway. Search is case sensitive. May be null.public static boolean isFakeGateway(java.lang.String gatewayName)
public Tuple<java.util.ArrayList<Gateway>,java.lang.Boolean> suggestGateway(java.lang.String number)
number
- phone number or its prefix. The minimum length is two characters,
for shorter input (or null) the method does nothing.public static boolean isNumberSupported(Gateway gateway, java.lang.String number)
gateway
- gatewaynumber
- phone numberpublic static boolean isNumberPreferred(Gateway gateway, java.lang.String number)
gateway
- gatewaynumber
- phone numberpublic static java.lang.String convertDelayToHumanString(long delay, boolean inMilliseconds)
delay
- number of seconds (or milliseconds) of the delayinMilliseconds
- if true,then delay
is specified in
milliseconds, otherwise in secondspublic static GatewayInfo parseInfo(java.net.URL script) throws java.io.IOException, javax.script.ScriptException, java.beans.IntrospectionException
script
- URL (file or jar) of gateway scriptjava.io.IOException
- when there is problem accessing the script filejavax.script.ScriptException
- when the script is not validjava.beans.IntrospectionException
- when current JRE does not support JavaScript executionpublic java.util.TreeSet<Gateway> getFavorites()
public java.util.TreeSet<Gateway> getHidden()
public java.util.TreeSet<Gateway> getVisible()