Slide 1 Extending Tuscany Raymond Feng Apache Tuscany committer.

Slides:



Advertisements
Similar presentations
Message Passing Vs Distributed Objects
Advertisements

TSpaces Services Suite: Automating the Development and Management of Web Services Presenter: Kevin McCurley IBM Almaden Research Center Contact: Marcus.
13/04/2015Client-server Programming1 Block 6: Threads 1 Jin Sa.
Web Services Web Services are the basic fundamental building blocks of invoking features that can be accessed by an application program. The accessibility.
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.
Blueprint Advanced Features –Lin Sun –Apache Aries and Geronimo committer and PMC member –OSGi Enterprise Expert Group (EEG) member –Software Engineer.
Copyright © 2001 Qusay H. Mahmoud RMI – Remote Method Invocation Introduction What is RMI? RMI System Architecture How does RMI work? Distributed Garbage.
Tu sca ny 1 Simplifying Service Oriented Applications with The Apache Tuscany project Jeremy Boynes 27 July 2006.
Liang,Introduction to Java Programming,revised by Dai-kaiyu 1 Chapter 10 Object-Oriented Modeling.
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.
INTRODUCING SCA Byungwook Cho Nov.2007.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 12 Object-Oriented.
© 2005 by IBM; made available under the EPL v1.0 | March 1, 2005 Tim deBoer Gorkem Ercan Extend WTP Server Tools for your.
T Network Application Frameworks and XML Web Services and WSDL Sasu Tarkoma Based on slides by Pekka Nikander.
Introducing Axis2 Eran Chinthaka. Agenda  Introduction and Motivation  The “big picture”  Key Features of Axis2 High Performance XML Processing Model.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Understanding the Bean Lifecycle An.
Tuscany 2.x Extensibility and SPIs Raymond Feng. Tuscany Extensibility Cx2x/Tuscany+2.x+Extensibility+and+SPIs#extensions.
Tu sca ny 1 Extending The Tuscany Java SCA Runtime 21 August 2006.
Component frameworks Roy Kensmil. Historical trens in software development. ABSTRACT INTERACTIONS COMPONENT BUS COMPONENT GLUE THIRD-PARTY BINDING.
Spring/2002 Distributed Software Engineering C:\unocourses\4350\slides\DefiningThreads 1 RMI.
Architectural pattern: Interceptor Source: POSA II pp 109 – 140POSA II Environment: developing frameworks that can be extended transparently Recurring.
Tuscany: a SOA framework Jeffrey Guo Accelrys, Inc.
Tu sca ny 1 The Tuscany Java SCA Runtime 20 August 2006.
Grid Services I - Concepts
Tuscany Runtime Architecture. Contents Overview An example Bootstrap kernel Process of composite application.
Cairngorm Microarchitecture. Pronunciation Cairngorm (kârn gôrm) n. yellowish-brown variety of quartz, especially found in Scottish Cairngorm mountain.
Define an interface for creating an object, but let subclasses decide which class to instantiate Factory Method Pattern.
ESO - Garching 23 June – 02 July, 2003 ACS Course Transparent XML De-/Serialization in Java H. Sommer.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Tu sca ny 1 The Tuscany Project in the Apache Incubator and The Service Component Architecture Jeremy Boynes Simon Nash 28 June 2006.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 27 JavaBeans and.
Server-Side Java Mapping Copyright © ZeroC, Inc. Ice Programming with Java 6. Server-Side Java Mapping.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Spring MVC Essentials Getting started.
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.
Chapter 5 Classes and Methods II Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 32 JavaBeans and Bean.
1 G52IWS: Web Services Description Language (WSDL) Chris Greenhalgh
Chapter 7 Classes and Methods III: Static Methods and Variables Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition)
UMBC Distributed Computing with Objects RMI/Corba CMSC 432 Shon Vick.
1 Entity Callbacks and Listeners When you execute EntityManager methods like persist( ), merge( ), remove( ), and find( ), or when you execute EJB QL queries,
DEVELOPING WEB SERVICES WITH JAVA DESIGN WEB SERVICE ENDPOINT.
Net-centric Computing Web Services. Lecture Outline  What is Web Service  Web Service Architecture  Creating and using Java Web Services  Apache Axis.
Chapter 5 Introduction to Defining Classes Fundamentals of Java.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
Apache Tuscany 2.x Domain/Node Raymond Feng
Apache Tuscany 2.x Domain/Node
Chapter 5 Remote Procedure Call
Overall Architecture and Component Model
Chapter 11 Object-Oriented Design
Remote Method Invocation
Java Beans Sagun Dhakhwa.
Delegates and Events 14: Delegates and Events
Tuscany Java SCA Architecture
Processes The most important processes used in Web-based systems and their internal organization.
Building easily and quickly an SCA composite with the SCA Composite Designer Stéphane Drapeau Obeo.
ESIS Consulting LLC (C) ESIS Consulting LLC. All rights reserved
Chapter 40 Remote Method Invocation
Remote method invocation (RMI)
JINI ICS 243F- Distributed Systems Middleware, Spring 2001
Chapter 46 Remote Method Invocation
Introduction to Web Services
Chapter 46 Remote Method Invocation
11.1 Applets & graphics.
Java Remote Method Invocation
Plug-In Architecture Pattern
Presentation transcript:

