Tu sca ny 1 Extending The Tuscany Java SCA Runtime 21 August 2006.

Slides:



Advertisements
Similar presentations
What is RMI? Remote Method Invocation –A true distributed computing application interface for Java, written to provide easy access to objects existing.
Advertisements

RMI Varun SainiYing Chen. What is RMI? RMI is the action of invoking a method of a remote interface on a remote object. It is used to develop applications.
Tu sca ny 1 The Tuscany Java Recursive Core: Architecture Update 5 June 2006.
Exceptions and Exception Handling Carl Alphonce CSE116 March 9, 2007.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
C# and Windows Programming Application Domains and Remoting.
Remote Method Invocation in Java Bennie Lewis EEL 6897.
Remote Method Invocation
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
Tu sca ny 1 Simplifying Service Oriented Applications with The Apache Tuscany project Jeremy Boynes 27 July 2006.
MC365 Application Servers: Servlets. Today We Will Cover: What a servlet is The HTTPServlet and some of its more important methods How to configure the.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
Introduction to Remote Method Invocation (RMI)
1 Chapter 6 Inheritance, Interfaces, and Abstract Classes.
An Approach to Safe Object Sharing Ciaran Bryce & Chrislain Razafimahefa University of Geneva, Switzerland.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
Protection of Agent Teamwork By Jeremy Hall. Agent Teamwork Overview ● Mobile agent framework  AgentTeamwork 2 is a mobile-agent based middleware system.
Java Methods By J. W. Rider. Java Methods Modularity Declaring methods –Header, signature, prototype Static Void Local variables –this Return Reentrancy.
1 3. Implementing Web Services 1.Create SOAP proxy interfaces and WSDL based service descriptions 2.Register/publish services 3.Stores service descriptions.
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
Spring core v3.x Prepared by: Nhan Le. History v3.0 Spring Expression Language Java based bean metadata v3.1 Cache Abstraction Bean Definition Profile.
Recap (önemli noktaları yinelemek) from last week Paradigm Kay’s Description Intro to Objects Messages / Interconnections Information Hiding Classes Inheritance.
PicoContainer Presented by: Jim O’Hara Ed Kausmeyer Jingming Zhang.
+ A Short Java RMI Tutorial Usman Saleem
Tuscany 2.x Extensibility and SPIs Raymond Feng. Tuscany Extensibility Cx2x/Tuscany+2.x+Extensibility+and+SPIs#extensions.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Component frameworks Roy Kensmil. Historical trens in software development. ABSTRACT INTERACTIONS COMPONENT BUS COMPONENT GLUE THIRD-PARTY BINDING.
Slide 1 Extending Tuscany Raymond Feng Apache Tuscany committer.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Java Remote Method Invocation RMI. Idea If objects communicate with each other on one JVM why not do the same on several JVM’s? If objects communicate.
RMI Remote Method Invocation Distributed Object-based System and RPC Together 2-Jun-16.
Tuscany: a SOA framework Jeffrey Guo Accelrys, Inc.
Tu sca ny 1 The Tuscany Java SCA Runtime 20 August 2006.
Tuscany Runtime Architecture. Contents Overview An example Bootstrap kernel Process of composite application.
Tu sca ny 1 The Tuscany Project in the Apache Incubator and The Service Component Architecture Jeremy Boynes Simon Nash 28 June 2006.
Server-Side Java Mapping Copyright © ZeroC, Inc. Ice Programming with Java 6. Server-Side Java Mapping.
Eric Tryon Brian Clark Christopher McKeowen. System Architecture The architecture can be broken down to three different basic layers Stub/skeleton layer.
DESIGN PATTERNS COMMONLY USED PATTERNS What is a design pattern ? Defining certain rules to tackle a particular kind of problem in software development.
Slide 1 Extending Tuscany Raymond Feng Apache Tuscany committer.
JS (Java Servlets). Internet evolution [1] The internet Internet started of as a static content dispersal and delivery mechanism, where files residing.
Slide 1 Extending Tuscany Raymond Feng Apache Tuscany committer.
1 Spring Framework April, 2012 Lam Ho Lam To. © 2010 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2 1.Spring Overview 2.Framework.
Dependency Injection Frameworks Technion – Institute of Technology Author: Assaf Israel - Technion 2013 ©
SCA and Java n SCA provides support for multiple Java-based component implementation types l Java POJOs (implementation.java) l Spring Beans (implementation.spring)
Interfaces F What is an Interface? F Creating an Interface F Implementing an Interface F What is Marker Interface?
The Prototype Pattern (Creational) ©SoftMoore ConsultingSlide 1.
COM S 228 Introduction to Data Structures Instructor: Ying Cai Department of Computer Science Iowa State University Office: Atanasoff.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Web Services Architecture Presentation for ECE8813 Spring 2003 By: Mohamed Mansour.
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
(1) Dynamic Proxies in Java And so on into winter Till even I have ceased To come as a foot printer, And only some slight beast So mousy or foxy Shall.
Remote Method Invocation A Client Server Approach.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
Remote Method Invocation RMI architecture stubs and skeletons for remote services RMI server and client in Java Creating an RMI Application step-by- step.
Chapter 4 Request and Response. Servlets are controlled by the container.
1 Lecture 15 Remote Method Invocation Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung Institute of Technology.
Dependency Injection with Guice Technion – Institute of Technology Author: Gal Lalouche - Technion 2016 ©
1 Case Study: Meta Classes  Class representation in memory  Class variables and class methods  Meta Classes  3 Level System  4 Level System  5 Level.
Topic: Java Class Loader
Remote Method Invocation
Java Beans Sagun Dhakhwa.
What is RMI? Remote Method Invocation
Tuscany Java SCA Architecture
Apache Tuscany Demo BigBank Example
Classes and Objects Imran Rashid CTO at ManiWeber Technologies.
Java Remote Method Invocation
Plug-In Architecture Pattern
Presentation transcript:

