Connection Behavior; Security - Motorola E680 - Smartphone - GSM Developer's Manual

Micro edition (j2me) applications
Hide thumbs Also See for E680 - Smartphone - GSM:
Table of Contents

Advertisement

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:
66

Advertisement

Table of Contents
loading

Table of Contents