From 9a6ebeb5a80bdb1d97d47422c62a973b3f2d2cf9 Mon Sep 17 00:00:00 2001 From: Mirjan Merruko Date: Fri, 24 Mar 2017 13:33:37 +0200 Subject: Add OSGi support #8830 #8827 #8828 #8829 Use bnd-maven-plugin instead of maven-bundle-plugin and helper class, and add support for publishing static resources such as themes and widgetsets. --- compatibility-client-compiled/bnd.bnd | 6 ++ compatibility-client-compiled/pom.xml | 65 ++++------------------ .../CompatibilityWidgetsetContribution.java | 47 ++++++++++++++++ 3 files changed, 64 insertions(+), 54 deletions(-) create mode 100644 compatibility-client-compiled/bnd.bnd create mode 100644 compatibility-client-compiled/src/main/java/com/vaadin/osgi/compatibility/widgetset/CompatibilityWidgetsetContribution.java (limited to 'compatibility-client-compiled') diff --git a/compatibility-client-compiled/bnd.bnd b/compatibility-client-compiled/bnd.bnd new file mode 100644 index 0000000000..665722b56b --- /dev/null +++ b/compatibility-client-compiled/bnd.bnd @@ -0,0 +1,6 @@ +Bundle-SymbolicName: ${project.groupId}.compatibility.client.compiled +Bundle-Name: Compatibility Widgetset +Bundle-Version: ${osgi.bundle.version} +Import-Package: com.vaadin*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\ + * +Export-Package: com.vaadin.osgi.compatibility.widgetset;-noimport:=true diff --git a/compatibility-client-compiled/pom.xml b/compatibility-client-compiled/pom.xml index 9f09cede62..1a21712a94 100644 --- a/compatibility-client-compiled/pom.xml +++ b/compatibility-client-compiled/pom.xml @@ -50,40 +50,19 @@ ${project.version} provided + + + org.osgi + osgi.core + + + org.osgi + osgi.cmpn + - - org.codehaus.mojo - exec-maven-plugin - - - generate-export-package - package - - exec - - - compile - ${java.home}/bin/java - - -Dvaadin.version=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion} - -DincludeNumberPackages=1 - - -classpath - - - com.vaadin.buildhelpers.GeneratePackageExports - - ${project.build.directory}/${project.build.finalName}.${project.packaging} - VAADIN/widgetsets - - - - - - com.vaadin vaadin-maven-plugin @@ -104,32 +83,10 @@ - - - org.apache.felix - maven-bundle-plugin - true - - - ${osgi.bundle.version} - ${osgi.execution.environment} - - - - - - - - bundle-manifest - prepare-package - - manifest - - - + biz.aQute.bnd + bnd-maven-plugin - org.apache.maven.plugins maven-jar-plugin diff --git a/compatibility-client-compiled/src/main/java/com/vaadin/osgi/compatibility/widgetset/CompatibilityWidgetsetContribution.java b/compatibility-client-compiled/src/main/java/com/vaadin/osgi/compatibility/widgetset/CompatibilityWidgetsetContribution.java new file mode 100644 index 0000000000..f9c4c4d121 --- /dev/null +++ b/compatibility-client-compiled/src/main/java/com/vaadin/osgi/compatibility/widgetset/CompatibilityWidgetsetContribution.java @@ -0,0 +1,47 @@ +/* + * Copyright 2000-2016 Vaadin Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not + * use this file except in compliance with the License. You may obtain a copy of + * the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ +package com.vaadin.osgi.compatibility.widgetset; + +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 com.vaadin.osgi.resources.OSGiVaadinResources; +import com.vaadin.osgi.resources.VaadinResourceService; + +@Component(immediate = true) +public class CompatibilityWidgetsetContribution { + private HttpService httpService; + + private static final String WIDGETSET_NAME = "com.vaadin.v7.Vaadin7WidgetSet"; + + @Activate + void startup(ComponentContext context) throws Exception { + VaadinResourceService service = OSGiVaadinResources.getService(); + service.publishWidgetset(WIDGETSET_NAME, httpService); + } + + @Reference + void setHttpService(HttpService httpService) { + this.httpService = httpService; + } + + void unsetHttpService(HttpService httpService) { + this.httpService = null; + } +} -- cgit v1.2.3