org.millstone.base.terminal
Class FileResource

java.lang.Object
  |
  +--org.millstone.base.terminal.FileResource
All Implemented Interfaces:
ApplicationResource, Resource

public class FileResource
extends java.lang.Object
implements ApplicationResource

File resources are files or directories on local filesystem. The files and directories are served trough URI:s to the client terminal and thus must be registered to an URI context before they can be used. The resource is automatically registered to the application when it is created.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.

Field Summary
 
Fields inherited from interface org.millstone.base.terminal.ApplicationResource
DEFAULT_CACHETIME
 
Constructor Summary
FileResource(java.io.File sourceFile, Application application)
          Create new file resource for providing given file for client terminals.
 
Method Summary
 Application getApplication()
          Get the application of the resource
 int getBufferSize()
          Get the size of the download buffer used for this resource.
 long getCacheTime()
          Get lenght of cache expiracy time.
 java.lang.String getFilename()
          Get virtual filename for the resource
 java.lang.String getMIMEType()
          Get the MIME type of the resource.
 java.io.File getSourceFile()
          Returns the source file.
 DownloadStream getStream()
          Get resource as stream
 void setBufferSize(int bufferSize)
          Set the size of the download buffer used for this resource.
 void setCacheTime(long cacheTime)
          Set lenght of cache expiracy time.
 void setSourceFile(java.io.File sourceFile)
          Sets the source file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileResource

public FileResource(java.io.File sourceFile,
                    Application application)
Create new file resource for providing given file for client terminals.

Method Detail

getStream

public DownloadStream getStream()
Description copied from interface: ApplicationResource
Get resource as stream

Specified by:
getStream in interface ApplicationResource

getSourceFile

public java.io.File getSourceFile()
Returns the source file.

Returns:
File

setSourceFile

public void setSourceFile(java.io.File sourceFile)
Sets the source file.

Parameters:
sourceFile - The source file to set

getApplication

public Application getApplication()
Description copied from interface: ApplicationResource
Get the application of the resource

Specified by:
getApplication in interface ApplicationResource
See Also:
ApplicationResource.getApplication()

getFilename

public java.lang.String getFilename()
Description copied from interface: ApplicationResource
Get virtual filename for the resource

Specified by:
getFilename in interface ApplicationResource
See Also:
ApplicationResource.getFilename()

getMIMEType

public java.lang.String getMIMEType()
Description copied from interface: Resource
Get the MIME type of the resource.

Specified by:
getMIMEType in interface Resource
See Also:
Resource.getMIMEType()

getCacheTime

public long getCacheTime()
Get lenght of cache expiracy time. This gives the adapter the possibility cache streams sent to the client. The caching may be made in adapter or at the client if the client supports caching. Default is DownloadStream.DEFAULT_CACHETIME.

Specified by:
getCacheTime in interface ApplicationResource
Returns:
Cache time in milliseconds

setCacheTime

public void setCacheTime(long cacheTime)
Set lenght of cache expiracy time. This gives the adapter the possibility cache streams sent to the client. The caching may be made in adapter or at the client if the client supports caching. Zero or negavive value disbales the caching of this stream.

Parameters:
cacheTime - The cache time in milliseconds.

getBufferSize

public int getBufferSize()
Description copied from interface: ApplicationResource
Get the size of the download buffer used for this resource.

If the buffer size is 0, the buffer size is decided by the terminal adapter. The default value is 0.

Specified by:
getBufferSize in interface ApplicationResource
Returns:
int The size of the buffer in bytes.

setBufferSize

public void setBufferSize(int bufferSize)
Set the size of the download buffer used for this resource.

Parameters:
bufferSize - The size of the buffer in bytes.


Copyright © 2000,2001,2002 IT Mill Ltd. All Rights Reserved.