 Proteus Framework Redefining the plugin. Why a new framework?  Present approaches (e.g. OSGi) use non-standard approaches that create too many breaking.

Slides:



Advertisements
Similar presentations
NetServ Dynamic in-network service deployment Henning Schulzrinne (Columbia University) Srinivasan Seetharaman (Georgia Tech) Volker Hilt (Bell Labs)
Advertisements

OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
Programming Languages and Paradigms
Using Eclipse. Getting Started There are three ways to create a Java project: 1:Select File > New > Project, 2 Select the arrow of the button in the upper.
 Copyright 2005 Digital Enterprise Research Institute. All rights reserved. The Web Services Modeling Toolkit Mick Kerrigan.
 Copyright 2005 Digital Enterprise Research Institute. All rights reserved. The WSML Editor Plugin to the Web Services Modeling Toolkit Mick.
ITEC200 – Week03 Inheritance and Class Hierarchies.
Why OSGi matters for Enterprise Java Infrastructures
Next Generation Node (NGN) Technical Overview April 2007.
OSGi: Open Services Gateway Initiative Richard Chapman 5 Sept
1 Chapter 3 Programs and Packages. 2 Java Virtual Machine (JVM) Java programs execute on the JVM. The JVM is a virtual rather than a physical machine,
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
What Is a Factory Pattern?.  Factories are classes that create or construct something.  In the case of object-oriented code languages, factories construct.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Factory Method Design Pattern (1) –A creational design.
1 Lecture 22 George Koutsogiannakis Summer 2011 CS441 CURRENT TOPICS IN PROGRAMMING LANGUAGES.
Lecture Roger Sutton CO530 Automation Tools 5: Class Libraries and Assemblies 1.
Programming Languages and Paradigms Object-Oriented Programming.
M1G Introduction to Programming 2 4. Enhancing a class:Room.
OSGi.
© Keren Kalif Intro to Android Development Written by Keren Kalif, Edited by Liron Blecher Contains slides from Google I/O presentation.
1/151/15 ENT Metamodel Implementation & Applications ENT metamodel, prototype implementation Component substitutability checking, ENT based component comparison.
The Metadata System1. 2 Introduction Metadata is data that describes data. Traditionally, metadata has been found in language- specific files (e.g. C/C++
Introduction to the Atlas Platform Mobile & Pervasive Computing Laboratory Department of Computer and Information Sciences and Engineering University of.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Zhonghua Qu and Ovidiu Daescu December 24, 2009 University of Texas at Dallas.
Java Introduction Lecture 1. Java Powerful, object-oriented language Free SDK and many resources at
CSC3315 (Spring 2009)1 CSC 3315 Programming Languages Hamid Harroud School of Science and Engineering, Akhawayn University
C# Programming Fundamentals of Object-Oriented Programming Fundamentals of Object-Oriented Programming Introducing Microsoft.NET Introducing Microsoft.NET.
Review: OSGi – a component framework for Java Bundle OSGi Framework Bundle Java Runtime Environment (JRE) Operating System (OS) Hardware “Dynamic Modules.
Android for Java Developers Denver Java Users Group Jan 11, Mike
.NET Framework Danish Sami UG Lead.NetFoundry
Tuscany 2.x Extensibility and SPIs Raymond Feng. Tuscany Extensibility Cx2x/Tuscany+2.x+Extensibility+and+SPIs#extensions.
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
POS 406 Java Technology And Beginning Java Code
Overview of Android Application Development
Comparing JavaBeans and OSGi Towards an Integration of Two Complementary Component Models HUMBERTO CERVANTES JEAN-MARIE FAVRE 09/02.
OSGi Enablement for Tuscany Raymond Feng. Overview.
Sage ACT! 2013 SDK Update Brian P. Mowka March 23, 2012 Template date: October 2010.
The Factory Patterns SE-2811 Dr. Mark L. Hornick 1.
SWE 316: Software Design and Architecture Objectives Lecture # 18 Introduction to Components SWE 316: Software Design and Architecture To learn:  benefits.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Remoting Simplifying.
Chapter 3 Inheritance and Polymorphism Goals: 1.Superclasses and subclasses 2.Inheritance Hierarchy 3.Polymorphism 4.Type Compatibility 5.Abstract Classes.
Programming in Java CSCI-2220 Object Oriented Programming.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Slide 1 ApacheCon 2011 > Doreen Seider> Using OSGi to Build Better Software > Using OSGi to Build Better Software Lessons from a Telemedicine.
Interfaces About Interfaces Interfaces and abstract classes provide more structured way to separate interface from implementation
Java EE - Dependency Injection -
Plug-in Architectures Presented by Truc Nguyen. What’s a plug-in? “a type of program that tightly integrates with a larger application to add a special.
Dependency Injection Frameworks Technion – Institute of Technology Author: Assaf Israel - Technion 2013 ©
Method Overriding Remember inheritance: when a child class inherits methods, variables, etc from a parent class. Example: public class Dictionary extends.
Programming in java Packages Access Protection Importing packages Java program structure Interfaces Why interface Defining interface Accessing impln thru.
Slides prepared by Rose Williams, Binghamton University Chapter 16 Collections and Iterators.
ETICS All Hands meeting B ologna, October , 2006 WP4 Test and Metrics Plugin Framework (WP4) (WP4) Eva TAKACS.
CSCE 240 – Intro to Software Engineering Lecture 3.
RealTimeSystems Lab Jong-Koo, Lim
Component Base Class Rationale
Names and Attributes Names are a key programming language feature
Overall Architecture and Component Model
Object-Oriented Programming & Design Lecture 14 Martin van Bommel
Magento Technical Guidelines Eugene Shakhsuvarov, Software Magento
Introduction Enosis Learning.
Introduction Enosis Learning.
Present by Andie Saizan, MCP
Embracing Java 9 and beyond with Eclipse JDT
Java Programming Language
Google App Engine Ying Zou 01/24/2016.
Presentation transcript:

 Proteus Framework Redefining the plugin

Why a new framework?  Present approaches (e.g. OSGi) use non-standard approaches that create too many breaking points  Designing a plugin architecture for both scalability and supportability requires an extra level of design often overlooked  Few developers embrace the built-in plugin capabilities of the Java platform

Forward Compatibility  Definition: the ability of an SDK to ensure that plugins written in version n continue work without recompilation in version n+1  As the architect of a plugin-driven application, how do you guarantee forward compatibility when the plugin consumer has imported your interfaces into their binaries?

What’s wrong with OSGi?  In a word: nothing  However, it may not be the right framework for your application. Why pick Struts over Spring? Why use Spring over pure EJB? Advocates of each of these frameworks can quickly enumerate why they felt (or chose) one framework over the other. One framework doesn't solve every problem

OSGi vs Proteus  Both embody the notion of SOA in a Virtual Machine  Modularity is at the core of both designs  Plugins (or Bundles, in OSGi parlance) are published, found by a consumer dynamically at runtime, and bound in order to issue service invocation requests  OSGi relies on the MANIFEST.MF metadata to publish (export) its plugins (bundles)  Proteus relies on compiled code, Plugin Archetypes that define a class of service, and core Java SE’s Service Provider Interface (SPI) architecture

Runtime vs Compile Time  OSGi relies on "proprietary” MANIFEST.MF metadata to wire up services  Googling shows just how hard time consuming it can be to wire up existing libraries into OSGi  Inherent class loader problems come along for free  Proteus adopts the standardized Java Service Provider Interface (SPI) architecture built-in to Java SE  No wiring beyond declaring the factory in META-INF/services  Not designed to solve the “2 versions of the same library” problem

Comparing Coding Styles  OSGi String serviceName = Service.class.getName(); ServiceReference ref = ctx.getServiceReference(serviceName); Service svc = (Service) ctx.getService(ref)); svc.callSomeMethod();  Proteus INamespace ns = new Namespace(“com.foo”, “Bar”); IPluginRegistrar pluginRegistrar = delegate.getPluginRegistrar(ns); MyService svc = pluginRegistrar.createPlugin(new Version(1), MyService.class); svc.callSomeMethod();

