ccs.cpc
Class VDevice

java.lang.Object
  extended by ccs.cpc.VDevice
All Implemented Interfaces:
ccs.utils.Hurlable
Direct Known Subclasses:
ArchVDevice, DiskVDevice, ResultsVDevice, ZipVDevice

public abstract class VDevice
extends java.lang.Object
implements ccs.utils.Hurlable

A "virtual device". This can be either a drive (lose32), the filesystem (unix and anybody who isn't recognised) a CDB or a jar/zip file. If the device implements java.util.Comparator, the Browser panels will sort by that comparator rather than using the default; this is used by the ResultsVDevice. This implements Hurlable as a convenience for devices or files that require it - typically this is only for operations that throw asynchronously, and at the time of writing only DiskVFile wipe ops do this.


Constructor Summary
VDevice(CpCmdr cpc, ccs.utils.Hurlable hurlable)
          Construct a VDevice.
 
Method Summary
 ccs.cdb.CDBeeTree getCPAIffArchive()
          Blatant special-pleading hack, required to avoid excessive latency when streaming large files from CPAs.
 CpCmdr getCPC()
           
 java.lang.String getID()
          returns a unique ID.
abstract  java.lang.String getName()
          returns the device identifier, for listing purposes.
abstract  VFile getRoot()
          returns root directory
abstract  java.lang.String getSeparator()
          returns the path element separator.
abstract  char getSeparatorChar()
          the separator, as a char.
abstract  java.lang.String getShortName()
          returns the device identifier, for changing directory.
abstract  int getStoredPwdPrefixLength()
          The length of prefix to remove from a stored pwd (to implement "stateful devices" whereby when you return to a device after leaving it abruptly, you get straight back to the same place) to obtain a path relative to the device root which can then be walked.
 java.lang.String getTitlePrefix()
          returns the prefix that will appear in the title bar of the browser, before the pwd path.
abstract  VDeviceLister getVDL()
          returns the object which lists all devices currently available.
 void hurl(java.lang.Throwable e)
          hurl asynch exceptions this way to have them reported
 boolean isNoCopy()
          returns whether copy-protection is enforced on this device.
 boolean isReal()
          Whether this device actually provides storage space for its contents.
 boolean isSort()
          Whether this device should be sorted automatically: some devices sort / order their own contents instead, and don't want the standard sort.
protected abstract  void marshalIDSlug(java.io.DataOutputStream dos)
          Every device requires a unique ID.
abstract  void umount()
          closes the VDevice (to let it be removed from the list).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VDevice

public VDevice(CpCmdr cpc,
               ccs.utils.Hurlable hurlable)
Construct a VDevice. Its idea of implementing hurlable is to require you to supply one for it to delegate to.

Method Detail

getSeparator

public abstract java.lang.String getSeparator()
returns the path element separator.


getSeparatorChar

public abstract char getSeparatorChar()
the separator, as a char.


getRoot

public abstract VFile getRoot()
returns root directory


getName

public abstract java.lang.String getName()
returns the device identifier, for listing purposes.


getTitlePrefix

public java.lang.String getTitlePrefix()
returns the prefix that will appear in the title bar of the browser, before the pwd path.


getShortName

public abstract java.lang.String getShortName()
returns the device identifier, for changing directory. This is whatever punter would have to type to get to the root directory of the device. Thus we can get to device root somehow (which is usually easy), cull the short name, and carry on in a simple fashion. Other definitions get all hot and bothered about drive letters in DOS vs / for root FS in unix etc.


getStoredPwdPrefixLength

public abstract int getStoredPwdPrefixLength()
The length of prefix to remove from a stored pwd (to implement "stateful devices" whereby when you return to a device after leaving it abruptly, you get straight back to the same place) to obtain a path relative to the device root which can then be walked.


getVDL

public abstract VDeviceLister getVDL()
returns the object which lists all devices currently available.


umount

public abstract void umount()
closes the VDevice (to let it be removed from the list). the "n" from this unmount has gone missing. If you find it, please return it.


getCPC

public final CpCmdr getCPC()

getID

public final java.lang.String getID()
returns a unique ID.


marshalIDSlug

protected abstract void marshalIDSlug(java.io.DataOutputStream dos)
                               throws java.io.IOException
Every device requires a unique ID. For everything except result sets, this must also be persistent. This method must marshal suitable information to create such an ID. Start with a fixed char which specifies the device type: 'd' for disks, 'a' for archives (and CPC+ registered archives), 'z' for jars / zips, 'r' for result sets. Then add enough information to identify the device uniquely within its namespace.

Parameters:
dos - The stream to marshal this lot onto. You should only send as much as you need to identify the device - say, a few hundred bytes, tops.
Throws:
java.io.IOException - if the stream blows up - this shouldn't happen.

isNoCopy

public boolean isNoCopy()
returns whether copy-protection is enforced on this device.


hurl

public void hurl(java.lang.Throwable e)
hurl asynch exceptions this way to have them reported

Specified by:
hurl in interface ccs.utils.Hurlable
Parameters:
e - That which happened.

isReal

public boolean isReal()
Whether this device actually provides storage space for its contents. ResultsVDevices don't, all others do. (ATM).


isSort

public boolean isSort()
Whether this device should be sorted automatically: some devices sort / order their own contents instead, and don't want the standard sort. Currently only ResultVDevices do this.


getCPAIffArchive

public ccs.cdb.CDBeeTree getCPAIffArchive()
Blatant special-pleading hack, required to avoid excessive latency when streaming large files from CPAs.