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.

VaadinResourceService.java 3.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * Copyright 2000-2018 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.osgi.resources;
  17. import org.osgi.service.http.HttpService;
  18. import org.osgi.service.http.NamespaceException;
  19. /**
  20. * Service used to publish themes, widgetsets and static resources at the root
  21. * of a versioned namespaced /VAADIN/ folder.
  22. *
  23. * @author Vaadin Ltd.
  24. *
  25. * @since 8.1
  26. */
  27. public interface VaadinResourceService {
  28. /**
  29. * Register the theme with the given name under the
  30. * {@link VaadinResourceService} versioned namespace. The theme folder is
  31. * expected to be compiled and under "/VAADIN/themes/" in the calling
  32. * bundle.
  33. *
  34. * The theme will become accessible under the url
  35. * "/vaadin-x.x.x/VAADIN/themes/themeName" where x.x.x is the version of the
  36. * Vaadin Shared bundle
  37. *
  38. * @param themeName
  39. * the name of the theme
  40. * @param httpService
  41. * the {@link HttpService} instance for the calling bundle
  42. * @throws NamespaceException
  43. * if there is a clash during the theme registration
  44. */
  45. void publishTheme(String themeName, HttpService httpService)
  46. throws NamespaceException;
  47. /**
  48. * Register the resource with the given name under the
  49. * {@link VaadinResourceService} versioned namespace. The resource is
  50. * expected to be under "/VAADIN/" in the calling bundle.
  51. *
  52. * The resource will become accessible under the url "/vaadin-x.x.x/VAADIN/"
  53. * where x.x.x is the version of the Vaadin Shared bundle
  54. *
  55. * @param resourceName
  56. * the name of the resource
  57. * @param httpService
  58. * the {@link HttpService} instance for the calling bundle
  59. * @throws NamespaceException
  60. * if there is a clash during the theme registration
  61. */
  62. void publishResource(String resourceName, HttpService httpService)
  63. throws NamespaceException;
  64. /**
  65. * Register the widgetset with the given name under the
  66. * {@link VaadinResourceService} versioned namespace. The resource is
  67. * expected to be under "/VAADIN/widgetsets" in the calling bundle.
  68. *
  69. * The resource will become accessible under the url
  70. * "/vaadin-x.x.x/VAADIN/widgetsets" where x.x.x is the version of the
  71. * Vaadin Shared bundle
  72. *
  73. * @param widgetsetName
  74. * the name of the resource
  75. * @param httpService
  76. * the {@link HttpService} instance for the calling bundle
  77. * @throws NamespaceException
  78. * if there is a clash during the theme registration
  79. */
  80. void publishWidgetset(String widgetsetName, HttpService httpService)
  81. throws NamespaceException;
  82. /**
  83. * Returns the prefix of the versioned namespace for the resources. The
  84. * result can't be null and is of the format "vaadin-x.x.x" where x.x.x the
  85. * version of the Vaadin Shared bundle.
  86. *
  87. * @return the prefix of the resources folder managed by this service
  88. */
  89. String getResourcePathPrefix();
  90. }