Document Sample
slides Powered By Docstoc
					     Design and Development of a

    Context Oriented Language for

    Middleware Based Applications

   A. Sindico, G. Bartolomeo, V. Grassi, S. Salsano
Elettronica S.p.A. & University of Rome “Tor Vergata”

What We’re Talking about?


Contexts and Adaptors

SMILE: A Simple Middleware Independent LayEr

JCOOL & SMILE Working Together


Next Steps


Strong Separation Between
Context Monitoring and
Context Adaptation                BASE SYSTEM

Context Monitoring as a
croscutting concern with                               ADAPTORS
respect to the base system
Context Adaptation as a                     MONITORS

crosscutting concern with
respect to the context monitors
                Context Anatomy

•   Context SimpleContext involve ClassA {

    stateA       :- (ClassA *.attribute==1),
                    (ClassA *.attribute2>2);

    stateB(i)    :- (CalssA i.attribute ==2);

                           parameters forwarding
•   }

    Context               State Transition
    States                     Rules
                Context Composition
                 Event Sequences
•   Context SimpleContext involve ClassA {

    stateA         :- (ClassA *.attribute ==1);
    stateB(i)      :- (CalssA i.attribute ==2);

•   }

•   Context ComplexContext involve ClassB, SimpleContext {

    compositeState :-   (SimpleContext.stateB),
                              (ClassB *.attributeB >1);

    complexState        :-    [(SimpleContext.stateA)+,

•   }

   An Adaptor has as many entry points as the
    context-states it is designed to intercept and handle

   On the transition between two states, a context may trigger the execution of one or more
    Adaptors through the invocation of one of its entry points

   For each entry point two kinds of adaptation can be defined

       one shot activities are pieces of code executed whenever entering in or going out
        from that state
        Typically exploited to perform activities preparatory to the context change

       behavioral variations consist of alternative method definitions that may affect classes
        or even particular instances passed as parameters to the Adaptor
        A behavioral variation is active until the involved context remains in the related state
•   Adaptor SimpleAdaptor {
    SimpleContext.stateB (i) {
      //one shot activities
         in: { System.out.println(“Coming in the
                SimpleContext.stateB context-sate”);
            out: { System.out.println(“Going outthe
                   SimpleContext.stateB context-sate”);
      //behavioural variations
      public void ClassA i.simpleMethod(){
•           System.out.println(“Alternative method
•           }
•   }

SMILE is a “Simple Middleware Independent LayEr”
between the application and the underlying
middleware platform

An application written for SMILE has a functional model which is
totally independent from specific underlying middleware platform

SMILE applications consist in a set of distributed peer processes
running on the same or different middleware platforms

The link between processes and one specific underlying
middleware platform is called “binding”
              Why Using SMILE?

Portability: no need to rewrite the application when the middleware platform

Saving Time: no need to learn a new programming paradigm to deal with
when the middleware platform changes

Rapid Prototyping: it is possible to have a prototyping environment which
can be used to develop and test functional requirements before deploying
them on the work field

Cross Compatibility: a complex, distributed service can be implemented
using component services running not only on different network nodes, but
also on different middleware platforms!

However, many non-functional aspects (timing, security, QoS) may be
different when running on different environments Cope with context is
       Join Points in SMILE

Operations whose semantics is defined by the
specific application

Callbacks managing the application lifecycle

Methods to interact with the service registry

Methods and callbacks for message exchanges and RPC

Interfaces between the applications and the underlying bindings

•   Context MediumReliability involve SMILEPeer {
•      default(instance):-low(instance);
•       low(instance) :- instance.currentBinding.equals(SipBinding);
•       high(instance):- instance.currentBinding.equals(XMPPBinding) &&
•                                                    equals(XMPPBinding.HTTPS));
•   }
•   Adaptor PrivacyAdaptor {
•      MediumReliability.low(instance) {
•               in : {
•                        System.error.println(“WARNING: unsecured medium “);
•               }
•           out : {
•               }
•           public void instance.send(Message msg){
•                  if((msg.requiredPrivacyLevel()==HIGH){
•                       instance.log(“Message privacy level not compliant
                                       with the current medium”);
•                  } else {
•                       proceed();
•                  }
•               }
•       }
•   }

 JCOOL is a Context Oriented programming
  language which manages Context Monitoring
  and Context Adaptations as separated concerns

 This way it is possible to reuse context monitors and adaptors by
  freely combining them into several different patterns thus to
  achieve the desired degree of context awareness

 SMILE applications are an interesting use case for JCOOL. In
  fact, their functional model is independent from the underlying
  middleware; however, using JCOOL, context driven variations
  are introduced in a simple and elegant way
            Next Steps…

 JCOOL is a work in progress! We are
  working on and experimenting many ideas

   Import “facts” in context definition, using Prolog deductions in
    order to deal with inferred context states
               Rule: use French language for GUI whenever in France
                Facts:  we are in Paris
                        Paris is in France
                Deduction:  use French language for GUI

   Take into account conflicts in behavioral variations

   Any idea coming from today’s workshop 