Slide 1 Extending Tuscany Raymond Feng Apache Tuscany committer

Slide 2 Contents What can be extended? How to add an extension module? How to add an implementation type? How to add a binding type? How to add a interface type (TBD) How to add a data binding type?

Slide 3 What can be extended? The SCA assembly model can be extended with support for new interface types, implementation types. and binding types. Tuscany is architected for extensibilities including:  Implementation types  Binding types  Data binding types  Interface types

Slide 4 Add an extension module The Tuscany runtime allows extension modules to be plugged in. Tuscany core and extension modules can also define extension points where extensions can be added.

Slide 5 Life cycle of an extension module During bootstrapping, the following sequence will happen:  All the module activators will be discovered by the presence of a file named as META-INF/services/org.apache.tuscany.spi.bootstrp.ModuleActivator.  The activator class is instantiated using the no-arg constructor.  ModuleActivator.getExtensionPoints() is invoked for all modules and the extension points contributed by each module are added to the ExtensionRegistry.  ModuleActivator.start(ExtensionRegistry) is invoked for all the modules. The module can then get interested extension points and contribute extensions to them. The contract bwteen the extension and extension point is private to the extension point. The extension point can follow similar patterns such as Registry. If it happens that one extension point has a dependency on another extension point, they can linked at this phase. During shutting down, the stop() method is invoked for all the modules to perform cleanups. A module can choose to unregister the extension from theextension points.

Slide 6 Add an extension module Implement the org.apache.tuscany.core.ModuleActivator interface. The implementation class must have a no-arg constructor. The same instance will be used to invoke all the methods during different phases of the module activation. Create a plain text file named as META- INF/services/org.apache.tuscany.core.ModuleActivator. List the implementation class name of the ModuleActivator in the file. One line per class. Add the module jar to the classpath (or whatever appropriate for the hosting environment).

Slide 7 The responsibilities of implementation and binding providers The Tuscany runtime allows extension modules to be plugged in. Tuscany core and extension modules can also define extension points where extensions can be added.

Slide 8 Implementation Provider It’s contracted by the SPI: org.apache.tuscany.sca.provider.ImplementationProvider It is responsible to create invokers for components implemented by this type It can react to the lifecycle of the components by the start()/stop() callback methods

Slide 9 Reference Binding Provider It’s contracted by the SPI: org.apache.tuscany.sca.provider.ReferenceBindingProvider It is responsible to create invokers for outbound invocations over this binding type. The invoker delegates the call to its binding protocol/transport layer. It can react to the lifecycle of the components by the start()/stop() callback methods

Slide 10 Service Binding Provider It’s contracted by the SPI: org.apache.tuscany.sca.provider.ServiceBindingProvider It is responsible to create binding protocol/transport specific listeners for inbound invocations over this binding type. The listener takes the message from the protocol layer and then dispatch it to the promoted component using the invocation chain. Usually, it will use the start() method to register the listener and use the stop() method to unregister the listener

Slide 11 The runtime wire and invocation chain RB Service Binding Listener Implementation Invoker Reference Binding Invoker Impl SB Binding Protocol The reference binding provider contributes the reference binding invoker The service binding provider contributes the service binding listener The implementation provider contributes the Implementation invoker

