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.
| 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.
checkIsNotHost(connection, false);
if (connection.startsWith(SIPConstants.SCHEME_SIP
.toLowerCase() + ":")) {
try {
Class.forName("com.sun.midp.io.j2me.sip.Protocol");
} catch (ClassNotFoundException e) {
throw new ConnectionNotFoundException(
"Connection not supported");
}
/*
* Check the suite permission for the connection
* and close the connection immediately.
*/
try {
midletSuite.checkForPermission(Permissions.SIP,
connection);
} catch (InterruptedException ie) {
throw new InterruptedIOException(
"Interrupted while trying to ask the user permission");
}
/*
* Verify the connection string.
*/
URLParser parser = new URLParser(connection);
SipURI inputURI = null;
try {
inputURI = (SipURI)parser.parse();
} catch (ParseException exc) {
throw new IllegalArgumentException(exc.getMessage());
}
} else if (connection.startsWith(SIPConstants.SCHEME_SIPS
.toLowerCase() + ":")) {
try {
Class.forName("com.sun.midp.io.j2me.sips.Protocol");
} catch (ClassNotFoundException e) {
throw new ConnectionNotFoundException(
"Connection not supported");
}
/*
* Check the suite permission for the connection
* and close the connection immediately.
*/
try {
midletSuite.checkForPermission(Permissions.SIPS,
connection);
} catch (InterruptedException ie) {
throw new InterruptedIOException(
"Interrupted while trying to ask the user permission");
}
/*
* IMPL_NOTE: Currently SIPS push connections are not supported.
* Throwing an exception here prevents the sips connection
* URL from being registered.
*/
throw new ConnectionNotFoundException(
"Connection not supported");
}
|
|