Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.webapps.bean
Class ServletFile  view ServletFile download ServletFile.java

java.lang.Object
  extended bycom.RuntimeCollective.webapps.bean.ServletFile
All Implemented Interfaces:
DBFile, EntityBean, java.util.EventListener, javax.servlet.http.HttpSessionBindingListener, java.io.Serializable

public class ServletFile
extends java.lang.Object
implements javax.servlet.http.HttpSessionBindingListener, DBFile

A wrapper to a DBFile which makes it more convenient to use in a servlet context.

Version:
$Id: ServletFile.java,v 1.8 2003/09/30 15:13:09 joe Exp $

Field Summary
static java.lang.String COMMA
           
static java.lang.String DATABASE_TABLE
           
static java.lang.String DELETE
           
static java.lang.String END_VALUES
           
private  DBFile file
           
static java.lang.String FROM_FILE
           
static java.lang.String INSERT
           
static java.lang.String REAL_URL
           
static java.lang.String SELECT_TEMP_BLOB_WHERE_ID_EQUALS
           
static java.lang.String TEMP_BLOB_COLUMN
           
static java.lang.String TEMP_FILE_TOKEN
          The binding name for the temporary file marker.
static java.lang.String TEMP_URL
           
static java.lang.String WHERE_BLOB_ID_EQUALS
           
static java.lang.String WHERE_ID_EQUALS
           
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
ServletFile(DBFile file)
           
 
Method Summary
 void delete()
          Delete this bean from the database.
 void deleteTempFile()
           
 DBFile getFile()
          get the file.
 byte[] getFileData()
          get the FileData.
 int getId()
          get the id.
 java.lang.String getMimeType()
          get the mimeType.
 java.lang.String getName()
          get the name.
private  java.lang.String getRealUrl(boolean temp)
           
static byte[] getTempFileData(int id)
           
 java.lang.String getTempUrl()
           
 java.lang.String getUrl()
          get the url for this file.
 void save()
          Save this bean to the database.
 void saveTempFile(javax.servlet.http.HttpServletRequest request)
           
 void setFile(DBFile file)
          set the file.
 void setFileData(byte[] fileData)
          set the FileData.
 void setId(int id)
          set the id.
 void setMimeType(java.lang.String mimeType)
          set the mimeType.
 void setName(java.lang.String name)
          set the name.
 void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
          Notifies the object that it is being bound to a session and identifies the session.
 void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
          Notifies the object that it is being unbound from a session and identifies the session.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TEMP_FILE_TOKEN

public static final java.lang.String TEMP_FILE_TOKEN
The binding name for the temporary file marker. If the user's session expires before the temporary file is deleted, then it will be deleted in the session unbind event handler.

See Also:
Constant Field Values

file

private DBFile file

REAL_URL

public static final java.lang.String REAL_URL
See Also:
Constant Field Values

TEMP_URL

public static final java.lang.String TEMP_URL
See Also:
Constant Field Values

TEMP_BLOB_COLUMN

public static final java.lang.String TEMP_BLOB_COLUMN
See Also:
Constant Field Values

WHERE_BLOB_ID_EQUALS

public static final java.lang.String WHERE_BLOB_ID_EQUALS
See Also:
Constant Field Values

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
See Also:
Constant Field Values

SELECT_TEMP_BLOB_WHERE_ID_EQUALS

public static final java.lang.String SELECT_TEMP_BLOB_WHERE_ID_EQUALS
See Also:
Constant Field Values

DELETE

public static final java.lang.String DELETE
See Also:
Constant Field Values

FROM_FILE

public static final java.lang.String FROM_FILE
See Also:
Constant Field Values

WHERE_ID_EQUALS

public static final java.lang.String WHERE_ID_EQUALS
See Also:
Constant Field Values

INSERT

public static final java.lang.String INSERT
See Also:
Constant Field Values

COMMA

public static final java.lang.String COMMA
See Also:
Constant Field Values

END_VALUES

public static final java.lang.String END_VALUES
See Also:
Constant Field Values
Constructor Detail

ServletFile

public ServletFile(DBFile file)
Method Detail

save

public void save()
          throws java.sql.SQLException
Description copied from interface: EntityBean
Save this bean to the database.

Specified by:
save in interface EntityBean

delete

public void delete()
            throws java.sql.SQLException
Description copied from interface: EntityBean
Delete this bean from the database. It is up to the particular subclass whether the bean is deleted the database entirely, or just marked as 'archived' -- as long as it is no longer returned by the EntityBean(id) constructor.

Specified by:
delete in interface EntityBean

getFile

public DBFile getFile()
get the file.


setFile

public void setFile(DBFile file)
set the file.


getId

public int getId()
get the id.

Specified by:
getId in interface EntityBean

setId

public void setId(int id)
set the id.

Specified by:
setId in interface EntityBean

getName

public java.lang.String getName()
get the name.

Specified by:
getName in interface DBFile

setName

public void setName(java.lang.String name)
set the name.

Specified by:
setName in interface DBFile

getMimeType

public java.lang.String getMimeType()
get the mimeType.

Specified by:
getMimeType in interface DBFile

setMimeType

public void setMimeType(java.lang.String mimeType)
set the mimeType.

Specified by:
setMimeType in interface DBFile

getFileData

public byte[] getFileData()
get the FileData.

Specified by:
getFileData in interface DBFile

setFileData

public void setFileData(byte[] fileData)
set the FileData.

Specified by:
setFileData in interface DBFile

getUrl

public java.lang.String getUrl()
get the url for this file.


getTempUrl

public java.lang.String getTempUrl()

getRealUrl

private java.lang.String getRealUrl(boolean temp)

saveTempFile

public void saveTempFile(javax.servlet.http.HttpServletRequest request)
                  throws java.io.IOException

deleteTempFile

public void deleteTempFile()
                    throws java.sql.SQLException

valueBound

public void valueBound(javax.servlet.http.HttpSessionBindingEvent event)
Description copied from interface: javax.servlet.http.HttpSessionBindingListener
Notifies the object that it is being bound to a session and identifies the session.

Specified by:
valueBound in interface javax.servlet.http.HttpSessionBindingListener

valueUnbound

public void valueUnbound(javax.servlet.http.HttpSessionBindingEvent event)
Description copied from interface: javax.servlet.http.HttpSessionBindingListener
Notifies the object that it is being unbound from a session and identifies the session.

Specified by:
valueUnbound in interface javax.servlet.http.HttpSessionBindingListener

getTempFileData

public static byte[] getTempFileData(int id)