Slide 12 Add an implementation type SCA allows you to choose from any one of a wide range of implementation types, such as Java, Scripting, BPEL or C++, where each type represents a specific implementation technology.

Slide 13 Add a new implementation type 1.Define the assembly model extension 2.Define interfaces/classes to represent the model 3.Implement the StAXArtifactProcessor SPI to read/resolve/write the model 4.Implement the ImplementationProvider SPI to add the invocation/lifecycle control logic 5.Implement the ModuleActivator SPI to hook the StAXArtifactProcessor and ImplementationProvider 6.Contribute an extension module

Slide 14 Extend the assembly model The implementation type is referenced by an XML element (implementation.crud) in the composite file The model extension follows the XML inheritance but NO XML schema is required by the runtime <element name="implementation.crud" type="sca:CRUDImplementation" substitutionGroup="sca:implementation" />

Slide 15 Define and process the model The model can be simply written as java interfaces and classes and it typically consists of 4 parts  The CRUDImplementation interface which extends org.apache.tuscany.sca.assembly.Implementation  The CRUDImplementationFactory interface which defines a createImplementation() method  The default implementation of CRUDImplementation  The default implementation of CRUDImplementationFactory Provides an implementation of StAXArtifactProcessor to read/write the model objects from/to XML

Slide 16 Provide the invocation logic The logical model can be associated with ImplementationProvider interface to provide invocation logic for the given component implementation type  CRUDImplementationProvider implements the ImplementationProvider interface  Methods on ImplementationProvider SPI createInterceptor(): Create an interceptor to invoke a component with this implementation type createCallbackInterceptor(): Create a callback interceptor to call back a component with this implementation type

Slide 17 Control the life cycle of components The start()/stop() methods  start(): A method to be invoked when a component with this implementation type is started. (We simply print a message for the CRUD)  stop(): A method to be invoked when a component with this implementation type is stopped. (We simply print a message for the CRUD)

Slide 18 Plug in the implementation type The extension module containing the CRUD implementation type can be plugged into Tuscany as follows:  Implement the ModuleActivator SPI and register the implementation class in META- INF/services/org.apache.tuscany.sca.core.ModuleActivat or  Interact with the ExtensionPointRegistry start(): Register the CRUDImplementationProcessor with StAXArtifactProcessorExtensionPoint and Register the CRUDImplementationProviderFactory with the ProviderFactoryExtensionPoint stop(): Unregister the CRUDImplementationProcessor and the CRUDImplementationProviderFactory

Slide 19 The big picture (class diagram)

Slide 20 Add a binding type References use bindings to describe the access mechanism used to call a service. Services use bindings to describe the access mechanism that clients have to use to call the service.

Slide 21 Add a new binding 1.Define the model extension for reference and service binding 2.Define interfaces/classes to represent the model for the binding 3.Implement the StAXArtifactProcessor to read/resolve/write the models 4.Add the runtime logic by implementing the BindingProviderFactory, ReferenceBindingProvider, ServiceBindingProvider SPIs 5.Implement the ModuleActivator interface to hook up the StAXArtifactProcessor and BindingProviderFactory with respective extension points 6.Contribute an extension module to Tuscany

Slide 22 Extend the assembly model - binding The implementation type is referenced by an XML element (binding.echo) in the composite file The model extension follows the XML inheritance but NO XML schema is required by the runtime <element name=“binding.echo" type="sca:EchoBinding" substitutionGroup="sca:binding" />

Slide 23 Define and process the model The model can be simply written as java interfaces and classes and it typically consists of 4 parts  The EchoBinding interface which extends org.apache.tuscany.sca.assembly.Binding  The EchoBindingFactory interface which defines a createEchoBinding() method  The default implementation of EchoBinding (EchoBindingImpl)  The default implementation of EchoBindingFactory (DefaultEchoBindingFactory) Provides an implementation of StAXArtifactProcessor to read/write the model objects from/to XML  EchoBindingProcessor

