diff options
Diffstat (limited to 'push/src')
-rw-r--r-- | push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java | 38 |
1 files changed, 14 insertions, 24 deletions
diff --git a/push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java b/push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java index 80b524be88..5857b7b3b2 100644 --- a/push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java +++ b/push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java @@ -15,37 +15,27 @@ */ package com.vaadin.osgi.push; -import org.osgi.service.component.ComponentContext; -import org.osgi.service.component.annotations.Activate; -import org.osgi.service.component.annotations.Component; -import org.osgi.service.component.annotations.Reference; -import org.osgi.service.http.HttpService; +import java.util.ArrayList; +import java.util.List; -import com.vaadin.osgi.resources.OsgiVaadinResources; -import com.vaadin.osgi.resources.VaadinResourceService; +import org.osgi.service.component.annotations.Component; -@Component(immediate = true) -public class PushResourcesContribution { - private HttpService httpService; +import com.vaadin.osgi.resources.OsgiVaadinContributor; +import com.vaadin.osgi.resources.OsgiVaadinResource; +@Component +public class PushResourcesContribution implements OsgiVaadinContributor { private static final String[] RESOURCES = { "vaadinPush.js", "vaadinPush.js.gz", "vaadinPush.debug.js", "vaadinPush.debug.js.gz" }; - @Activate - void startup(ComponentContext context) throws Exception { - 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 httpService) { - this.httpService = httpService; - } - - void unsetHttpService(HttpService httpService) { - this.httpService = null; + return contributions; } } |