tu sca ny 1 Extending The Tuscany Java SCA Runtime 21 August 2006

tu sca ny 2 Agenda Overview Extension Types Creating a Binding Extension Advanced Tuscany Programming Model Creating a Component Type Extension

tu sca ny 3 Overview The Tuscany core was designed to be as simple and small as possible Focus on wiring/assembly Most capabilities provided as extensions Component implementation types, e.g. Spring Support for Bindings Support for Policy/Qualities of Sevice Loading of XML The basic extension model is SCA Extensions are “system services” which are SCA components

tu sca ny 4 Runtime Assembly The runtime is itself an SCA assembly Create Runtime Component Create Bootstrap Deployer Deploy System Assembly Locate Application Assemblies Locate System Assembly Deploy Application Assembly Start Server

tu sca ny 5 Component Tree Composites form a containment hierarchy The hierarchy may be arbitrarily deep The runtime itself, DefaultRuntime, is a composite There are two runtime hierarchies The application hierarchy End-user components The system hierarchy Runtime extensions

tu sca ny 6 The SPI Package A separate SPI project has been created for extending the runtime Extension code must never reference classes in core Besides being bad design, this type of code will break when deployed to hosts that enforce classloader isolation There is a test package for testcases to instantiate a few core implementation classes without directly referencing them (we should look to eliminate it if possible) tuscany-core is an implementation of spi core spi Extension

tu sca ny 7 Agenda Overview Extension Types Creating a Binding Extension Advanced Tuscany Programming Model Creating a Component Type Extension

tu sca ny 8 Base Extension Types Components Protocol Bindings Transport Bindings Data Bindings Policy Loaders Other types: Scope contexts Wires Proxy generation Anything people can think of and attach to the runtime…

tu sca ny 9 Extension Package spi contains an extension package with abstract classes for base extensions AtomicComponentExtension.java CompositeComponentExtension.java LoaderExtension.java ReferenceExtension.java ServiceExtension.java If extenders do not want to inherit from a base class, they can implement interfaces

tu sca ny 10 Extension Programming Model Extensions consist of a set of components that offer services Are POJOs that follow the SCA Java programming model Extensions are contributed as composite components to the runtime There are a few programming model extensions for logging and advanced wiring that we will discuss later

tu sca ny 11 Agenda Overview Extension Types Creating a Binding Extension Advanced Tuscany Programming Model Creating a Component Type Extension

tu sca ny 12 Binding Invocation Through a Reference When a message reaches the end of the outbound reference wire, the TargetInvoker dispatches over a transport OutboundInboundOutbound Invoke on transport AtomicComponentComposite Reference

tu sca ny 13 Binding Invocation Through a Service Invocation is deserialized from a transport and passed through the service invocationchain OutboundInbound Composite Service AtomicComponent Inbound Invoke Invoke from transport

tu sca ny 14 Creating a Binding Extension Bindings are used by Services and References Binding extensions produce either Services or References Must create a Loader and Builder For references the builder produces an implementation of org.apache.tuscany.spi.componen.Reference For services the builder produces an implemenation of org.apache.tuscany.spi.component.Service Services may register servlets for incoming requests through org.apache.tuscany.spi.host.ServletHost References responsible for creating instances TargetInvoker, Services do not need to loadbuild connect