Slide 24 Provide the outbound invocation logic The logical model can be associated with ReferenceBindingProvider interface to provide invocation logic for the given binding type  EchoBindingProvider implements the ReferenceBindingProvider interface  Methods on ReferenceBindingProvider SPI createInterceptor(): Create an interceptor to invoke a component with this binding type createCallbackInterceptor(): Create a callback interceptor to call back a component with this binding type getBindingInterfaceContract(): Get the interface contract imposed by the binding protocol layer start(): Lifecycle callback method that can be used by the reference binding to allocate resources or create connections stop(): Lifecycle callback method that can be used by the reference binding to do some house keeping.

Slide 25 Provide the inbound invocation logic The logical model can be assoicated with ServiceBindingProvider interface to provide invocation logic for the given binding type  EchoBindingProvider implements the ServiceBindingProvider interface  Methods on ServiceBindingProvider SPI start(): Start the binding-specific protocol listener to receive incoming messages from the transport layer. The listener will be responsible to dispatch the call to the promoted component. stop(): Stop the binding-specific protocol listener getBindingInterfaceContract(): Get the interface contract imposed by the binding protocol layer

Slide 26 Plug the binding type into Tuscany The extension module containing the ECHO binding type can be plugged into Tuscany as follows:  Implement the ModuleActivator SPI and register the implementation class in META- INF/services/org.apache.tuscany.sca.core.ModuleActivator  Interact with the ExtensionPointRegistry start(): Register the EchoBindingProcessor with StAXArtifactProcessorExtensionPoint and EchoBindingProviderFactory with ProviderFactoryExtensionPoint stop(): Unregister the EchoBindingProcessor/EchoBindingProviderFactory

Slide 27 The big picture (class diagram)

Slide 28 Add a data binding Tuscany provides a data binding framework to allow business data to be represented in the preferred way chosen by the components. New data bindings and transformers can be contributed to Tuscany to facilitate the data transformations.

Slide 29 Add a new databinding The data binding is identified by a string id. A data binding can also have aliases. Adding a databinding can be as simple as just adding a transformer that references the databinding id. For example, if a transformer that transforms data from “db1” to “db2” is added, then “db1” and “db2” is active.

Slide 30 Add a new databinding If the databinding needs to deal with advanced capabilities, such as:  Introspect the data types to recognize data of this binding  Handle operation wrapping/unwrapping  Handle copy of data  Handle exception transformations Then, you need to implement the o.a.t.s.databinding.DataBinding SPI

Slide 31 Add a new transformer A transformer is responsible to transform data from one databinding to another one Adding a transformer to Tuscany will enrich the transformation capabilities as it adds more links to the transformation graph. Provide a transformer is simply to implement the PullTransformer/PushTransformer interface.

Slide 32 Sample Transformer Code public class OMElement2XMLStreamReader extends BaseTransformer implements PullTransformer { public XMLStreamReader transform(OMElement source, TransformationContext context) { return source.getXMLStreamReader(); } public Class getSourceType() { return OMElement.class; } public Class getTargetType() { return XMLStreamReader.class; } public int getWeight() { return 10; }

Slide 33 Register the data binding/transformer The databindings and transformers can be registered against the DataBindingExtensionPoint and TransformerExtensionPoint in the ModuleActivator.start() method. public void start(ExtensionPointRegistry registry) { DataBindingExtensionPoint dataBindings = registry.getExtensionPoint(DataBindingExtensionPoint.class); dataBindings.addDataBinding(new AxiomDataBinding()); TransformerExtensionPoint transformers = registry.getExtensionPoint(TransformerExtensionPoint.class); transformers.addTransformer(new Object2OMElement()); transformers.addTransformer(new OMElement2Object()); transformers.addTransformer(new OMElement2String()); transformers.addTransformer(new OMElement2XMLStreamReader()); transformers.addTransformer(new String2OMElement()); transformers.addTransformer(new XMLStreamReader2OMElement()); }

Slide 34 Plug the binding type into Tuscany The extension module containing the data binding type can be plugged into Tuscany as follows:  Implement the ModuleActivator SPI and register the implementation class in META- INF/services/org.apache.tuscany.sca.core.ModuleActivator  Interact with the ExtensionPointRegistry start(): Register the databinding with DataBindingExtensionPoint and transformers with TransformerExtensionPoint stop(): Unregister the databinding from DataBindingExtensionPoint and transformers from TransformerExtensionPoint

Slide 35 The big picture (class diagram)