Breaking Dependencies  Instead of the plugin consumer directly importing the plugins actual interface, the plugin consumer needs to import a proxy that represents a specific version of a plugin interface.  Java includes native support for dynamic proxy objects!  Plugin consumer achieves compile type type checking, but they do so by compiling against a specific version of a proxy interface instead of the actual physical interface used by the actual plugin  Look at the last slide again- notice the explicit version request of a proxy interface, 1.0 of MyService.

GoF Interface Development  Develop against an interface, not an implementation  Proteus, like OSGi, forces the developer to embrace this fundamental tenant of object oriented development  Plugin Archetype is a physical construct that drives interface over implementation development at the plugin level  Comprised of a namespace and a set of versioned interfaces  Typically deployed in a single.jar file  Plugin Archetype = Category of Plugin

Versions: First Class Citizens  Semantic Versioning   Major.Minor.Patch  Versions must increase over time  Minor version may include new, backwards compatible functionality  1.0 is forward compatible with 1.1  1.1 is not backward compatible with 1.0  Patch level is never considered when determining version compatibility  Patches must not introduce new functionality, only bug fixes! All Proteus plugin access includes an explicit version reference

Triple-Bonded Factory Design  Proteus Factory Registrar is the master registrar that manages one or more Plugin Archetypes  Each Plugin Archetype maintains its own Plugin Registrar that manages one or more concrete implementations of the archetype.  The Plugin Registrar is a factory that can create instances of a specific version and/or instance of the plugin archetype Proteus Factory Registrar  Plugin Registrar  Plugin Instance