tu sca ny 15 A Loader Is an SCA Component Extends org.apache.tuscany.spi.extension.LoaderExtension public class EchoBindingLoader extends LoaderExtension { public static final QName BINDING_ECHO = new QName(XML_NAMESPACE_1_0, public LoaderRegistry registry) { super(registry); } public QName getXMLType() { return BINDING_ECHO; } public EchoBinding load(CompositeComponent parent, XMLStreamReader reader, DeploymentContext context) throws XMLStreamException, LoaderException { return new EchoBinding(); } Returns the Binding model object Normally, XML would be parsed with the reader

tu sca ny 16 A Builder Is an SCA Component Extends org.apache.tuscany.spi.extension.BindingBuilderExtension public class EchoBuilder extends BindingBuilderExtension { public SCAObject build(CompositeComponent parent, BoundReferenceDefinition definition, DeploymentContext context) { Class interfaze = definition.getServiceContract().getInterfaceClass(); String name = definition.getName(); return new EchoReference(name, interfaze, parent, wireService); } public SCAObject build(CompositeComponent parent, BoundServiceDefinition definition, DeploymentContext context) { Class interfaze = definition.getServiceContract().getInterfaceClass(); return new EchoService(definition.getName(), interfaze, parent, wireService); } protected Class getBindingType() { return EchoBinding.class; } Describes to the runtime which binding type the class handles

tu sca ny 17 The TargetInvoker Returned by References public class EchoInvoker implements TargetInvoker { //… public Object invokeTarget(final Object payload) throws InvocationTargetException { // echo back the result, a real binding would invoke some API for flowing the request return ((Object[])payload)[0]; } public Message invoke(Message msg) throws InvocationRuntimeException { try { Object resp = invokeTarget(msg.getBody()); msg.setBody(resp); } catch (InvocationTargetException e) { msg.setBody(e.getCause()); } catch (Throwable e) { msg.setBody(e); } return msg; } public Object clone() throws CloneNotSupportedException { return super.clone(); } Describes to the runtime which binding type the class handles

tu sca ny 18 Agenda Overview Extension Types Creating a Binding Extension Advanced Tuscany Programming Model Creating a Component Type Extension

tu sca ny 19 The Extension Programming Model All components by default are module scoped (i.e. singletons within a composite) Wiring may be done directly as in SCA or through autowire (recommended) Wire by contract: runtime responsible for supplying an implementation of an interface Checks sibiling components, then recurses upward through the component hierarchy. If a sibling is a composite, only services exposed by it may be wired to. Virtually any type of extension can be supplied to the runtime this way

tu sca ny 20 An Example Component public abstract class BindingBuilderExtension implements BindingBuilder { protected BuilderRegistry builderRegistry; protected WireService public void setBuilderRegistry(BuilderRegistry registry) { this.builderRegistry = registry; public void setWireService(WireService wireService) { this.wireService = wireService; = true) public void init() { builderRegistry.register(getBindingType(), this); } //… }

tu sca ny 21 An Example SCDL <composite xmlns=" xmlns:system=" name=”BindingSCDL">

tu sca ny 22 Patterns: Monitor Logging is externalized Do not use commons-logging a.k.a. “clogging”, Log4J, JDK, etc. Instead, decorate a field, setter or constructor param Runtime will provide an implementation of the monitor interface. The implementation will delegate to a logging implementation Avoids memory leaks and allows for better public void setMyMonitor(MyMonitor){ //.. } public void someMethod(){ myMonitor.started(“Stated monitor”); }

tu sca ny 23 Patterns: Registry Often, a registry is used which is a component that other components register with Loaders and Builders register with a LoaderRegistry and BuilderRegistry. The latter dispatch to the right loader or builder when a SCDL or model is being evaluated Eager initialization is used to public void setBuilderRegistry(BuilderRegistry registry) { this.builderRegistry = registry; = true) public void init() { builderRegistry.register(getBindingType(), this); }

tu sca ny 24 Agenda Overview Extension Types Creating a Binding Extension Advanced Tuscany Programming Model Creating a Component Type Extension

tu sca ny 25 Creating an Atomic Component Implementation Type 1.Implement 1..n model POJOs 2.Implement Loader or extend LoaderExtension Reads a StAX stream and creates appropriate model objects 3.Implement AtomicComponent or extend AtomicComponentExtension Extension will be given InboundWires and OutboundWires corresponding to its services and references; it must decide how to inject those onto its implementation instances (e.g. create a proxy) A WireService will be provided to the extension, which it can use to generate proxies and WireInvocationHandlers The extension must implement createTargetInvoker(..) and instantiate TargetInvokers responsible for dispatching to target instances 4.Implement ComponentBuilder or extend ComponentBuilderExtension Implements build(..) which returns the AtomicComponent implementation 5.Write a simple SCDL file and deploy into the system composite hierarchy

tu sca ny 26 Creating a Composite Component Implementation Type 1.Implement 1..n model POJOs 2.Implement Loader or extend LoaderExtension Reads a StAX stream and creates appropriate model objects 3.Implement CompositeComponent or extend CompositeComponentExtension The extension must implement createTargetInvoker(..) and instantiate TargetInvokers responsible for dispatching to target child instances 4.Implement ComponentBuilder or extend ComponentBuilderExtension Implements build(..) which returns the AtomicComponent implementation 5.Write a simple SCDL file and deploy into the system composite hierarchy