Motorola E680 Technical Manual - Page 66

Connection Behavior, Security

Page 66 highlights

The file connection defines the first directory as the root, which corresponds to a logical mount point for a particular storage unit or memory. The root of a file system supporting only one card reader will return the contents of the card directly. If more than one card reader is supported, or the device supports a file system in RAM, the root strings are device specific. Since roots are part of the path string as a directory, they have a trailing "/". The valid values for a device can be retrieved by querying open a root connection to the root URL of the device (file:///) and getting the results of the list() method. A single connection object can only reference a single file or directory. A connection object cannot be changed dynamically to refer to a different file or directory than originally connected to. A completely separate connection will be established through the Connector.open() method to reference a different file or directory. Connection Behavior The File System Access API is different from other Generic Connection Framework APIs because a connection object can successfully return from the Connector.open() method without referencing an existing file or directory. This method is used to allow the creation of new files and directories on a file system. Always check for the file's or directory's existence after a connection is established to determine if the file or directory actually exists. Similarly, files or directories can be deleted using the delete() method. The connection should immediately be closed after a deletion to prevent exceptions from accessing a connection to a non-existent file or directory. Security To prevent unauthorized manipulation of data, access to file connections is restricted. The security model applied to the file connection is defined by the implementing profile. This security model will be applied on the invocation of the Connector.open() method with a valid file connection string. Should the application not be granted access to the file system through the profile authorization scheme, a java.lang.SecurityException will be thrown. The security model will be applied during execution, specifically when the methods openInputStream(), openDataInputStream(), openOutputStream(), openDataOutputStream(), and other file system operation methods are invoked. File access through the File System Access API is restricted in order to protect the user's files and data from malicious and unintentional access. A file connection will not be able to access RMS databases, files that are private to another application, system configuration files, and device and OS specific files. Please note that only signed applications residing in manufacturer domain will have access to the File System. The following are code samples to show implementation of the File System API: 66

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107

66
The file connection defines the first directory as the root, which corresponds to a logical
mount point for a particular storage unit or memory. The root of a file system supporting
only one card reader will return the contents of the card directly. If more than one card
reader is supported, or the device supports a file system in RAM, the root strings are
device specific. Since roots are part of the path string as a directory, they have a trailing
/
”. The valid
<root>
values for a device can be retrieved by querying open a root
connection to the root URL of the device (
file:///)
and getting the results of the
list() method. A single connection object can only reference a single file or directory. A
connection object cannot be changed dynamically to refer to a different file or directory
than originally connected to. A completely separate connection will be established through
the
Connector.open()
method to reference a different file or directory.
Connection Behavior
The File System Access API is different from other Generic Connection Framework APIs
because a connection object can successfully return from the
Connector.open()
method without referencing an existing file or directory. This method is used to allow the
creation of new files and directories on a file system. Always check for the file’s or
directory’s existence after a connection is established to determine if the file or directory
actually exists.
Similarly, files or directories can be deleted using the
delete()
method. The
connection should immediately be closed after a deletion to prevent exceptions from
accessing a connection to a non-existent file or directory.
Security
To prevent unauthorized manipulation of data, access to file connections is restricted. The
security model applied to the file connection is defined by the implementing profile. This
security model will be applied on the invocation of the
Connector.open()
method
with a valid file connection string. Should the application not be granted access to the file
system through the profile authorization scheme, a
java.lang.SecurityException
will be thrown. The security model will be
applied during execution, specifically when the methods
openInputStream()
,
openDataInputStream()
,
openOutputStream()
,
openDataOutputStream(),
and other file system operation methods are
invoked.
File access through the File System Access API is restricted in order to protect the user’s
files and data from malicious and unintentional access. A file connection will not be able to
access RMS databases, files that are private to another application, system configuration
files, and device and OS specific files.
Please note that only signed applications residing in manufacturer domain will have
access to the File System.
The following are code samples to show implementation of the File System API: