Giter Site home page Giter Site logo

sammso / osgi-bridge-and-fragmentedui-demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vaadin/osgi-bridge-and-fragmentedui-demo

0.0 2.0 0.0 163 KB

This is a demo that shows how to a) make Vaadin applications that are Web Application Bundles b)let osgi bundles contribute to UI of such an application

License: Apache License 2.0

Java 100.00%

osgi-bridge-and-fragmentedui-demo's Introduction

osgi-bridge-and-fragmentedui-demo

This is a demo that:

  1. shows how to run Vaadin application in OSGi container, with Vaadin artifacts deployed to the container as OSGi bundles and the application itself being OSGi bundle, more specifically Web Application Bundle (WAB)
  2. provides a thin, simple example on how to have other bundles in the container contribute to the Vaadin application UI

This is only a proof of concept. In particular the demo doesn't show any best practices as for now, it's only purpose is to prove that running mutli-bundle OSGi-Vaadin applications is possible. Also, there are things that are known not to work.

Setup

What you need to run the demo: 0. Use latest Java 1.8 from Oracle

  1. Download and install latest Karaf 4.x (at the moment this is 4.0.0.M1)

  2. (Optional, but recomended) For convenience, install webconsole feature in Karaf: # }> cd $KARAF_HOME # }> bin/karaf karaf }> feature:install webconsole This will ease deployment of OSGi bundles to Karaf

  3. Install war feature in Karaf karaf }> feature:install war

This will install, if not yet installed:

  • Jetty
  • Support for simple HTTP
  • Support for WAR files and Web Application Bundles
  1. Deploy Vaadin core bundles.

  2. Getting Vaadin Download vaadin-all-7.x.x.zip (use 7.3.5 or newer).

  3. Deploy Vaadin to Karaf.

You will want to deploy the following bundles:
* vaadin-client-compiled-7.3.5.jar
* vaadin-server-7.3.5.jar
* vaadin-shared-7.3.5.jar 
* vaadin-themes-7.3.5.jar
* lib/jsoup-1.6.3.jar
* lib/json-0.0.20080701.jar
* lib/guava-16.0.1.vaadin1.jar
* lib/streamhtmlparser-jsilver-0.0.10.vaadin1.jar
* lib/flute-1.3.0.gg2.jar

This can be done in two ways (and is not specific to Vaadin bundles, all the bundles can be deployed in those two ways described here):
* copy Vaadin bundles to `$KARAF_HOME\deploy`. Karaf will hot-deploy dropped files

or (only available if you installed `webconsole` feature)

* Open karaf webconsole: http://localhost:8181/system/console/bundles. By default username = password = karaf. Click `Install/Update…` button, choose Vaadin bundles to upload, click `Install or update`. There's no need to start the bundles.
  1. Build and deploy demo bundles The demo consists of two maven projects:
  • example – this is OSGi bridge and Vaadin WAB application
  • uifragment1 – this is bundle that contributes a UI fragment to the example application

First, you need to build and install example project to your local maven repository, as uifragment1 uses it as a maven dependency:

    # }> cd $DEMO_ROOT/example
    # }> mvn clean install

Then, you can build uifragment1 project:

    # }> cd $DEMO_ROOT/uifragment1
    # }> mvn clean package

Package is enough to get a deployable bundle

Then deploy both uifragment1/target/uifragment1-0.0.1.jar and example/target/example-0.0.1.war to Karaf in the same way as described above. Finally, you can start the demo. First, start example bundle (click on play button in bundle listing in web console, or use start command in terminal console). Open the web browser and go to http://localhost:8181/vaadin-osgi. You will see the main application window. On the left side there's navigation bar, initially empty. When you start uifragment1 bundle a button will appear in this navigation bar. After clicking on that button, a view contributed by uiframgent1 will be displayed in the larger part of the application window. Stopping the uifragment1 bundle will remove the view and button.

Things known to be broken

  1. Push. Push won't work because Karaf by default uses Jetty 9.0.7 and Atmosphere support for push used by Vaadin requires at least 9.1.x.
  2. Theme compilation. This is caused by sac.jar not being deployable as OSGi bundle (no OSGi metadata in META-INF/MANIFEST.MF file)

osgi-bridge-and-fragmentedui-demo's People

Contributors

macprzepiora avatar jojule avatar

Watchers

Sampsa Sohlman avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.