- Rename OSGi to Osgi in class names. - Rename VaadinOSGiPortlet to OSGiVaadinPortlet for consistency with Spring, CDI etc. add-ons - Add missing javadoctags/8.1.0.alpha8
import org.osgi.service.component.annotations.Reference; | import org.osgi.service.component.annotations.Reference; | ||||
import org.osgi.service.http.HttpService; | import org.osgi.service.http.HttpService; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
@Component(immediate = true) | @Component(immediate = true) | ||||
@Activate | @Activate | ||||
void startup(ComponentContext context) throws Exception { | void startup(ComponentContext context) throws Exception { | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
service.publishWidgetset(WIDGETSET_NAME, httpService); | service.publishWidgetset(WIDGETSET_NAME, httpService); | ||||
} | } | ||||
import org.osgi.service.component.annotations.Reference; | import org.osgi.service.component.annotations.Reference; | ||||
import org.osgi.service.http.HttpService; | import org.osgi.service.http.HttpService; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
@Component(immediate = true) | @Component(immediate = true) | ||||
@Activate | @Activate | ||||
void startup(ComponentContext context) throws Exception { | void startup(ComponentContext context) throws Exception { | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
service.publishWidgetset(WIDGETSET_NAME, httpService); | service.publishWidgetset(WIDGETSET_NAME, httpService); | ||||
} | } | ||||
import org.osgi.service.component.annotations.Reference; | import org.osgi.service.component.annotations.Reference; | ||||
import org.osgi.service.http.HttpService; | import org.osgi.service.http.HttpService; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
@Component(immediate = true) | @Component(immediate = true) | ||||
@Activate | @Activate | ||||
void startup() throws Exception { | void startup() throws Exception { | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
for (String themeName : LEGACY_THEMES) { | for (String themeName : LEGACY_THEMES) { | ||||
service.publishTheme(themeName, httpService); | service.publishTheme(themeName, httpService); | ||||
} | } |
Vaadin Framework 8.1 and later versions provide two supported ways of publishing static resources for OSGi: by making OSGi services implementing an interface or by explicit calls to a service. | Vaadin Framework 8.1 and later versions provide two supported ways of publishing static resources for OSGi: by making OSGi services implementing an interface or by explicit calls to a service. | ||||
The easiest way to publish a theme or a widgetset is to create a class implementing the interface [interfacename]#OSGiVaadinTheme# or [interfacename]#OSGiVaadinWidgetset# and annotating it with [interfacename]#@Component# to make it an OSGi service. This automatically publishes the theme or the widget set from the bundle at a path that contains the Vaadin Framework version used by the application. | |||||
The easiest way to publish a theme or a widgetset is to create a class implementing the interface [interfacename]#OsgiVaadinTheme# or [interfacename]#OsgiVaadinWidgetset# and annotating it with [interfacename]#@Component# to make it an OSGi service. This automatically publishes the theme or the widget set from the bundle at a path that contains the Vaadin Framework version used by the application. | |||||
[source, java] | [source, java] | ||||
---- | ---- | ||||
@Component | @Component | ||||
public class MyTheme extends ValoTheme implements OSGiVaadinTheme { | |||||
public class MyTheme extends ValoTheme implements OsgiVaadinTheme { | |||||
public static final String THEME_NAME = "mytheme"; | public static final String THEME_NAME = "mytheme"; | ||||
@Override | @Override | ||||
} | } | ||||
---- | ---- | ||||
Alternatively, an OSGi bundle activator or an SCR Component [interfacename]#@Activate# method can obtain an instance of [classname]#VaadinResourceService# from [classname]#OSGiVaadinResources# and explicitly call its methods to publish a theme, a widget set or an individual file in the bundle as a static resource at the correct path. | |||||
Alternatively, an OSGi bundle activator or an SCR Component [interfacename]#@Activate# method can obtain an instance of [classname]#VaadinResourceService# from [classname]#OsgiVaadinResources# and explicitly call its methods to publish a theme, a widget set or an individual file in the bundle as a static resource at the correct path. | |||||
[source, java] | [source, java] | ||||
---- | ---- | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
service.publishTheme("mytheme", httpService); | service.publishTheme("mytheme", httpService); | ||||
---- | ---- | ||||
* @since 8.1 | * @since 8.1 | ||||
*/ | */ | ||||
@SuppressWarnings("serial") | @SuppressWarnings("serial") | ||||
public class OSGiUIProvider extends UIProvider { | |||||
public class OsgiUIProvider extends UIProvider { | |||||
private Class<UI> uiClass; | private Class<UI> uiClass; | ||||
@SuppressWarnings("unchecked") | @SuppressWarnings("unchecked") | ||||
public OSGiUIProvider(ServiceObjects<UI> serviceObjects) { | |||||
public OsgiUIProvider(ServiceObjects<UI> serviceObjects) { | |||||
super(); | super(); | ||||
UI ui = serviceObjects.getService(); | UI ui = serviceObjects.getService(); | ||||
uiClass = (Class<UI>) ui.getClass(); | uiClass = (Class<UI>) ui.getClass(); |
import com.vaadin.ui.UI; | import com.vaadin.ui.UI; | ||||
/** | /** | ||||
* {@link VaadinPortlet} that uses an {@link OSGiUIProvider} to configure its | |||||
* {@link VaadinPortlet} that uses an {@link OsgiUIProvider} to configure its | |||||
* {@link UI}. | * {@link UI}. | ||||
* <p> | * <p> | ||||
* This only applies to Liferay Portal 7+ with OSGi support. | * This only applies to Liferay Portal 7+ with OSGi support. | ||||
* @since 8.1 | * @since 8.1 | ||||
*/ | */ | ||||
@SuppressWarnings("serial") | @SuppressWarnings("serial") | ||||
public class VaadinOSGiPortlet extends VaadinPortlet { | |||||
private OSGiUIProvider uiProvider; | |||||
public class OsgiVaadinPortlet extends VaadinPortlet { | |||||
private OsgiUIProvider uiProvider; | |||||
public VaadinOSGiPortlet(OSGiUIProvider uiProvider) { | |||||
public OsgiVaadinPortlet(OsgiUIProvider uiProvider) { | |||||
this.uiProvider = uiProvider; | this.uiProvider = uiProvider; | ||||
} | } | ||||
@Override | @Override | ||||
protected VaadinPortletService createPortletService( | protected VaadinPortletService createPortletService( | ||||
DeploymentConfiguration configuration) throws ServiceException { | DeploymentConfiguration configuration) throws ServiceException { | ||||
OSGiVaadinPortletService osgiVaadinPortletService = new OSGiVaadinPortletService( | |||||
OsgiVaadinPortletService osgiVaadinPortletService = new OsgiVaadinPortletService( | |||||
this, configuration, uiProvider); | this, configuration, uiProvider); | ||||
osgiVaadinPortletService.init(); | osgiVaadinPortletService.init(); | ||||
return osgiVaadinPortletService; | return osgiVaadinPortletService; |
import com.vaadin.ui.UI; | import com.vaadin.ui.UI; | ||||
/** | /** | ||||
* {@link VaadinPortletService} class that uses the {@link OSGiUIProvider} to | |||||
* {@link VaadinPortletService} class that uses the {@link OsgiUIProvider} to | |||||
* configure the {@link UI} class for a {@link VaadinPortlet}. | * configure the {@link UI} class for a {@link VaadinPortlet}. | ||||
* <p> | * <p> | ||||
* This only applies to Liferay Portal 7+ with OSGi support. | * This only applies to Liferay Portal 7+ with OSGi support. | ||||
* @since 8.1 | * @since 8.1 | ||||
*/ | */ | ||||
@SuppressWarnings("serial") | @SuppressWarnings("serial") | ||||
public class OSGiVaadinPortletService extends VaadinPortletService { | |||||
private OSGiUIProvider osgiUIProvider; | |||||
public class OsgiVaadinPortletService extends VaadinPortletService { | |||||
private OsgiUIProvider osgiUIProvider; | |||||
public OSGiVaadinPortletService(VaadinPortlet portlet, | |||||
public OsgiVaadinPortletService(VaadinPortlet portlet, | |||||
DeploymentConfiguration deploymentConfiguration, | DeploymentConfiguration deploymentConfiguration, | ||||
OSGiUIProvider osgiUIProvider) throws ServiceException { | |||||
OsgiUIProvider osgiUIProvider) throws ServiceException { | |||||
super(portlet, deploymentConfiguration); | super(portlet, deploymentConfiguration); | ||||
this.osgiUIProvider = osgiUIProvider; | this.osgiUIProvider = osgiUIProvider; |
ServiceObjects<UI> serviceObjects = bundleContext | ServiceObjects<UI> serviceObjects = bundleContext | ||||
.getServiceObjects(reference); | .getServiceObjects(reference); | ||||
OSGiUIProvider uiProvider = new OSGiUIProvider(serviceObjects); | |||||
OsgiUIProvider uiProvider = new OsgiUIProvider(serviceObjects); | |||||
Dictionary<String, Object> properties = null; | Dictionary<String, Object> properties = null; | ||||
if (configuration != null) { | if (configuration != null) { | ||||
properties = createPortletProperties(reference); | properties = createPortletProperties(reference); | ||||
} | } | ||||
VaadinOSGiPortlet portlet = new VaadinOSGiPortlet(uiProvider); | |||||
OsgiVaadinPortlet portlet = new OsgiVaadinPortlet(uiProvider); | |||||
ServiceRegistration<Portlet> serviceRegistration = bundleContext | ServiceRegistration<Portlet> serviceRegistration = bundleContext | ||||
.registerService(Portlet.class, portlet, properties); | .registerService(Portlet.class, portlet, properties); | ||||
} | } | ||||
private Dictionary<String, Object> createPortletProperties( | private Dictionary<String, Object> createPortletProperties( | ||||
OSGiUIProvider uiProvider, ServiceReference<UI> reference, | |||||
OsgiUIProvider uiProvider, ServiceReference<UI> reference, | |||||
VaadinLiferayPortletConfiguration configuration) { | VaadinLiferayPortletConfiguration configuration) { | ||||
Hashtable<String, Object> properties = new Hashtable<String, Object>(); | Hashtable<String, Object> properties = new Hashtable<String, Object>(); |
import org.osgi.service.component.annotations.Deactivate; | import org.osgi.service.component.annotations.Deactivate; | ||||
import org.osgi.util.tracker.ServiceTracker; | import org.osgi.util.tracker.ServiceTracker; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
import com.vaadin.ui.UI; | import com.vaadin.ui.UI; | ||||
@Activate | @Activate | ||||
void activate(ComponentContext componentContext) throws Exception { | void activate(ComponentContext componentContext) throws Exception { | ||||
BundleContext bundleContext = componentContext.getBundleContext(); | BundleContext bundleContext = componentContext.getBundleContext(); | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
portletUIServiceTrackerCustomizer = new PortletUIServiceTrackerCustomizer( | portletUIServiceTrackerCustomizer = new PortletUIServiceTrackerCustomizer( | ||||
service); | service); |
import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; | import org.osgi.service.http.whiteboard.HttpWhiteboardConstants; | ||||
import org.osgi.service.log.LogService; | import org.osgi.service.log.LogService; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OSGiVaadinResources.ResourceBundleInactiveException; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources.ResourceBundleInactiveException; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
import com.vaadin.server.Constants; | import com.vaadin.server.Constants; | ||||
import com.vaadin.server.VaadinServlet; | import com.vaadin.server.VaadinServlet; | ||||
} | } | ||||
private String getResourcePath() throws ResourceBundleInactiveException { | private String getResourcePath() throws ResourceBundleInactiveException { | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
return String.format("/%s", service.getResourcePathPrefix()); | return String.format("/%s", service.getResourcePathPrefix()); | ||||
} | } | ||||
import org.osgi.service.component.annotations.Reference; | import org.osgi.service.component.annotations.Reference; | ||||
import org.osgi.service.http.HttpService; | import org.osgi.service.http.HttpService; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
@Component(immediate = true) | @Component(immediate = true) | ||||
@Activate | @Activate | ||||
void startup(ComponentContext context) throws Exception { | void startup(ComponentContext context) throws Exception { | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
for (String resourceName : RESOURCES) { | for (String resourceName : RESOURCES) { | ||||
service.publishResource(resourceName, httpService); | service.publishResource(resourceName, httpService); | ||||
} | } |
import org.osgi.service.http.HttpService; | import org.osgi.service.http.HttpService; | ||||
import org.osgi.service.http.NamespaceException; | import org.osgi.service.http.NamespaceException; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OSGiVaadinResources.ResourceBundleInactiveException; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources.ResourceBundleInactiveException; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
/** | /** | ||||
@Activate | @Activate | ||||
void startup() throws NamespaceException, ResourceBundleInactiveException { | void startup() throws NamespaceException, ResourceBundleInactiveException { | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
for (String resourceName : RESOURCES) { | for (String resourceName : RESOURCES) { | ||||
service.publishResource(resourceName, httpService); | service.publishResource(resourceName, httpService); | ||||
} | } |
Bundle-SymbolicName: ${project.groupId}.shared | Bundle-SymbolicName: ${project.groupId}.shared | ||||
Bundle-Activator: com.vaadin.osgi.resources.OSGiVaadinResources | |||||
Bundle-Activator: com.vaadin.osgi.resources.OsgiVaadinResources | |||||
Bundle-Name: Vaadin Shared | Bundle-Name: Vaadin Shared | ||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | Bundle-RequiredExecutionEnvironment: JavaSE-1.8 | ||||
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0 | Bundle-License: http://www.apache.org/licenses/LICENSE-2.0 |
* | * | ||||
* @since 8.1 | * @since 8.1 | ||||
*/ | */ | ||||
public class OSGiVaadinResources implements BundleActivator { | |||||
public class OsgiVaadinResources implements BundleActivator { | |||||
/** | /** | ||||
* Thrown if a method is called when the Resource bundle is not active. | * Thrown if a method is called when the Resource bundle is not active. | ||||
} | } | ||||
} | } | ||||
private static OSGiVaadinResources instance; | |||||
private static OsgiVaadinResources instance; | |||||
private VaadinResourceServiceImpl service; | private VaadinResourceServiceImpl service; | ||||
private Version version; | private Version version; |
* Used to declare a Vaadin Theme for use in OSGi. The theme is expected to be | * Used to declare a Vaadin Theme for use in OSGi. The theme is expected to be | ||||
* in the same OSGi bundle as the class implementing this interface, under the | * in the same OSGi bundle as the class implementing this interface, under the | ||||
* path "/VAADIN/themes/{themeName}" where {themeName} is what is returned by | * path "/VAADIN/themes/{themeName}" where {themeName} is what is returned by | ||||
* {@link OSGiVaadinTheme#getName()}. | |||||
* {@link OsgiVaadinTheme#getName()}. | |||||
* <p> | * <p> | ||||
* To publish a theme, an implementation of this interface needs to be | * To publish a theme, an implementation of this interface needs to be | ||||
* registered as an OSGi service, which makes | * registered as an OSGi service, which makes | ||||
* | * | ||||
* @since 8.1 | * @since 8.1 | ||||
*/ | */ | ||||
public interface OSGiVaadinTheme { | |||||
public interface OsgiVaadinTheme { | |||||
/** | |||||
* Return the theme name to publish for OSGi. | |||||
* | |||||
* @return theme name, not null | |||||
*/ | |||||
public String getName(); | public String getName(); | ||||
} | } |
* Used to declare a Vaadin Widgetset for use in OSGi. The widgetset is expected | * Used to declare a Vaadin Widgetset for use in OSGi. The widgetset is expected | ||||
* to be in the same OSGi bundle as the class implementing this interface, under | * to be in the same OSGi bundle as the class implementing this interface, under | ||||
* the path "/VAADIN/widgetsets/{widgetsetName}" where {widgetsetName} is what | * the path "/VAADIN/widgetsets/{widgetsetName}" where {widgetsetName} is what | ||||
* is returned by {@link OSGiVaadinWidgetset#getName()}. | |||||
* is returned by {@link OsgiVaadinWidgetset#getName()}. | |||||
* <p> | * <p> | ||||
* To publish a widgetset, an implementation of this interface needs to be | * To publish a widgetset, an implementation of this interface needs to be | ||||
* registered as an OSGi service, which makes | * registered as an OSGi service, which makes | ||||
* | * | ||||
* @since 8.1 | * @since 8.1 | ||||
*/ | */ | ||||
public interface OSGiVaadinWidgetset { | |||||
public interface OsgiVaadinWidgetset { | |||||
/** | |||||
* Return the widgetset name to publish for OSGi. | |||||
* | |||||
* @return widgetset name, not null | |||||
*/ | |||||
public String getName(); | public String getName(); | ||||
} | } |
import org.osgi.service.http.HttpService; | import org.osgi.service.http.HttpService; | ||||
import org.osgi.service.http.NamespaceException; | import org.osgi.service.http.NamespaceException; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OSGiVaadinResources.ResourceBundleInactiveException; | |||||
import com.vaadin.osgi.resources.OSGiVaadinTheme; | |||||
import com.vaadin.osgi.resources.OSGiVaadinWidgetset; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources.ResourceBundleInactiveException; | |||||
import com.vaadin.osgi.resources.OsgiVaadinTheme; | |||||
import com.vaadin.osgi.resources.OsgiVaadinWidgetset; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
/** | /** | ||||
* Tracks {@link OSGiVaadinWidgetset} and {@link OSGiVaadinTheme} registration | |||||
* Tracks {@link OsgiVaadinWidgetset} and {@link OsgiVaadinTheme} registration | |||||
* and uses {@link HttpService} to register them. | * and uses {@link HttpService} to register them. | ||||
* | * | ||||
* @author Vaadin Ltd. | * @author Vaadin Ltd. | ||||
private Map<Long, String> widgetsetToAlias = Collections | private Map<Long, String> widgetsetToAlias = Collections | ||||
.synchronizedMap(new LinkedHashMap<>()); | .synchronizedMap(new LinkedHashMap<>()); | ||||
@Reference(cardinality = ReferenceCardinality.MULTIPLE, service = OSGiVaadinTheme.class, policy = ReferencePolicy.DYNAMIC) | |||||
void bindTheme(ServiceReference<OSGiVaadinTheme> themeRef) | |||||
@Reference(cardinality = ReferenceCardinality.MULTIPLE, service = OsgiVaadinTheme.class, policy = ReferencePolicy.DYNAMIC) | |||||
void bindTheme(ServiceReference<OsgiVaadinTheme> themeRef) | |||||
throws ResourceBundleInactiveException, NamespaceException { | throws ResourceBundleInactiveException, NamespaceException { | ||||
Bundle bundle = themeRef.getBundle(); | Bundle bundle = themeRef.getBundle(); | ||||
BundleContext context = bundle.getBundleContext(); | BundleContext context = bundle.getBundleContext(); | ||||
OSGiVaadinTheme theme = context.getService(themeRef); | |||||
OsgiVaadinTheme theme = context.getService(themeRef); | |||||
if (theme == null) | if (theme == null) | ||||
return; | return; | ||||
VaadinResourceService resourceService = OSGiVaadinResources | |||||
VaadinResourceService resourceService = OsgiVaadinResources | |||||
.getService(); | .getService(); | ||||
try { | try { | ||||
} | } | ||||
} | } | ||||
void unbindTheme(ServiceReference<OSGiVaadinTheme> themeRef) { | |||||
void unbindTheme(ServiceReference<OsgiVaadinTheme> themeRef) { | |||||
Long serviceId = (Long) themeRef.getProperty(Constants.SERVICE_ID); | Long serviceId = (Long) themeRef.getProperty(Constants.SERVICE_ID); | ||||
String themeAlias = themeToAlias.remove(serviceId); | String themeAlias = themeToAlias.remove(serviceId); | ||||
if (themeAlias != null && httpService != null) { | if (themeAlias != null && httpService != null) { | ||||
} | } | ||||
} | } | ||||
@Reference(cardinality = ReferenceCardinality.MULTIPLE, service = OSGiVaadinWidgetset.class, policy = ReferencePolicy.DYNAMIC) | |||||
void bindWidgetset(ServiceReference<OSGiVaadinWidgetset> widgetsetRef) | |||||
@Reference(cardinality = ReferenceCardinality.MULTIPLE, service = OsgiVaadinWidgetset.class, policy = ReferencePolicy.DYNAMIC) | |||||
void bindWidgetset(ServiceReference<OsgiVaadinWidgetset> widgetsetRef) | |||||
throws ResourceBundleInactiveException, NamespaceException { | throws ResourceBundleInactiveException, NamespaceException { | ||||
Bundle bundle = widgetsetRef.getBundle(); | Bundle bundle = widgetsetRef.getBundle(); | ||||
BundleContext context = bundle.getBundleContext(); | BundleContext context = bundle.getBundleContext(); | ||||
OSGiVaadinWidgetset widgetset = context.getService(widgetsetRef); | |||||
OsgiVaadinWidgetset widgetset = context.getService(widgetsetRef); | |||||
if (widgetset == null) | if (widgetset == null) | ||||
return; | return; | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
try { | try { | ||||
String pathPrefix = service.getResourcePathPrefix(); | String pathPrefix = service.getResourcePathPrefix(); | ||||
} | } | ||||
void unbindWidgetset(ServiceReference<OSGiVaadinWidgetset> widgetsetRef) { | |||||
void unbindWidgetset(ServiceReference<OsgiVaadinWidgetset> widgetsetRef) { | |||||
Long serviceId = (Long) widgetsetRef.getProperty(Constants.SERVICE_ID); | Long serviceId = (Long) widgetsetRef.getProperty(Constants.SERVICE_ID); | ||||
String widgetsetAlias = widgetsetToAlias.remove(serviceId); | String widgetsetAlias = widgetsetToAlias.remove(serviceId); | ||||
if (widgetsetAlias != null && httpService != null) { | if (widgetsetAlias != null && httpService != null) { |
import org.osgi.service.component.annotations.Reference; | import org.osgi.service.component.annotations.Reference; | ||||
import org.osgi.service.http.HttpService; | import org.osgi.service.http.HttpService; | ||||
import com.vaadin.osgi.resources.OSGiVaadinResources; | |||||
import com.vaadin.osgi.resources.OsgiVaadinResources; | |||||
import com.vaadin.osgi.resources.VaadinResourceService; | import com.vaadin.osgi.resources.VaadinResourceService; | ||||
@Component(immediate = true) | @Component(immediate = true) | ||||
@Activate | @Activate | ||||
void startup() throws Exception { | void startup() throws Exception { | ||||
VaadinResourceService service = OSGiVaadinResources.getService(); | |||||
VaadinResourceService service = OsgiVaadinResources.getService(); | |||||
service.publishTheme("valo", httpService); | service.publishTheme("valo", httpService); | ||||
} | } | ||||