You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ApplicationResource.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.itmill.toolkit.terminal;
  5. import com.itmill.toolkit.Application;
  6. /**
  7. * This interface must be implemented by classes wishing to provide Application
  8. * resources.
  9. * <p>
  10. * <code>ApplicationResource</code> are a set of named resources (pictures,
  11. * sounds, etc) associated with some specific application. Having named
  12. * application resources provides a convenient method for having inter-theme
  13. * common resources for an application.
  14. * </p>
  15. *
  16. * @author IT Mill Ltd.
  17. * @version
  18. * @VERSION@
  19. * @since 3.0
  20. */
  21. public interface ApplicationResource extends Resource {
  22. /**
  23. * Default cache time.
  24. */
  25. public static final long DEFAULT_CACHETIME = 1000 * 60 * 60 * 24;
  26. /**
  27. * Gets resource as stream.
  28. */
  29. public DownloadStream getStream();
  30. /**
  31. * Gets the application of the resource.
  32. */
  33. public Application getApplication();
  34. /**
  35. * Gets the virtual filename for this resource.
  36. *
  37. * @return the file name associated to this resource.
  38. */
  39. public String getFilename();
  40. /**
  41. * Gets the length of cache expiration time.
  42. *
  43. * <p>
  44. * This gives the adapter the possibility cache streams sent to the client.
  45. * The caching may be made in adapter or at the client if the client
  46. * supports caching. Default is <code>DEFAULT_CACHETIME</code>.
  47. * </p>
  48. *
  49. * @return Cache time in milliseconds
  50. */
  51. public long getCacheTime();
  52. /**
  53. * Gets the size of the download buffer used for this resource.
  54. *
  55. * <p>
  56. * If the buffer size is 0, the buffer size is decided by the terminal
  57. * adapter. The default value is 0.
  58. * </p>
  59. *
  60. * @return int the size of the buffer in bytes.
  61. */
  62. public int getBufferSize();
  63. }