Methods Summary |
---|
protected void | checkForPermission(com.sun.midp.security.SecurityToken token, int permission)Makes sure caller has the com.sun.midp permission set to "allowed".
if (token != null) {
token.checkIfPermissionAllowed(permission);
} else {
MIDletSuite midletSuite =
MIDletStateHandler.getMidletStateHandler().getMIDletSuite();
if (midletSuite != null) {
try {
midletSuite.checkForPermission(permission,
url.getResourceName());
} catch (InterruptedException ie) {
throw new InterruptedIOException(
"Interrupted while trying to ask the user permission");
}
}
}
|
private void | checkOpenMode(int mode)Ensures open mode requested is READ_WRITE or READ or WRITE
if (mode != Connector.READ_WRITE &&
mode != Connector.READ &&
mode != Connector.WRITE) {
throw new IllegalArgumentException("Unsupported mode: " + mode);
}
|
protected void | checkUrl(com.sun.midp.io.BluetoothUrl url)Ensures URL parameters have valid values. This implementation contains
common checks and is called from subclasses before making protocol
specific ones.
/*
* IMPL_NOTE: revisit this code if TCK changes.
* IllegalArgumentException seems to be right one here, not
* BluetoothConnectionException. However TCK expects the latter
* in several cases. Once IllegalArgumentException becomes
* preferable this check can be placed to BluetoothUrl.
* Questionable TCK tests:
* bluetooth.Connector.Security.openClientTests,
* bluetooth.Connector.Security.openServerTests
*/
if ((url.encrypt || url.authorize) && !url.authenticate) {
throw new BluetoothConnectionException(
BluetoothConnectionException.UNACCEPTABLE_PARAMS,
"Invalid Authenticate parameter");
}
|
protected abstract javax.microedition.io.Connection | clientConnection(com.sun.midp.security.SecurityToken token, int mode)Ensures that permissions are proper and creates client side connection.
|
public javax.microedition.io.Connection | openPrim(java.lang.String name, int mode, boolean timeouts)Implements the openPrim() of
ConnectionBaseInerface and allows to get
connection by means of Connector.open()
call.
return openPrim(null, name, mode, timeouts);
|
public javax.microedition.io.Connection | openPrim(java.lang.Object token, java.lang.String name, int mode, boolean timeouts)Checks permissions and opens requested connection.
return openPrimImpl(token,
new BluetoothUrl(protocol, name), mode);
|
protected javax.microedition.io.Connection | openPrimImpl(java.lang.Object token, com.sun.midp.io.BluetoothUrl url, int mode)Checks permissions and opens requested connection.
checkOpenMode(mode);
checkUrl(url);
this.url = url;
return url.isServer?
serverConnection((SecurityToken)token, mode):
clientConnection((SecurityToken)token, mode);
|
protected abstract javax.microedition.io.Connection | serverConnection(com.sun.midp.security.SecurityToken token, int mode)Ensures that permissions are proper and creates required notifier at
server side.
|