1 / 31

Application Development using Atlas Platform Sensor Network

Application Development using Atlas Platform Sensor Network. Dr. Sumi Helal Hen-I Yang Jan. 30 , 2007. Eclipse OSGi Atlas Plug-in. Outline. A short tour on Eclipse A short tour on OSGi platform (Knopflerfish) A tour on Atlas plug-in for Eclipse Format

layne
Download Presentation

Application Development using Atlas Platform Sensor Network

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Application Development using Atlas PlatformSensor Network Dr. Sumi Helal Hen-I Yang Jan. 30, 2007 Eclipse OSGi Atlas Plug-in

  2. Outline • A short tour on Eclipse • A short tour on OSGi platform (Knopflerfish) • A tour on Atlas plug-in for Eclipse • Format • A little bit of lecturing • A little bit of hands-on tutorial • 3 exercises • Hopefully a whole lot of discussions Eclipse OSGi Atlas Plug-in

  3. Download Eclipse Java JDK • http://java.sun.com/javase/downloads/index.jsp • Latest Release: JDK 5.0, update 7 • It takes about 1.5 minutes and occupies about 64 MB ----------------------------------------------------------- Eclipse • http://www.eclipse.org/downloads/ • Latest Release: Version 3.2 • It takes about 5 minutes and occupies about 120 MB Eclipse OSGi Atlas Plug-in

  4. What is Eclipse? • An extensible, open source IDE (integrated development environment). • Goals of Eclipse are "to develop a robust, full-featured, commercial-quality industry platform for the development of highly integrated tools." • Eclipse is completely platform- and language-neutral • Strong support in auxiliary tasks such as code refactoring, JUnit testing and Ant build tool Eclipse OSGi Atlas Plug-in

  5. Plug-ins • Eclipse in its basic configuration is simply an IDE for developing Java program. • Eclipse is extensible in that you can install plug-ins (from hundreds of organizations, including heavyweights like IBM, HP and Rational) • With JUnit Plug-in, Eclipse can unit test each class and method (included) • With CDT Plug-in, Eclipse can be used for C/C++ development (http://download.eclipse.org/tools/cdt/releases/callisto) • With Maven Plug-in, Eclipse can be used to establish dependencies, and automatically download necessary files • More plug-ins with different functionalities can be found at: http://eclipse-plugins.2y.net/eclipse/index.jsp Eclipse OSGi Atlas Plug-in

  6. What can Eclipse do for you? • Editing: Provide assistance in syntactic and semantic checking, auto-complete, tool tips, folding/unfolding of functions • Navigation: Provide list of projects and files for an overview of available resources, provide outline of classes • Compilation and Debugging: auto-build, separate source and binary files, breakpoints, variable evaluations • Team Support: CVS, FTP/SFTP, auto merge and conflict resolution • Auxiliary: To do list, problems, properties, console, create javadoc automatically Eclipse OSGi Atlas Plug-in

  7. Why Do we Talk about Eclipse? • The goal of Atlas platform is to provide an end-to-end solution. As part of this solution, an OSGi bundle development Plug-in has been developed to help programmers build new applications more effectively • This OSGi plug-in is built on top of Eclipse • A basic understanding of Eclipse and to provide a short tutorial to the class can hopefully provide a boost to your term project Eclipse OSGi Atlas Plug-in

  8. Installation of Eclipse • It’s easy. Just unzip it • The last part of the installation is completed when you run Eclipse for the first time Eclipse OSGi Atlas Plug-in

  9. Running Eclipse • Eclipse.exe under eclipse directory • Select a Workspace • Start building your application Eclipse OSGi Atlas Plug-in

  10. Terminology in Eclipse • Workspace • Project • Directory • Source Directory • Binary Directory • Resources ------------------------------------------------------------------ • Perspectives • Views Eclipse OSGi Atlas Plug-in

  11. Exercise 1: Running Eclipse • Initiate Eclipse • Create a new project (with name of your choosing) • Try switching between different perspectives • Implement a “Hello Mobile Computing Class” java program and execute it • Try debug perspective and play with breakpoints, use the variables view to monitor the value changes Eclipse OSGi Atlas Plug-in

  12. OSGi ™ Platform • A dynamic module system for Java™. • It provides the standardized primitives that allow applications to be constructed from small, reusable and collaborative components. • Components can be composed into an application and deployed. • Allow changing of the composition dynamically on the device of a variety of networks, without requiring restarts. • A service-oriented architecture that decouples components, and enables these components to dynamically discover each other for collaboration. • Many standard component interfaces for common functions like HTTP servers, configuration, logging, security, user administration, XML and many more are available and well-tested. Eclipse OSGI Atlas Plug-in http://www.osgi.org/osgi_technology/index.asp?section=2

  13. OSGi ™ Platform Eclipse OSGI Atlas Plug-in http://www.osgi.org/osgi_technology/index.asp?section=2

  14. OSGi Bundles • Bundles: Basic components in OSGi environment • Standard Bundle Composition: • Manifest • Code • Interface class • Methods that will be exposed to other bundles • Defines the visible external behavior of the bundle • Methods that would allow other bundles to invoke • Activator class • Life cycle management • The class that gets invoked first when an bundle becomes active • Handles details such as a) The starting condition b) The cleanup actions c) The plan of action when other bundles joins or leaves d) bind the local variables to instances of the bundles that would be used later • Implementation class • The real deal: the actual implementation of the functionalities/methods specified in the interface class • Actual usage of the variables specified and bound in the activator class • Where the real application logic is Eclipse OSGI Atlas Plug-in

  15. OSGi Bundles -- Interface package demo.test; import com.pervasa.atlas.dev.service.AtlasClient; public interface Demo extends AtlasClient { public void shutdown(); } Eclipse OSGI Atlas Plug-in

  16. OSGi Bundles -- Activator public class DemoActivator extends AtlasActivator { private DemoImpl service = null; public void start(BundleContext context) throws Exception { service = new DemoImpl(context, this); new Thread(service).start(); } public void stop(BundleContext context) throws Exception { service.shutdown(); } public void serviceAddition(ServiceEvent event) { … } public void serviceModification(ServiceEvent event) { … } public void serviceRemove(ServiceEvent event) { … } } Eclipse OSGI Atlas Plug-in

  17. OSGi Bundles -- Implementation public class DemoImpl extends AtlasImpl implements Demo { protected InterlinkPressureSensor ps; protected LED led; protected HS322Servo servo; protected boolean running; public void assignEntity(Object obj) { if (obj instanceof InterlinkPressureSensor) { this.ps = (InterlinkPressureSensor) obj; } else if (obj instanceof HS322Servo) { this.servo = (HS322Servo) obj; } else if (obj instanceof LED) { this.led = (LED) obj; } } public void unassignEntity(Object obj) { … } public void ReceivedData(String arg0, Properties props) { // Real Application Logic Comes Here } } Eclipse OSGI Atlas Plug-in

  18. OSGi Bundles – Manifest Bundle-Name: Demo Bundle-Activator: demo.test.impl.DemoActivator Device-Type: Application Import-Package: org.osgi.framework,com.pervasa.atlas.dev.service,org.sensorplatform.sensors.pressure,org.sensorplatform.actuators.servo.hs322 Bundle-Vendor: ICTA Bundle-Author: hyang Bundle-SymbolicName: Demo Bundle-Category: application Bundle-Version: 1.0.0 Eclipse OSGI Atlas Plug-in

  19. Download Knopflerfish • Knopflerfish is an open source OSGi reference implementation • The goal with the Knopflerfish project is to develop and distribute easy to use open source code, build tools and applications, related to the OSGi framework. • http://www.knopflerfish.org/download.html • Download Knopflerfish 1.3.5 • http://www.knopflerfish.org/releases/1.3.5/knopflerfish_fullbin_osgi_1.3.5.jar • Self extracting and easy installation Eclipse OSGI Atlas Plug-in

  20. Exercise 2: Implementing a Bundle • Work in groups of 2 – 3 • Download the sample files to get you started: http://www.cise.ufl.edu/~hyang/mobile • Implement the interface class • Implement the activator class • Implement the implementation class • Download the make file • Try to compile and deploy the bundle to verify if they actually work Eclipse OSGI Atlas Plug-in

  21. Bundles, Bundles and More Bundles • Download the following bundles • http://www.cise.ufl.edu/~hyang/mobile • AtlasDev.jar • HS322Servo.jar • InterlinkPressureSensor.jar • Download the following bundles that are parts of the OSGi plugin • BundleDownloader.jar • BundleUploader.jar (careful with the placement) Eclipse OSGI Atlas Plug-in

  22. What does the OSGi plug-in do? • Browse Available Entities and Services • Provide Information on OSGi bundles • Design by Selection • Semi-automatic Environment Setup • Integrate seamlessly with all the nice features and assistance provided by Eclipse • Deploy New Bundles Back to Smart Space Eclipse OSGI Atlas Plug-in

  23. Assumptions • Physical entities (sensors and actuators) are already in place, properly configured and represented as bundles • Programmers can implement new applications remotely based on the available entities in the space • The dynamic aspects of smart space is handled by two mechanisms • At implementation stage: Snapshot • At runtime: OSGi bundle life cycle management Eclipse OSGI Atlas Plug-in

  24. Download OSGi Plug-in for Eclipse OSGi Plug-in • http://www.cise.ufl.edu/~hyang/update2/plugins/edu.ufl.icta.jarview2_0.2.1.jar • Latest Release: Version 0.2.1 • Can be downloaded directly from the URL shown above Or • Can be automatically updated using Software Updates Manager in Eclipse (http://www.cise.ufl.edu/~hyang/update2) Eclipse OSGI Atlas Plug-in

  25. Installation of OSGi plug-in • It’s easy. • If you download using Eclipse Software Update Manager, you don’t need to do a thing except to restart Eclipse (not necessary, but preferred) • If you download the plug-in manually, you need to manually copy/place the jar file in plugins directory Eclipse OSGI Atlas Plug-in

  26. Running OSGi plug-in for Eclipse • Download configuration file: • Can be downloaded from http://www.cise.ufl.edu/~hyang/mobile • Save to C:\properties.txt • Configure the OSGi Plug-in by modifying the value • Restart Eclipse • Select a Workspace • Switch to OSGi Perspective Eclipse OSGI Atlas Plug-in

  27. Components of OSGi plug-in for Eclipse • OSGi Perspective --------------------------------------------------------------------------- • Sensor List View • Actuator List View • Bundle List View • Bundle Manifest Info View --------------------------------------------------------------------------- • Download Bundle Action • Refresh Action • Redirect Action • New Bundle Creation Action • Deploy Action Eclipse OSGI Atlas Plug-in

  28. How to Develop New Application? • Initiate the OSGi platform if you have not done so yet • Choose and connect to a OSGi platform • Edit the Manifest File • Select entities from the sensor/actuator lists that are needed for the application • Edit the template source code files and implement the logic for the application • Deploy back the application to the actual environment Eclipse OSGI Atlas Plug-in

  29. Exercise 3: Implementing a Bundle using Atlas plug-in • Connect to target OSGi platform • Browse through bundles on the remote platform • Design by Selection • Create new project/bundle • Implement the logic of the application • Deploy the new bundle • Test and verify if the new bundle functions correctly Eclipse OSGI Atlas Plug-in

  30. Conclusion • By providing tools associated with a mature and popular IDE, we created the most synergy to the Java programmers. • Programmers can remotely develop the application, fix all the problems locally before deploy it back to the runtime environment • Design by Selection Philosophy • Minimize the repetitive portions of the bundle implementation to • Reduce entry barrier to new OSGi programmers • Reduce cumbersome repetition to experience programmers Eclipse OSGi Atlas Plug-in

  31. Application Development using Atlas PlatformCEN5531 – Mobile Computing Dr. Sumi Helal Hen-I Yang Jan. 30, 2007 Eclipse OSGi Atlas Plug-in

More Related