Proteus Factory Registrar  E ntry point into the Proteus plugin architecture  Registrar is solely responsible for being the authoritative registrar for all known Plugin Archetypes  Access to the Proteus Factory Registrar is implicit through an injected delegate: IPluginRegistrar pluginRegistrar = delegate.getPluginRegistrar(NAMESPACE);

a priori Archetype Knowledge  Applications must have a priori knowledge of the plugin archetypes they intend to support  Application is designed against a specific archetype interface version  Remember, archetype is defined by a namespace and version  Java SE Service Provider Interface ServiceLoader architecture used to dynamically locate and enumerate plugin archetypes instances  Archetypes are declared in the.jar manifest according to Java SE by defining their fully qualified class within a text file defined by Java SE SPI architeture: META-INF/services/org.proteusframework.spi.ProteusRegistrarFactory

Plugin Registrar  Plugin Registrar is the authoritative registrar for a specific Plugin Archetype.  Specific plugin instances can be be created by version  Proteus embraces Java Generics Version ver = new Version(1); MyInterface plugin = pluginRegistrar.createPlugin(ver, MyInterface.class);

Dynamic Plugin Discovery  Plugin Archetypes require a priori knowledge programmed into the application  Concrete instances of a plugin archetype have no such requirement; discovered dynamically by Java SE by searching the CLASSPATH for.jar manifest entries META-INF/services/org.proteusframework.pluigin.spi.MyPlugin

Plugin Architecture Review  The Proteus Factory Registrar manages a collection of Plugin Archetypes  A Plugin Archetype Registrar Factory creates a singular Plugin Registrar  A Plugin Registrar manages a collection of homogenous Plugin Instances  A Plugin Instance provides a specific configurable concrete plugin

Defining a Plugin Archetype

Archetype Package Structure  Interfaces  Defines one or more versions of a plugin’s interface  Registrar  Plugin Archetype Registrar Factory that collects concrete instances of the archetype and stands ready to instantiate specific plugin implementation versions  SPI  Abstract plugin factory extended by concrete instances  Plugin Archetype Registrar Factory delegates construction of the plugin instance here  META-INF/services  How a plugin archetype is declared within a Proteus Application

Archetype Definition  By and large boilerplate code  Anticipate implement a mvn plugin so that a plugin can be created via mvn archetype:archetype command  Decide on a namespace  Implement one or more plugin interface versions  Link the interfaces to semantic versions within the VersionCollection

Concrete Plugin Structure

Plugin Factory Implementation

Version Implementation  Proxy Interface unused by concrete plugin implementations  Concrete plugin extends the actual version interface; the plugin instance is explicitly dependent upon the Plugin Archetype.jar public class Version1Impl extends AbstractStandardPlugin implements ISampleVersion1  Specific Version  Each plugin is tied to a specific version explicitly be the versioned interface it implements from the plugin archetype

Bootstrap a Proteus Application  Create a main class that extends AbstractRuntimeEngine public class SampleApplication extends AbstractRuntimeEngine  Create an instance of either a StandardProteusApplication or ExtendedProteusApplication IProteusApplication myApplication = new StandardProteusApplication();  Instantiate the runtime engine IRuntimeEngine myRuntimeEngine = new SampleApplication();

Bootstrap a Proteus Application  Inject the runtime engine into the application myApplication.setRuntimeEngine(myRuntimeEngine);  Start the application myApplication.startApplication();  Formally launch the application in the run() method public void run() {runningFlag = true;... }

Application Configuration  Standard Proteus applications can easily separate out their configuration from the actual runtime implementation  Use of IConfigurationLoader provides an abstraction on IProteusApplication between configuration and storage  Java SE deployment will differ from an Android deployment

Plugin Instantiation  Get version 1 interface from the default plugin provider  Default can be defined during runtime engine configuration (e.g..properties file) MyExpectedVersion1Interface example1 = pluginRegistrar.createPlugin(new Version(1), MyExpectedVersion1Interface.class);

Plugin Instantiation  Get version 1 interface from a specific concrete plugin INamespace pluginNS = new Namespace(”com.foo", “FooRegistrar"); IVersionDescriptor vd = new VersionDescriptor(pluginNS, new Version(1, 0)); MyVersion1Interface example2 = pluginRegistrar.createPlugin(vd, MyVersion1Interface.class);

Application Shutdown  Resource cleanup requires that the engine be shutdown propertly  Accomplished with a single call: myApplication.stopApplication();