public interface StorageProxy extends ResourceProxy
StorageManager
.
A StorageProxy may contain one or more logical volumes. See LogicalStorageVolume
. A LogicalStorageVolume is a construct for organizing files on a
disk and corresponds to a directory subtree that is treated as a whole for some
purposes. A StorageProxy only represents the application visible storage on the device,
i.e. it does not include portions of the device reserved for internal system use.
If this proxy represents a detachable or hot-pluggable device, the proxy is not listed
until the device is connected. When a storage device is attached, the proxy is added
to the list returned by the StorageManager and an appropriate event is sent to any
StorageManagerListener
registered with the StorageManager
. When a
storage device is no longer available for use (or for reactivation after being made
detachable), the corresponding proxy is removed from the StorageManager's list and a
StorageManagerEvent
is sent to any StorageManagerListeners registered with the
StorageManager.
StorageProxy extends ResourceProxy as an implementation convenience for resource contention handling. This ResourceProxy is not meant for access by applications and the StorageProxy.getClient method SHALL always return null. (
Modifier and Type | Field and Description |
---|---|
static int |
BUSY
Returned by
getStatus() to indicate that the device is busy, e.g., being
initialized, configured, checked for consistency or being made ready to detach. |
static int |
DEVICE_ERROR
Returned by
getStatus() to indicate that the device is in an unrecoverable
error state and cannot be used. |
static int |
NOT_PRESENT
Returned by
getStatus() to indicate that a detected storage
device bay does not contain a removable storage device, i.e. |
static int |
OFFLINE
Returned by
getStatus() to indicate that the device is present but some
other action is required before the device can be used (e.g., DetachableStorageOption.makeReady() ). |
static int |
READY
Returned by
getStatus() to indicate that the device is initialized, mounted
and ready for use. |
static int |
UNINITIALIZED
Returned by
getStatus() to indicate that the device is completely
uninitialized and contains no existing data. |
static int |
UNSUPPORTED_DEVICE
Returned by
getStatus() to indicate that the device that has been plugged in
is not supported by the platform. |
static int |
UNSUPPORTED_FORMAT
Returned by
getStatus() to indicate that although the device is a supported
type and model, it currently has a format, e.g., partitions or filesystems, that is
not usable by the platform without reinitialization and the loss of the existing
contents. |
Modifier and Type | Method and Description |
---|---|
LogicalStorageVolume |
allocateGeneralPurposeVolume(String name,
ExtendedFileAccessPermissions fap)
Allocates a general purpose
LogicalStorageVolume . |
void |
deleteVolume(LogicalStorageVolume vsp)
Deletes a
LogicalStorageVolume . |
String |
getDisplayName()
Gets a storage device name that can be displayed to a user for selection.
|
long |
getFreeSpace()
Gets the available storage capacity in bytes.
|
String |
getName()
Gets the storage device name assigned by the implementation.
|
StorageOption[] |
getOptions()
Gets the array of storage device options (e.g.,
DetachableStorageOption ). |
int |
getStatus()
Returns the status of the storage device.
|
boolean[] |
getSupportedAccessRights()
Gets the permissions supported by this storage device.
|
long |
getTotalSpace()
Gets the total storage capacity of the device in bytes.
|
LogicalStorageVolume[] |
getVolumes()
Gets the set of logical volumes present on the StorageProxy.
|
void |
initialize(boolean userAuthorized)
Initializes the StorageProxy for use.
|
getClient
static final int READY
getStatus()
to indicate that the device is initialized, mounted
and ready for use.static final int OFFLINE
getStatus()
to indicate that the device is present but some
other action is required before the device can be used (e.g., DetachableStorageOption.makeReady()
).static final int BUSY
getStatus()
to indicate that the device is busy, e.g., being
initialized, configured, checked for consistency or being made ready to detach.
This value is not used to indicate that the device is currently reading or writing
data.static final int UNSUPPORTED_DEVICE
getStatus()
to indicate that the device that has been plugged in
is not supported by the platform.static final int UNSUPPORTED_FORMAT
getStatus()
to indicate that although the device is a supported
type and model, it currently has a format, e.g., partitions or filesystems, that is
not usable by the platform without reinitialization and the loss of the existing
contents.static final int UNINITIALIZED
getStatus()
to indicate that the device is completely
uninitialized and contains no existing data. It must be initialized by calling the
initialize method to make the device is usable.static final int DEVICE_ERROR
getStatus()
to indicate that the device is in an unrecoverable
error state and cannot be used.static final int NOT_PRESENT
getStatus()
to indicate that a detected storage
device bay does not contain a removable storage device, i.e.
StorageProxy
containing a RemovableStorageOption
.String getName()
String getDisplayName()
StorageOption[] getOptions()
DetachableStorageOption
).int getStatus()
StorageManagerListener
with
StorageManager.addStorageManagerListener()
.long getTotalSpace()
long getFreeSpace()
LogicalStorageVolume[] getVolumes()
boolean[] getSupportedAccessRights()
LogicalStorageVolume allocateGeneralPurposeVolume(String name, ExtendedFileAccessPermissions fap) throws IOException
LogicalStorageVolume
. A general purpose volume
can be accessed through file locators and java.io with the absolute path retrieved
from LogicalStorageVolume.getPath()
. Specialized storage proxies may
support other types of volumes, such as media volumes used to store DVR content.
The volume is owned by the application that allocated it (see deleteVolume(org.ocap.storage.LogicalStorageVolume)
).
The name parameter SHALL be used as the last directory name in the absolute path
of the logical storage volume when created.name
- Name of the new LogicalStorageVolume. Must be unique for
the organization and application identifiers in the path on this
StorageProxy.fap
- Application access permissions of the new LogicalStorageVolume. Applies to
the last directory in the path returned by getPath.IllegalArgumentException
- if the name does not meet the persistentfilename form
specified by DVB-MHP 1.0.3 chapter 14, or if the length is greater than 255, or
if the name is not unique, or if the storage device does not support an access
permission specified in the fap parameter.IOException
- if the storage device represented by the StorageProxy
is read-only based on a hardware constraint. The
getSupportedAccessRights
method indicates if the
StorageProxy
can be written to by the calling application.SecurityException
- if the calling application does not have persistent
storage permission as requested by its permission request file.void deleteVolume(LogicalStorageVolume vsp)
LogicalStorageVolume
. Only the owning application or a
privileged application with MonitorAppPermission("storage") may delete a volume.
This causes all of the file and directories within the volume to be destroyed.
This method deletes the volume regardless of file locks.vsp
- LogicalStorageVolume to delete.SecurityException
- if the calling application is not the owner of the volume or
an application with MonitorAppPermission("storage").void initialize(boolean userAuthorized)
UNSUPPORTED_FORMAT
state. It is only required to be effective on
detachable storage devices, but may be implemented for other types of devices as
well. Successful invocation of this method destroys all application visible
contents of the device and should not be called unless the application has
determined, e.g., by prompting the user, that it is safe to do so. If the
StorageProxy was in the READY
state and has storage visible to the
application, access to that storage is removed and the StorageProxy enters the
BUSY
state until this method returns.userAuthorized
- True if the application has received authorization from the
user for the destruction of the contents of this device. The implementation may
use this to determine whether it needs to perform additional user prompting.SecurityException
- if the calling application does not have
MonitorAppPermission("storage").IllegalStateException
- if the system is unable to initialize the storage
device. If the device was in the UNINITIALIZED
state and the error is
permanent, the StorageProxy status is set to DEVICE_ERROR
.Copyright © 2013 CableLabs. All rights reserved.