org.millstone.base.terminal
Class ClassResource

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

public class ClassResource
extends java.lang.Object
implements ApplicationResource

Class resource is a named resource accessed with the class loader. This can be used to access resources such as icons, files, etc.

Since:
3.0
Version:
3.0.3
Author:
IT Mill Ltd.
See Also:
Class.getResource(java.lang.String)

Field Summary
 
Fields inherited from interface org.millstone.base.terminal.ApplicationResource
DEFAULT_CACHETIME
 
Constructor Summary
ClassResource(java.lang.Class associatedClass, java.lang.String resourceName, Application application)
          Create new application resource instance.
ClassResource(java.lang.String resourceName, Application application)
          Create new application resource instance.
 
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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassResource

public ClassResource(java.lang.String resourceName,
                     Application application)
Create new application resource instance. The resource id is relative to the location of the application class.

Parameters:
resourceName - Unique identifier of the resource within the application.
application - The application this resource will be added to.

ClassResource

public ClassResource(java.lang.Class associatedClass,
                     java.lang.String resourceName,
                     Application application)
Create new application resource instance.

Parameters:
associatedClass - The class of the which the resource is associated.
resourceName - Unique identifier of the resource within the application.
application - The application this resource will be added to.
Method Detail

getMIMEType

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

Specified by:
getMIMEType in interface Resource

getApplication

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

Specified by:
getApplication in interface ApplicationResource

getFilename

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

Specified by:
getFilename in interface ApplicationResource

getStream

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

Specified by:
getStream in interface ApplicationResource

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.

getCacheTime

public long getCacheTime()
Description copied from interface: ApplicationResource
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 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.


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