diff options
author | Henri Sara <henri.sara@gmail.com> | 2017-05-15 22:34:43 +0300 |
---|---|---|
committer | Pekka Hyvönen <pekka@vaadin.com> | 2017-05-15 22:34:43 +0300 |
commit | e788fa906b968a298414e60cbb15cc7d6389b8a1 (patch) | |
tree | 2ee323f033d9ea05768e56795462e9617597809e /shared/src/main/java/com/vaadin/osgi | |
parent | 91e0eb1ce19aec5f634261534674960b7b7af399 (diff) | |
download | vaadin-framework-e788fa906b968a298414e60cbb15cc7d6389b8a1.tar.gz vaadin-framework-e788fa906b968a298414e60cbb15cc7d6389b8a1.zip |
Rename OSGi classes for Java naming conventions (#9320)
- Rename OSGi to Osgi in class names.
- Rename VaadinOSGiPortlet to OSGiVaadinPortlet for consistency with
Spring, CDI etc. add-ons
- Add missing javadoc
Diffstat (limited to 'shared/src/main/java/com/vaadin/osgi')
-rw-r--r-- | shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinResources.java (renamed from shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinResources.java) | 4 | ||||
-rw-r--r-- | shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinTheme.java (renamed from shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinTheme.java) | 9 | ||||
-rw-r--r-- | shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinWidgetset.java (renamed from shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinWidgetset.java) | 9 | ||||
-rw-r--r-- | shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java | 30 |
4 files changed, 31 insertions, 21 deletions
diff --git a/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinResources.java b/shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinResources.java index 96f6f997ca..a423791193 100644 --- a/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinResources.java +++ b/shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinResources.java @@ -30,7 +30,7 @@ import com.vaadin.osgi.resources.impl.VaadinResourceServiceImpl; * * @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. @@ -46,7 +46,7 @@ public class OSGiVaadinResources implements BundleActivator { } } - private static OSGiVaadinResources instance; + private static OsgiVaadinResources instance; private VaadinResourceServiceImpl service; private Version version; diff --git a/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinTheme.java b/shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinTheme.java index 852dd93294..0b4866b619 100644 --- a/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinTheme.java +++ b/shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinTheme.java @@ -19,7 +19,7 @@ package com.vaadin.osgi.resources; * 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 * path "/VAADIN/themes/{themeName}" where {themeName} is what is returned by - * {@link OSGiVaadinTheme#getName()}. + * {@link OsgiVaadinTheme#getName()}. * <p> * To publish a theme, an implementation of this interface needs to be * registered as an OSGi service, which makes @@ -30,6 +30,11 @@ package com.vaadin.osgi.resources; * * @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(); } diff --git a/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinWidgetset.java b/shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinWidgetset.java index c594443687..81e957ea5a 100644 --- a/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinWidgetset.java +++ b/shared/src/main/java/com/vaadin/osgi/resources/OsgiVaadinWidgetset.java @@ -19,7 +19,7 @@ package com.vaadin.osgi.resources; * 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 * the path "/VAADIN/widgetsets/{widgetsetName}" where {widgetsetName} is what - * is returned by {@link OSGiVaadinWidgetset#getName()}. + * is returned by {@link OsgiVaadinWidgetset#getName()}. * <p> * To publish a widgetset, an implementation of this interface needs to be * registered as an OSGi service, which makes @@ -30,6 +30,11 @@ package com.vaadin.osgi.resources; * * @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(); } diff --git a/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java index 0cf6aaeb18..adbde7d798 100644 --- a/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java +++ b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceTrackerComponent.java @@ -36,14 +36,14 @@ import org.osgi.service.http.HttpContext; 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.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; /** - * Tracks {@link OSGiVaadinWidgetset} and {@link OSGiVaadinTheme} registration + * Tracks {@link OsgiVaadinWidgetset} and {@link OsgiVaadinTheme} registration * and uses {@link HttpService} to register them. * * @author Vaadin Ltd. @@ -59,18 +59,18 @@ public class VaadinResourceTrackerComponent { private Map<Long, String> widgetsetToAlias = Collections .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 { Bundle bundle = themeRef.getBundle(); BundleContext context = bundle.getBundleContext(); - OSGiVaadinTheme theme = context.getService(themeRef); + OsgiVaadinTheme theme = context.getService(themeRef); if (theme == null) return; - VaadinResourceService resourceService = OSGiVaadinResources + VaadinResourceService resourceService = OsgiVaadinResources .getService(); try { @@ -90,7 +90,7 @@ public class VaadinResourceTrackerComponent { } } - void unbindTheme(ServiceReference<OSGiVaadinTheme> themeRef) { + void unbindTheme(ServiceReference<OsgiVaadinTheme> themeRef) { Long serviceId = (Long) themeRef.getProperty(Constants.SERVICE_ID); String themeAlias = themeToAlias.remove(serviceId); if (themeAlias != null && httpService != null) { @@ -98,17 +98,17 @@ public class VaadinResourceTrackerComponent { } } - @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 { Bundle bundle = widgetsetRef.getBundle(); BundleContext context = bundle.getBundleContext(); - OSGiVaadinWidgetset widgetset = context.getService(widgetsetRef); + OsgiVaadinWidgetset widgetset = context.getService(widgetsetRef); if (widgetset == null) return; - VaadinResourceService service = OSGiVaadinResources.getService(); + VaadinResourceService service = OsgiVaadinResources.getService(); try { String pathPrefix = service.getResourcePathPrefix(); @@ -129,7 +129,7 @@ public class VaadinResourceTrackerComponent { } - void unbindWidgetset(ServiceReference<OSGiVaadinWidgetset> widgetsetRef) { + void unbindWidgetset(ServiceReference<OsgiVaadinWidgetset> widgetsetRef) { Long serviceId = (Long) widgetsetRef.getProperty(Constants.SERVICE_ID); String widgetsetAlias = widgetsetToAlias.remove(serviceId); if (widgetsetAlias != null && httpService != null) { |