diff options
author | S.W <wimmesberger@gmail.com> | 2018-09-21 10:01:52 +0200 |
---|---|---|
committer | Ilia Motornyi <elmot@vaadin.com> | 2018-09-21 11:01:52 +0300 |
commit | 7e89b5e3348be487110bd8a5c60336ff363cf9d6 (patch) | |
tree | 4913034eb366e7173bc083abae4c6ba3b9a19402 /server/src | |
parent | c534fb8e609c38c7b4821b5f79ec697b384c0809 (diff) | |
download | vaadin-framework-7e89b5e3348be487110bd8a5c60336ff363cf9d6.tar.gz vaadin-framework-7e89b5e3348be487110bd8a5c60336ff363cf9d6.zip |
OSGi resource registration via SCR (#11166)
* Changed the way resources, themes, and widgetsets are registered to the HttpService by only using the VaadinResourceTrackerComponent
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java b/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java index 05966f4f2b..17e2e711e6 100644 --- a/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java +++ b/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java @@ -15,15 +15,13 @@ */ package com.vaadin.server.osgi; -import org.osgi.service.component.annotations.Activate; +import java.util.ArrayList; +import java.util.List; + import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Reference; -import org.osgi.service.http.HttpService; -import org.osgi.service.http.NamespaceException; -import com.vaadin.osgi.resources.OsgiVaadinResources; -import com.vaadin.osgi.resources.OsgiVaadinResources.ResourceBundleInactiveException; -import com.vaadin.osgi.resources.VaadinResourceService; +import com.vaadin.osgi.resources.OsgiVaadinContributor; +import com.vaadin.osgi.resources.OsgiVaadinResource; /** * OSGi service component registering bootstrap JS as published resources in @@ -32,26 +30,18 @@ import com.vaadin.osgi.resources.VaadinResourceService; * @author Vaadin Ltd * @since 8.1 */ -@Component(immediate = true) -public class BootstrapContribution { +@Component +public class BootstrapContribution implements OsgiVaadinContributor { private static final String[] RESOURCES = { "vaadinBootstrap.js", "vaadinBootstrap.js.gz" }; - private HttpService httpService; - @Activate - void startup() throws NamespaceException, ResourceBundleInactiveException { - VaadinResourceService service = OsgiVaadinResources.getService(); - for (String resourceName : RESOURCES) { - service.publishResource(resourceName, httpService); + @Override + public List<OsgiVaadinResource> getContributions() { + final List<OsgiVaadinResource> contributions = new ArrayList<>( + RESOURCES.length); + for (final String theme : RESOURCES) { + contributions.add(OsgiVaadinResource.create(theme)); } - } - - @Reference - void setHttpService(HttpService service) { - httpService = service; - } - - void unsetHttpService(HttpService service) { - httpService = null; + return contributions; } } |