SmartFrog 3.10.000

org.smartfrog.services.filesystem.filestore
Class FileEntryImpl

java.lang.Object
  extended by org.smartfrog.services.filesystem.filestore.FileEntryImpl
All Implemented Interfaces:
java.rmi.Remote, FileEntry

public class FileEntryImpl
extends java.lang.Object
implements FileEntry

What is stored in our table of files


Constructor Summary
FileEntryImpl(java.io.File file)
          Constructor.
 
Method Summary
 void addMetadata(java.lang.String key, java.lang.Object metadata)
          Add metadata to the system
 void append(byte[] content)
          Append data to the file.
 boolean equals(java.lang.Object o)
          Compares the Object
 boolean exists()
          Test for a file existing.
 java.io.File getFile()
          Get File
 java.lang.Object getMetadata()
          Get metadata
 java.lang.String getMimetype()
          Get MIME type
 java.net.URI getUri()
          Get URI
 int hashCode()
          Returns the hashcode
 java.lang.Object lookupMetadata(java.lang.String key)
          Look up a piece of metadata
 void setMetadata(java.lang.Object metadata)
          Set metadata
 void setMimetype(java.lang.String mimetype)
          Set MIME type
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileEntryImpl

public FileEntryImpl(java.io.File file)
Constructor.

Parameters:
file - file
Method Detail

getFile

public java.io.File getFile()
Get File

Specified by:
getFile in interface FileEntry
Returns:
File

getUri

public java.net.URI getUri()
Get URI

Specified by:
getUri in interface FileEntry
Returns:
URI

lookupMetadata

public java.lang.Object lookupMetadata(java.lang.String key)
Look up a piece of metadata

Specified by:
lookupMetadata in interface FileEntry
Parameters:
key - String name
Returns:
the object stored under there

addMetadata

public void addMetadata(java.lang.String key,
                        java.lang.Object metadata)
Add metadata to the system

Parameters:
key - String name
metadata - value

getMimetype

public java.lang.String getMimetype()
Get MIME type

Specified by:
getMimetype in interface FileEntry
Returns:
String

setMimetype

public void setMimetype(java.lang.String mimetype)
Set MIME type

Specified by:
setMimetype in interface FileEntry
Parameters:
mimetype - String

getMetadata

public java.lang.Object getMetadata()
Get metadata

Specified by:
getMetadata in interface FileEntry
Returns:
Object

setMetadata

public void setMetadata(java.lang.Object metadata)
Set metadata

Specified by:
setMetadata in interface FileEntry
Parameters:
metadata - Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.

equals

public boolean equals(java.lang.Object o)
Compares the Object

Overrides:
equals in class java.lang.Object
Parameters:
o - Object
Returns:
boolean

hashCode

public int hashCode()
Returns the hashcode

Overrides:
hashCode in class java.lang.Object
Returns:
int

append

public void append(byte[] content)
            throws java.rmi.RemoteException,
                   java.io.IOException
Append data to the file. After the write the buffer is flushed and the file is unlocked.

To do an atomic update, write everything in one go. To do a less-effient but potentially less costly-over-the-wire update, write in a few large blocks.

There is no equivalent operation to get the content back.

Specified by:
append in interface FileEntry
Parameters:
content - byte array of content
Throws:
java.rmi.RemoteException - if something went wrong over the wire
java.io.IOException - if something went wrong saving the content

exists

public boolean exists()
               throws java.rmi.RemoteException
Test for a file existing.

Specified by:
exists in interface FileEntry
Returns:
boolean
Throws:
java.rmi.RemoteException - In case of network/rmi error

SmartFrog CORE 3.10.000

(C) Copyright 1998-2006 Hewlett-Packard Development Company, LP