Methods Summary |
---|
protected void | checkIIPFilter(java.lang.String filter)Check IP filter is valid.
int len = filter.length();
int dotCount = 0;
boolean dotUnexpected = true;
boolean failed = false;
/* IP address characters only for other connections. */
/* Check for special case - single * char. This is valid filter. */
if (!"*".equals(filter)) {
/* All other filters shall be in IPv4 format. */
for (int i = 0; i < len && !failed; i++) {
char c = filter.charAt(i);
if (c == '.") {
if (dotUnexpected || i == len-1) {
failed = true;
} else {
dotCount++;
if (dotCount > IP4_DELIMITER_COUNT) {
failed = true;
}
dotUnexpected = true;
}
} else
if (c != '?" && c != '*" && !('0" <= c && c <= '9")) {
/* The only acceptable characters are [*?0-9] */
failed = true;
} else {
dotUnexpected = false;
}
}
if (failed || dotCount < IP4_DELIMITER_COUNT) {
throw new IllegalArgumentException("IP Filter \"" + filter + "\" is invalid");
}
}
|
protected void | checkIsNotHost(java.lang.String connection, boolean checkPort)Check if host is not present.
HttpUrl url = new HttpUrl(connection);
// Server connections do not have a host
if (url.host != null) {
throw new ConnectionNotFoundException(
"Connection not supported");
}
if (checkPort && url.port == -1) {
new IllegalArgumentException("Port missing");
}
|
public abstract void | checkRegistration(java.lang.String connection, java.lang.String midlet, java.lang.String filter)Called when registration is checked.
|
protected abstract com.sun.midp.io.j2me.push.ProtocolPush | getInstance()Get instance of this class.
|
public static com.sun.midp.io.j2me.push.ProtocolPush | getInstance(java.lang.String connection)Get instance of class depends on protocol.
/* Verify that the connection requested is valid. */
if (connection == null || connection.length() == 0) {
throw new IllegalArgumentException("Connection is empty");
}
int index = connection.indexOf(':");
if (index == -1) {
throw new IllegalArgumentException("Protocol field is omitted");
}
String className = Configuration.getProperty
(connection.substring(0, index).toLowerCase());
if (className == null || className.length() == 0) {
throw new ConnectionNotFoundException("Protocol is invalid " +
"or not supported");
}
try {
ProtocolPush cl = (ProtocolPush)Class.forName(className).newInstance();
return cl.getInstance();
} catch (ClassNotFoundException exc) {
throw new ConnectionNotFoundException("Protocol is not supported");
} catch (ClassCastException exc) {
throw new RuntimeException(
"System error loading class " + className + ": " + exc);
} catch (IllegalAccessException exc) {
throw new RuntimeException(
"System error loading class " + className + ": " + exc);
} catch (InstantiationException exc) {
throw new RuntimeException(
"System error loading class " + className + ": " + exc);
}
|
public abstract void | registerConnection(com.sun.midp.midlet.MIDletSuite midletSuite, java.lang.String connection, java.lang.String midlet, java.lang.String filter)Called when registration is established.
|