diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/bnd.bnd | 15 | ||||
-rw-r--r-- | server/pom.xml | 65 | ||||
-rw-r--r-- | server/src/main/java/com/vaadin/server/osgi/BootstrapContribution.java | 50 | ||||
-rw-r--r-- | server/src/test/java/com/vaadin/tests/server/ClassesSerializableTest.java | 2 |
4 files changed, 91 insertions, 41 deletions
diff --git a/server/bnd.bnd b/server/bnd.bnd new file mode 100644 index 0000000000..dfeb5d5d39 --- /dev/null +++ b/server/bnd.bnd @@ -0,0 +1,15 @@ +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 d890a25462..3d2f8c47bc 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -20,6 +20,14 @@ <!-- Liferay Portal Service --> <dependency> <groupId>com.liferay.portal</groupId> + <artifactId>com.liferay.portal.kernel</artifactId> + <version>${liferay.portal-kernel.version}</version> + <scope>provided</scope> + </dependency> + + <!-- Liferay 6 --> + <dependency> + <groupId>com.liferay.portal</groupId> <artifactId>portal-service</artifactId> <version>${liferay.portal-service.version}</version> <scope>provided</scope> @@ -85,6 +93,17 @@ <version>1.2.0</version> </dependency> + <!-- OSGi API --> + + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.core</artifactId> + </dependency> + <dependency> + <groupId>org.osgi</groupId> + <artifactId>osgi.cmpn</artifactId> + </dependency> + <!-- TESTING DEPENDENCIES --> <!-- Test dependencies --> @@ -225,46 +244,10 @@ </execution> </executions> </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Bundle-RequiredExecutionEnvironment>${osgi.execution.environment}</Bundle-RequiredExecutionEnvironment> - <Bundle-Version>${osgi.bundle.version}</Bundle-Version> - <Export-Package>VAADIN;version="${osgi.bundle.version}",com.vaadin.*;version="${osgi.bundle.version}"</Export-Package> - <!-- Note that Liferay 6 does not use OSGi, and the dependency is optional for non-Liferay deployments --> - <Import-Package>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</Import-Package> - <Require-Bundle> - 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</Require-Bundle> - </instructions> - </configuration> - <executions> - <execution> - <id>bundle-manifest</id> - <phase>prepare-package</phase> - <goals> - <goal>manifest</goal> - </goals> - </execution> - </executions> + <groupId>biz.aQute.bnd</groupId> + <artifactId>bnd-maven-plugin</artifactId> </plugin> - <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> @@ -277,7 +260,7 @@ </manifest> </archive> </configuration> - <!-- Package src/test into a jar so that compatbility-server + <!-- Package src/test into a jar so that compatbility-server can use the same test classes, e.g. test beans --> <executions> <execution> @@ -293,7 +276,7 @@ <artifactId>maven-surefire-plugin</artifactId> </plugin> </plugins> - + <pluginManagement> <plugins> <!-- Make Eclipse add the source folder --> @@ -334,5 +317,5 @@ </plugins> </pluginManagement> </build> - + </project> 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 0000000000..0a320ed6e5 --- /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 ec1032c797..b4f9851867 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.*" }; /** |