ProtocolPushImplpublic class ProtocolPushImpl extends com.sun.midp.io.j2me.push.ProtocolPush Implementation of push behaviour. |
Fields Summary |
---|
private static ProtocolPushImpl | pushInstanceInstance |
Methods Summary |
---|
public void | checkRegistration(java.lang.String connection, java.lang.String midlet, java.lang.String filter)Called when registration is checked.
BluetoothPush.verifyUrl(connection);
BluetoothPush.verifyFilter(filter);
| protected com.sun.midp.io.j2me.push.ProtocolPush | getInstance()Get instance of this class.
if (pushInstance == null) {
pushInstance = new ProtocolPushImpl();
}
return (ProtocolPush)pushInstance;
| public 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.
int index = connection.indexOf(':");
/* index > 0 because connection has been checked by ProtocolPush.getInstance() */
String protocol = connection.substring(0, index).toLowerCase();
int permission = -1;
if (protocol.equals("btspp") || protocol.equals("btl2cap")) {
permission = Permissions.BLUETOOTH_SERVER;
} else if (protocol.equals("btgoep") || protocol.equals("irdaobex")) {
permission = Permissions.OBEX_SERVER;
} else if (protocol.equals("tcpobex")) {
permission = Permissions.TCP_OBEX_SERVER;
} else {
throw new IllegalArgumentException("Wrong protocol name "+protocol);
}
try {
midletSuite.checkForPermission(permission, connection);
} catch (InterruptedException ie) {
throw new InterruptedIOException(
"Interrupted while trying to ask the user permission");
}
BluetoothPush.verifyUrl(connection);
BluetoothPush.verifyFilter(filter);
BluetoothPush.registerUrl(connection);
|
|