org.vrspace.server.object
Class File
java.lang.Object
java.util.Observable
org.vrspace.server.VRObject
org.vrspace.server.DBObject
org.vrspace.server.PublicDBObject
org.vrspace.server.OwnedDBObject
org.vrspace.server.object.File
- All Implemented Interfaces:
- java.lang.Cloneable, java.util.Observer, Owned
- Direct Known Subclasses:
- VrmlFile
- public class File
- extends OwnedDBObject
- implements java.util.Observer
A File. This VRObject should be used for files not expected to
have a Transform. For example, images, binaries, etc...
The contents of the file are pointed to by its url NetResource.
Fields inherited from class org.vrspace.server.DBObject |
db |
Constructor Summary |
File()
|
Methods inherited from class org.vrspace.server.VRObject |
arrayToString, canRead, canWrite, clone, equals, fieldToText, fromString, fromText, getClassName, getField, getFields, getId, getID, getMemebers, hasField, hasMethod, isNew, newInstance, sendResponse, setField, setField, setField, setFields, setFields, stringToArray, toString, toText, toText, toText |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
name
public java.lang.String name
url
public NetResource url
_uploads
public int _uploads
_downloads
public int _downloads
_lastUpdate
public long _lastUpdate
publicRole
protected static Role publicRole
ownerRole
protected static Role ownerRole
File
public File()
set_upload
public void set_upload(Request req,
java.lang.String value)
throws java.lang.Exception
- Initiate file upload.
Replaces this File's url and initiates the file transfer by responding
to the client with an upload command.
Usage: upload path
- Throws:
java.lang.Exception
encodeAsURI
public static java.lang.String encodeAsURI(java.lang.String preURI)
throws java.net.URISyntaxException
- Throws:
java.net.URISyntaxException
set_download
public void set_download(Request req,
java.lang.String value)
throws java.lang.Exception
- Initiate file download. Not implemented.
Usage: download dummy_value
- Throws:
java.lang.Exception
update
public void update(java.util.Observable session,
java.lang.Object signal)
- Specified by:
update
in interface java.util.Observer
sendEvent
public void sendEvent(Request req)
throws RequestException
- Overrides OwnedDBObject.sendEvent().
This method calls super.sendEvent() and if a RequestException is not thrown, the method exits.
Otherwise the method calls setChanged() and then setValue(). In effect, this
implements all the functionality of its ancestors, but if the event corresponds
to an unknown field or method, simply forwards it to all observers.
- Overrides:
sendEvent
in class OwnedDBObject
- Throws:
RequestException
grantAccess
protected boolean grantAccess(Request req)
processEvent
public void processEvent(Request req)
throws RequestException
- Description copied from class:
OwnedDBObject
- Process a request. Called from sendEvent if request comes from owner. Intedend for use by sublcasses, utility function.
- Overrides:
processEvent
in class OwnedDBObject
- Throws:
RequestException
setValue
public void setValue(Request r)
- Overrides PublicDbObject.setValue() .
Upload/download events are filtered. Clients are notified of all other
requests.
- Overrides:
setValue
in class PublicDBObject
getClassAndId
public java.lang.String getClassAndId(Request req)