diff --git a/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java b/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java
deleted file mode 100644
index 9717c353531..00000000000
--- a/buildhelpers/src/main/java/com/vaadin/buildhelpers/GeneratePackageExports.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
- * 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.buildhelpers;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.List;
-import java.util.jar.Attributes;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-import java.util.jar.Manifest;
-import java.util.logging.Logger;
-import java.util.regex.Pattern;
-
-/**
- * Generates Export-Packages attribute for OSGi compatible manifest.
- *
- * Reads the included Java packages in a jar file, generates a corresponding
- * Export-Package attribute, and appends it to the jar's MANIFEST.MF.
- *
- * See #3521 for details.
- *
- * @author magi
- */
-public class GeneratePackageExports {
-
- private static final String EXPORT_PACKAGE_ATTRIBUTE = "Export-Package";
-
- public static void main(String[] args) {
- if (args.length < 2) {
- System.err.println("Invalid number of parameters\n"
- + "Usage: java -cp .. GenerateManifest \n"
- + "Use -Dvaadin.version to specify the version to be used for the packages\n"
- + "Use -DincludeNumberPackages=1 to include package names which start with a number (not 100% OSGi compatible)");
- System.exit(1);
- }
-
- // Open the JAR
- String jarFilename = args[0];
- JarFile jar = null;
- try {
- jar = new JarFile(jarFilename);
- } catch (IOException e) {
- System.err.println("Unable to open JAR '" + jarFilename + "'");
- System.exit(1);
- }
-
- // Accepted packages
- List acceptedPackagePrefixes = new ArrayList<>();
- for (int i = 1; i < args.length; i++) {
- acceptedPackagePrefixes.add(args[i]);
- }
-
- boolean includeNumberPackages = false;
- if ("1".equals(System.getProperty("includeNumberPackages"))) {
- includeNumberPackages = true;
- }
-
- // List the included Java packages
- HashSet packages = getPackages(jar, acceptedPackagePrefixes,
- includeNumberPackages);
-
- // Avoid writing empty Export-Package attribute
- if (packages.isEmpty()) {
- return;
- }
-
- String exportPackage = sortAndJoinPackages(packages);
-
- // Read old manifest
- Manifest oldMF = null;
- try {
- oldMF = jar.getManifest();
- } catch (IOException e) {
- e.printStackTrace();
- }
- Attributes mainAttributes = oldMF.getMainAttributes();
-
- String existingExportPackage = mainAttributes
- .getValue(EXPORT_PACKAGE_ATTRIBUTE);
- if (existingExportPackage != null) {
- exportPackage = existingExportPackage + "," + exportPackage;
- }
-
- // Jar must be closed before updating it below, as it's
- // locked in Windows until closed. (#6045)
- try {
- jar.close();
- } catch (IOException e) {
- System.err.println("Unable to close JAR '" + jarFilename + "'");
- }
-
- // Create the modified manifest
- ManifestWriter manifest = new ManifestWriter();
- manifest.writeAttribute(EXPORT_PACKAGE_ATTRIBUTE, exportPackage);
-
- // Update the manifest in the Jar. The jar must be closed
- // before this is done.
- int status = manifest.updateJar(jarFilename);
-
- if (status != 0) {
- System.exit(status);
- }
- }
-
- private static String sortAndJoinPackages(HashSet packages) {
- // Produce an ordered listing of the package names
- String packageArray[] = new String[packages.size()];
- packages.toArray(packageArray);
- Arrays.sort(packageArray);
- StringBuilder joinedPackages = new StringBuilder();
- for (int i = 0; i < packageArray.length; i++) {
- if (i != 0) {
- joinedPackages.append(",");
- }
- String version = getVersion(packageArray[i]);
- String packageAndVersion = packageArray[i];
- if (version != null) {
- packageAndVersion += ";version=\"" + version + "\"";
- } else {
- Logger.getLogger(GeneratePackageExports.class.getName())
- .severe("No version defined for " + packageArray[i]);
- }
- joinedPackages.append(packageAndVersion);
- }
-
- return joinedPackages.toString();
- }
-
- /**
- * Tries to find version specified using system properties of type
- * version.. Searches for the packge and then its parents
- * recursively. Falls back to the "vaadin.version" system property if no
- * other properties are found.
- *
- * @param javaPackage
- * The package to determine a version for
- * @return A version or null if no version has been defined
- */
- private static String getVersion(String javaPackage) {
- String packageVersion = System.getProperty("version." + javaPackage);
- if (packageVersion != null) {
- return packageVersion;
- }
- String parentPackage = null;
- if (javaPackage.contains(".")) {
- parentPackage = javaPackage.substring(0,
- javaPackage.lastIndexOf('.'));
- String parentVersion = getVersion(parentPackage);
- if (parentVersion != null) {
- return parentVersion;
- }
- }
-
- String vaadinVersion = System.getProperty("vaadin.version");
- if (vaadinVersion != null) {
- return vaadinVersion;
- }
-
- return null;
- }
-
- private static HashSet getPackages(JarFile jar,
- List acceptedPackagePrefixes,
- boolean includeNumberPackages) {
- HashSet packages = new HashSet<>();
-
- Pattern startsWithNumber = Pattern.compile("\\.\\d");
-
- for (Enumeration it = jar.entries(); it.hasMoreElements();) {
- JarEntry entry = it.nextElement();
-
- boolean classFile = entry.getName().endsWith(".class");
- boolean directory = entry.isDirectory();
-
- if (!classFile && !directory) {
- continue;
- }
-
- if (!acceptEntry(entry.getName(), acceptedPackagePrefixes)) {
- continue;
- }
-
- int lastSlash = entry.getName().lastIndexOf('/');
- String pkg = entry.getName().substring(0, lastSlash).replace('/',
- '.');
-
- if (!includeNumberPackages
- && startsWithNumber.matcher(pkg).find()) {
- continue;
- }
-
- packages.add(pkg);
- }
-
- return packages;
- }
-
- private static boolean acceptEntry(String name,
- List acceptedPackagePrefixes) {
- for (String prefix : acceptedPackagePrefixes) {
- if (name.startsWith(prefix)) {
- return true;
- }
- }
- return false;
- }
-}
diff --git a/client-compiled/bnd.bnd b/client-compiled/bnd.bnd
new file mode 100644
index 00000000000..60f79d805e7
--- /dev/null
+++ b/client-compiled/bnd.bnd
@@ -0,0 +1,6 @@
+Bundle-SymbolicName: ${project.groupId}.client.compiled
+Bundle-Name: Default Widgetset
+Bundle-Version: ${osgi.bundle.version}
+Import-Package: com.vaadin*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\
+ *
+Export-Package: com.vaadin.osgi.widgetset;-noimport:=true
diff --git a/client-compiled/pom.xml b/client-compiled/pom.xml
index 33f28c3661e..e87599551f8 100644
--- a/client-compiled/pom.xml
+++ b/client-compiled/pom.xml
@@ -29,6 +29,13 @@
provided
+
+ ${project.groupId}
+ vaadin-shared
+ ${project.version}
+ provided
+
+
${project.groupId}
vaadin-client
@@ -49,40 +56,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
@@ -103,32 +89,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/client-compiled/src/main/java/com/vaadin/osgi/widgetset/DefaultWidgetsetContribution.java b/client-compiled/src/main/java/com/vaadin/osgi/widgetset/DefaultWidgetsetContribution.java
new file mode 100644
index 00000000000..ec80b7890f1
--- /dev/null
+++ b/client-compiled/src/main/java/com/vaadin/osgi/widgetset/DefaultWidgetsetContribution.java
@@ -0,0 +1,32 @@
+package com.vaadin.osgi.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 DefaultWidgetsetContribution {
+ private HttpService httpService;
+
+ private static final String WIDGETSET_NAME = "com.vaadin.DefaultWidgetSet";
+
+ @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;
+ }
+}
diff --git a/compatibility-client-compiled/bnd.bnd b/compatibility-client-compiled/bnd.bnd
new file mode 100644
index 00000000000..665722b56b4
--- /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 4bdf8c1fd6b..b105595ec83 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 00000000000..201345bce8f
--- /dev/null
+++ b/compatibility-client-compiled/src/main/java/com/vaadin/osgi/compatibility/widgetset/CompatibilityWidgetsetContribution.java
@@ -0,0 +1,32 @@
+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;
+ }
+}
diff --git a/compatibility-server/bnd.bnd b/compatibility-server/bnd.bnd
new file mode 100644
index 00000000000..11ea914dcc7
--- /dev/null
+++ b/compatibility-server/bnd.bnd
@@ -0,0 +1,10 @@
+Bundle-SymbolicName: ${project.groupId}.compatibility.server
+Bundle-Name: Vaadin Compatibility Server
+Import-Package: com.vaadin*;version="[${osgi.bundle.version},${osgi.bundle.version}]",\
+ !com.google*,\
+ org.osgi*,\
+ javax.validation*;resolution:=optional;version='${javax.validation.version}',\
+ *
+Export-Package: !com.vaadin.v7.shared*,\
+ !com.vaadin.v7.client*,\
+ com.vaadin.v7*;-noimport:=true
diff --git a/compatibility-server/pom.xml b/compatibility-server/pom.xml
index 12e14eed387..e0ff343d6ae 100644
--- a/compatibility-server/pom.xml
+++ b/compatibility-server/pom.xml
@@ -82,38 +82,10 @@
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- ${osgi.execution.environment}
- ${osgi.bundle.version}
- VAADIN;version="${osgi.bundle.version}",com.vaadin.v7.*;version="${osgi.bundle.version}"
- !com.google.appengine.api.datastore,
- !com.google.appengine.api.memcache,
- !com.google.apphosting.api,
- *
-
-
- com.vaadin.server;bundle-version="${osgi.bundle.version}",
- com.vaadin.shared;bundle-version="${osgi.bundle.version}"
-
-
-
-
-
- bundle-manifest
- prepare-package
-
- manifest
-
-
-
-
-
+ biz.aQute.bnd
+ bnd-maven-plugin
+
org.apache.maven.plugins
maven-jar-plugin
diff --git a/compatibility-shared/bnd.bnd b/compatibility-shared/bnd.bnd
new file mode 100644
index 00000000000..754a6a4ca0c
--- /dev/null
+++ b/compatibility-shared/bnd.bnd
@@ -0,0 +1,6 @@
+Bundle-SymbolicName: ${project.groupId}.compatibility.shared
+Bundle-Name: Vaadin Compatibility Shared
+Import-Package: com.vaadin*;version="[${osgi.bundle.version},${osgi.bundle.version}]",\
+ org.osgi*
+Export-Package: \
+ com.vaadin.v7.shared*;-noimport:=true
diff --git a/compatibility-shared/pom.xml b/compatibility-shared/pom.xml
index abdc1ca8495..19fd18f728c 100644
--- a/compatibility-shared/pom.xml
+++ b/compatibility-shared/pom.xml
@@ -42,32 +42,10 @@
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- ${osgi.execution.environment}
- ${osgi.bundle.version}
- com.vaadin.*;version="${osgi.bundle.version}"
-
- com.vaadin.shared;bundle-version="${osgi.bundle.version}"
-
-
-
-
-
- bundle-manifest
- prepare-package
-
- manifest
-
-
-
+ biz.aQute.bnd
+ bnd-maven-plugin
-
maven-resources-plugin
diff --git a/compatibility-themes/bnd.bnd b/compatibility-themes/bnd.bnd
new file mode 100644
index 00000000000..ee3e21796bc
--- /dev/null
+++ b/compatibility-themes/bnd.bnd
@@ -0,0 +1,6 @@
+Bundle-SymbolicName: ${project.groupId}.compatibility.themes
+Bundle-Name: Vaadin Compatibility Themes
+Bundle-Version: ${osgi.bundle.version}
+Import-Package: com.vaadin*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\
+ *
+Export-Package: com.vaadin.osgi.compatibility.themes;-noimport:=true
diff --git a/compatibility-themes/pom.xml b/compatibility-themes/pom.xml
index d373cee9ace..8fc5d4f2e63 100644
--- a/compatibility-themes/pom.xml
+++ b/compatibility-themes/pom.xml
@@ -51,6 +51,15 @@
commons-io
provided
+
+
+ org.osgi
+ osgi.core
+
+
+ org.osgi
+ osgi.cmpn
+
@@ -223,29 +232,6 @@
-
- generate-export-package
- package
-
- exec
-
-
- compile
- ${java.home}/bin/java
-
- -Dvaadin.version=${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}
- -DincludeNumberPackages=0
-
- -classpath
-
-
- com.vaadin.buildhelpers.GeneratePackageExports
-
- ${project.build.directory}/${project.build.finalName}.${project.packaging}
- VAADIN/themes
-
-
-
@@ -281,29 +267,9 @@
- 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-themes/src/main/java/com/vaadin/osgi/compatibility/themes/LegacyThemeContributions.java b/compatibility-themes/src/main/java/com/vaadin/osgi/compatibility/themes/LegacyThemeContributions.java
new file mode 100644
index 00000000000..9fbbfbc5a96
--- /dev/null
+++ b/compatibility-themes/src/main/java/com/vaadin/osgi/compatibility/themes/LegacyThemeContributions.java
@@ -0,0 +1,34 @@
+package com.vaadin.osgi.compatibility.themes;
+
+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 LegacyThemeContributions {
+ private static final String[] LEGACY_THEMES = { "base", "chameleon",
+ "reindeer", "runo" };
+
+ private HttpService httpService;
+
+ @Activate
+ void startup() throws Exception {
+ VaadinResourceService service = OSGiVaadinResources.getService();
+ for (String themeName : LEGACY_THEMES) {
+ service.publishTheme(themeName, httpService);
+ }
+ }
+
+ @Reference
+ void setHttpService(HttpService httpService) {
+ this.httpService = httpService;
+ }
+
+ void unsetHttpService(HttpService httpService) {
+ this.httpService = null;
+ }
+}
diff --git a/pom.xml b/pom.xml
index 1fb004f9845..2f6fb873199 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,14 +37,18 @@
2.4.5.vaadin2
- 3.0.0
JavaSE-1.8
${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}
-
+ 6.0.0
+ 6.0.1
+
+ 3.3.0
+
${project.build.directory}/dependency-unpack
-
+
9.2.9.v20150224
2.1.1
@@ -290,6 +294,25 @@
${vaadin.icons.version}
provided
+
+
+ org.osgi
+ osgi.core
+ ${osgi.version}
+ provided
+
+
+ org.osgi
+ osgi.annotation
+ ${osgi.annotation.version}
+ provided
+
+
+ org.osgi
+ osgi.cmpn
+ ${osgi.version}
+ provided
+
@@ -376,9 +399,16 @@
1.8
- org.apache.felix
- maven-bundle-plugin
- 3.0.1
+ biz.aQute.bnd
+ bnd-maven-plugin
+ ${bnd.version}
+
+
+
+ bnd-process
+
+
+
org.apache.maven.plugins
diff --git a/push/bnd.bnd b/push/bnd.bnd
new file mode 100644
index 00000000000..f5d0deb9a7e
--- /dev/null
+++ b/push/bnd.bnd
@@ -0,0 +1,6 @@
+Bundle-SymbolicName: ${project.groupId}.push
+Bundle-Name: Vaadin Push
+Bundle-Version: ${osgi.bundle.version}
+Import-Package: com.vaadin*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\
+ *
+Export-Package: com.vaadin.osgi.push;-noimport:=true
diff --git a/push/pom.xml b/push/pom.xml
index f0ad9d7e39c..04bf58ce0e9 100644
--- a/push/pom.xml
+++ b/push/pom.xml
@@ -29,7 +29,20 @@
war
provided
-
+
+ ${project.groupId}
+ vaadin-shared
+ ${project.version}
+ provided
+
+
+ org.osgi
+ osgi.core
+
+
+ org.osgi
+ osgi.cmpn
+
@@ -134,28 +147,9 @@
${project.build.outputDirectory}/VAADIN
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- ${osgi.bundle.version}
- ${osgi.execution.environment}
- VAADIN
- com.vaadin.external.atmosphere.runtime;bundle-version="${atmosphere.runtime.version}";visibility:=reexport
-
-
-
-
- bundle-manifest
- process-classes
-
- manifest
-
-
-
+ biz.aQute.bnd
+ bnd-maven-plugin
org.apache.maven.plugins
diff --git a/push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java b/push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java
new file mode 100644
index 00000000000..d30829a4994
--- /dev/null
+++ b/push/src/main/java/com/vaadin/osgi/push/PushResourcesContribution.java
@@ -0,0 +1,36 @@
+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 com.vaadin.osgi.resources.OSGiVaadinResources;
+import com.vaadin.osgi.resources.VaadinResourceService;
+
+@Component(immediate = true)
+public class PushResourcesContribution {
+ private HttpService httpService;
+
+ 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);
+ }
+ }
+
+ @Reference
+ void setHttpService(HttpService httpService) {
+ this.httpService = httpService;
+ }
+
+ void unsetHttpService(HttpService httpService) {
+ this.httpService = null;
+ }
+}
diff --git a/server/bnd.bnd b/server/bnd.bnd
new file mode 100644
index 00000000000..fc7a8ab5563
--- /dev/null
+++ b/server/bnd.bnd
@@ -0,0 +1,16 @@
+Bundle-SymbolicName: ${project.groupId}.server
+Bundle-Name: Vaadin Server
+Bundle-Version: ${osgi.bundle.version}
+Import-Package: com.vaadin.sass.*;resolution:=optional,\
+ com.liferay.portal.kernel.util;resolution:=optional,\
+ javax.portlet*;resolution:=optional,\
+ javax.validation*;resolution:=optional;version='${javax.validation.version}',\
+ org.atmosphere*;resolution:=optional,\
+ com.vaadin*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\
+ *
+Export-Package: !com.vaadin.sass*,\
+ !com.vaadin.shared*,\
+ !com.vaadin.osgi.resources*,\
+ !com.vaadin.osgi.push*,\
+ com.vaadin*;-noimport:=true
+
diff --git a/server/pom.xml b/server/pom.xml
index 4a31cd47ebc..a0fdf3788bf 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -20,8 +20,8 @@
com.liferay.portal
- portal-service
- ${liferay.portal-service.version}
+ com.liferay.portal.kernel
+ 2.0.0
provided
@@ -85,6 +85,17 @@
1.2.0
+
+
+
+ org.osgi
+ osgi.core
+
+
+ org.osgi
+ osgi.cmpn
+
+
@@ -225,46 +236,10 @@
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- ${osgi.execution.environment}
- ${osgi.bundle.version}
- VAADIN;version="${osgi.bundle.version}",com.vaadin.*;version="${osgi.bundle.version}"
-
- javax.servlet;version="${osgi.javax.servlet.version}",
- javax.servlet.http;version="${osgi.javax.servlet.version}",
- javax.validation;version="${javax.validation.version}";resolution:=optional,
- org.jsoup;version="${jsoup.version}",
- org.jsoup.parser;version="${jsoup.version}",
- org.jsoup.nodes;version="${jsoup.version}",
- org.jsoup.helper;version="${jsoup.version}",
- org.jsoup.safety;version="${jsoup.version}",
- org.jsoup.select;version="${jsoup.version}",
- javax.portlet;version="[${javax.portlet.version},3)";resolution:=optional,
- javax.portlet.filter;version="[${javax.portlet.version},3)";resolution:=optional,
- com.liferay.portal.kernel.util;version="[7,8)";resolution:=optional
-
- com.vaadin.shared;bundle-version="${osgi.bundle.version}",
- com.vaadin.push;bundle-version="${osgi.bundle.version}";resolution:=optional,
- com.vaadin.sass-compiler;bundle-version="${vaadin.sass.version}";resolution:=optional
-
-
-
-
- bundle-manifest
- prepare-package
-
- manifest
-
-
-
+ biz.aQute.bnd
+ bnd-maven-plugin
-
org.apache.maven.plugins
maven-jar-plugin
diff --git a/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java b/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java
new file mode 100644
index 00000000000..0a320ed6e54
--- /dev/null
+++ b/server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java
@@ -0,0 +1,50 @@
+/*
+ * 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.server.osgi;
+
+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 org.osgi.service.http.NamespaceException;
+
+import com.vaadin.osgi.resources.OSGiVaadinResources;
+import com.vaadin.osgi.resources.VaadinResourceService;
+import com.vaadin.osgi.resources.OSGiVaadinResources.ResourceBundleInactiveException;
+
+@Component(immediate = true)
+public class BootstrapContribution {
+ 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);
+ }
+ }
+
+ @Reference
+ void setHttpService(HttpService service) {
+ this.httpService = service;
+ }
+
+ void unsetHttpService(HttpService service) {
+ this.httpService = null;
+ }
+}
diff --git a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java
index ec1032c7978..b4f98518670 100644
--- a/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java
@@ -100,6 +100,8 @@ public class ClassesSerializableTest {
"com\\.vaadin\\.themes\\.valoutil\\.BodyStyleName", //
"com\\.vaadin\\.server\\.communication\\.JSR356WebsocketInitializer.*", //
"com\\.vaadin\\.screenshotbrowser\\.ScreenshotBrowser.*", //
+ "com\\.vaadin\\.osgi.*",//
+ "com\\.vaadin\\.server\\.osgi.*"
};
/**
diff --git a/shared/bnd.bnd b/shared/bnd.bnd
new file mode 100644
index 00000000000..00483b66ebc
--- /dev/null
+++ b/shared/bnd.bnd
@@ -0,0 +1,9 @@
+Bundle-SymbolicName: ${project.groupId}.shared
+Bundle-Activator: com.vaadin.osgi.resources.OSGiVaadinResources
+Bundle-Name: Vaadin Shared
+Import-Package: com.vaadin*;version="[${osgi.bundle.version},${osgi.bundle.version}]",\
+ org.osgi*
+Export-Package: com.vaadin.osgi.resources;-noimport:=true,\
+ com.vaadin.shared*;-noimport:=true,\
+ elemental*;-noimport:=true
+
diff --git a/shared/pom.xml b/shared/pom.xml
index 6956e6c4901..625c6f05979 100644
--- a/shared/pom.xml
+++ b/shared/pom.xml
@@ -24,6 +24,15 @@
gwt-elemental
provided
+
+
+ org.osgi
+ osgi.core
+
+
+ org.osgi
+ osgi.cmpn
+
@@ -99,31 +108,10 @@
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- ${osgi.execution.environment}
- ${osgi.bundle.version}
- com.vaadin.*;version="${osgi.bundle.version}",elemental.*;version="${osgi.bundle.version}"
-
-
-
-
-
-
- bundle-manifest
- prepare-package
-
- manifest
-
-
-
+ biz.aQute.bnd
+ bnd-maven-plugin
-
org.apache.maven.plugins
maven-jar-plugin
diff --git a/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinResources.java b/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinResources.java
new file mode 100644
index 00000000000..299834e2431
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/osgi/resources/OSGiVaadinResources.java
@@ -0,0 +1,59 @@
+/*
+ * 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.resources;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Version;
+
+import com.vaadin.osgi.resources.impl.VaadinResourceServiceImpl;
+
+public class OSGiVaadinResources implements BundleActivator {
+
+ @SuppressWarnings("serial")
+ public static class ResourceBundleInactiveException extends Exception {
+ public ResourceBundleInactiveException(String message) {
+ super(message);
+ }
+ }
+
+ private static OSGiVaadinResources instance;
+
+ private VaadinResourceServiceImpl service;
+ private Version version;
+
+ public static VaadinResourceService getService() throws ResourceBundleInactiveException {
+ if (instance == null) {
+ throw new ResourceBundleInactiveException("Vaadin Shared is not active!");
+ }
+ return instance.service;
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ version = context.getBundle().getVersion();
+ service = new VaadinResourceServiceImpl();
+ service.setBundleVersion(version.toString());
+ instance = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ instance = null;
+ service = null;
+ version = null;
+ }
+}
diff --git a/shared/src/main/java/com/vaadin/osgi/resources/VaadinResourceService.java b/shared/src/main/java/com/vaadin/osgi/resources/VaadinResourceService.java
new file mode 100644
index 00000000000..43242ace56c
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/osgi/resources/VaadinResourceService.java
@@ -0,0 +1,86 @@
+/*
+ * 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.resources;
+
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+
+public interface VaadinResourceService {
+
+ /**
+ * Register the theme with the given name under the
+ * VaadinResourcePublicationService versioned namespace. The theme folder is
+ * expected to be compiled and under "/VAADIN/themes/" in the calling
+ * bundle.
+ *
+ * The theme will become accessible under the url
+ * "/vaadin-x.x.x/VAADIN/themes/themeName" where x.x.x is the version of the
+ * Vaadin Server bundle
+ *
+ * @param themeName
+ * the name of the theme
+ * @param service
+ * the {@link HttpService} instance for the calling bundle
+ * @throws NamespaceException
+ * if there is a clash during the theme registration
+ */
+ void publishTheme(String themeName, HttpService service)
+ throws NamespaceException;
+
+ /**
+ * Register the resource with the given name under the
+ * VaadinResourcePublicationService versioned namespace. The resource is
+ * expected to be under "/VAADIN/" in the calling bundle.
+ *
+ * The resource will become accessible under the url "/vaadin-x.x.x/VAADIN/"
+ * where x.x.x is the version of the Vaadin Server bundle
+ *
+ * @param resourceName
+ * the name of the resource
+ * @param service
+ * the {@link HttpService} instance for the calling bundle
+ * @throws NamespaceException
+ * if there is a clash during the theme registration
+ */
+ void publishResource(String resourceName, HttpService service)
+ throws NamespaceException;
+
+ /**
+ * Register the widgetset with the given name under the
+ * VaadinResourcePublicationService versioned namespace. The resource is
+ * expected to be under "/VAADIN/widgetsets" in the calling bundle.
+ *
+ * The resource will become accessible under the url
+ * "/vaadin-x.x.x/VAADIN/widgetsets" where x.x.x is the version of the
+ * Vaadin Server bundle
+ *
+ * @param resourceName
+ * the name of the resource
+ * @param service
+ * the {@link HttpService} instance for the calling bundle
+ * @throws NamespaceException
+ * if there is a clash during the theme registration
+ */
+ void publishWidgetset(String widgetsetName, HttpService httpService)
+ throws NamespaceException;
+
+ /**
+ *
+ * @return the path of the resources folder managed by this service
+ */
+ String getResourcePathPrefix();
+
+}
diff --git a/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceServiceImpl.java b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceServiceImpl.java
new file mode 100644
index 00000000000..fbf36e3c21b
--- /dev/null
+++ b/shared/src/main/java/com/vaadin/osgi/resources/impl/VaadinResourceServiceImpl.java
@@ -0,0 +1,79 @@
+/*
+ * 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.resources.impl;
+
+import org.osgi.service.http.HttpService;
+import org.osgi.service.http.NamespaceException;
+
+import com.vaadin.osgi.resources.VaadinResourceService;
+
+public class VaadinResourceServiceImpl implements VaadinResourceService {
+ public static final String NAMESPACE_PREFIX = "vaadin-%s";
+
+ public static final String VAADIN_ROOT_ALIAS_FORMAT = "/%s/VAADIN/%s";
+ public static final String VAADIN_ROOT_FORMAT = "/VAADIN/%s";
+
+ public static final String VAADIN_THEME_ALIAS_FORMAT = "/%s/VAADIN/themes/%s";
+ public static final String VAADIN_WIDGETSET_ALIAS_FORMAT = "/%s/VAADIN/widgetsets/%s";
+
+ public static final String VAADIN_THEME_PATH_FORMAT = "/VAADIN/themes/%s";
+ public static final String VAADIN_WIDGETSET_PATH_FORMAT = "/VAADIN/widgetsets/%s";
+
+ private String bundleVersion;
+
+ public void setBundleVersion(String bundleVersion) {
+ this.bundleVersion = bundleVersion;
+ }
+
+ @Override
+ public void publishTheme(String themeName, HttpService httpService)
+ throws NamespaceException {
+ doPublish(themeName, VAADIN_THEME_ALIAS_FORMAT,
+ VAADIN_THEME_PATH_FORMAT, httpService);
+ }
+
+ private void doPublish(String resourceName, String aliasFormat,
+ String pathFormat, HttpService httpService)
+ throws NamespaceException {
+ String bundleVersionPrefix = String.format(NAMESPACE_PREFIX,
+ bundleVersion);
+
+ String resourcePath = String.format(pathFormat, resourceName);
+ String resourceAlias = String.format(aliasFormat, bundleVersionPrefix,
+ resourceName);
+
+ httpService.registerResources(resourceAlias, resourcePath, null);
+ }
+
+ @Override
+ public void publishResource(String resource, HttpService httpService)
+ throws NamespaceException {
+ doPublish(resource, VAADIN_ROOT_ALIAS_FORMAT, VAADIN_ROOT_FORMAT,
+ httpService);
+ }
+
+ @Override
+ public void publishWidgetset(String widgetset, HttpService httpService)
+ throws NamespaceException {
+ doPublish(widgetset, VAADIN_WIDGETSET_ALIAS_FORMAT,
+ VAADIN_WIDGETSET_PATH_FORMAT, httpService);
+ }
+
+ @Override
+ public String getResourcePathPrefix() {
+ return String.format(NAMESPACE_PREFIX, bundleVersion);
+ }
+}
diff --git a/themes/bnd.bnd b/themes/bnd.bnd
new file mode 100644
index 00000000000..7398d4de6e7
--- /dev/null
+++ b/themes/bnd.bnd
@@ -0,0 +1,6 @@
+Bundle-SymbolicName: ${project.groupId}.themes
+Bundle-Name: Vaadin Themes
+Bundle-Version: ${osgi.bundle.version}
+Import-Package: com.vaadin.*;version='[${osgi.bundle.version},${osgi.bundle.version}]',\
+ *
+Export-Package: com.vaadin.osgi.themes;-noimport:=true
diff --git a/themes/pom.xml b/themes/pom.xml
index 502dcf7b4d9..345143749f9 100644
--- a/themes/pom.xml
+++ b/themes/pom.xml
@@ -54,6 +54,15 @@
commons-io
provided
+
+
+ org.osgi
+ osgi.core
+
+
+ org.osgi
+ osgi.cmpn
+
@@ -148,61 +157,10 @@
-
-
- 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=0
-
- -classpath
-
-
- com.vaadin.buildhelpers.GeneratePackageExports
-
- ${project.build.directory}/${project.build.finalName}.${project.packaging}
- VAADIN/themes
-
-
-
-
-
-
- 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/themes/src/main/java/com/vaadin/osgi/themes/ValoThemeContribution.java b/themes/src/main/java/com/vaadin/osgi/themes/ValoThemeContribution.java
new file mode 100644
index 00000000000..0b412015470
--- /dev/null
+++ b/themes/src/main/java/com/vaadin/osgi/themes/ValoThemeContribution.java
@@ -0,0 +1,30 @@
+package com.vaadin.osgi.themes;
+
+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 ValoThemeContribution {
+
+ private HttpService httpService;
+
+ @Activate
+ void startup() throws Exception {
+ VaadinResourceService service = OSGiVaadinResources.getService();
+ service.publishTheme("valo", httpService);
+ }
+
+ @Reference
+ void setHttpService(HttpService httpService) {
+ this.httpService = httpService;
+ }
+
+ void unsetHttpService(HttpService httpService) {
+ this.httpService = null;
+ }
+}