SlideShare una empresa de Scribd logo
1 de 30
Descargar para leer sin conexión
Data	
  Binding	
  Unleashed	
  for	
  
 Composite	
  Applica7ons	
  
                Raymond	
  Feng	
  
               Luciano	
  Resende	
  
   Apache	
  Tuscany	
  &	
  Nuvem	
  commi8er	
  	
  
Agenda	
  
•  Introduc7on	
  
   –  Data	
  binding	
  
   –  SCA	
  Composite	
  applica7on	
  
   –  Apache	
  Tuscany	
  project	
  
•  Data	
  bindings	
  in	
  a	
  composite	
  applica7on	
  
•  Tuscany	
  data	
  binding	
  framework	
  
•  Extending	
  Tuscany	
  data	
  binding	
  framework	
  
Introduc7on	
  
Understanding	
  the	
  concepts:	
  Data	
  binding	
  and	
  
         SCA	
  composite	
  applica7on	
  
What’s	
  a	
  data	
  binding?	
  
•  A	
  data	
  binding	
  (in	
  this	
  talk)	
  denotes	
  how	
  business	
  data	
  are	
  
   represented	
  in	
  memory	
  as	
  Java	
  objects.	
  
•  For	
  example,	
  we	
  can	
  represent	
  a	
  customer	
  as:	
  
     –    JavaBean	
  (customer.Customer)	
  
     –    JAXB	
  (customer.Customer)	
                                              JAXB	
  
     –    SDO	
  (DataObject	
  or	
  customer.Customer)	
  
     –    StAX	
  XMLStreamReader	
                      JavaBean	
  
                                                                              Customer	
  
     –    DOM	
  Node	
  (org.w3c.dom.Node)	
                              Id	
  
                                                                                                   DOM	
  

     –    XML	
  String/byte[]/InputStream	
                               lastName	
  
                                                                           firstName	
  
     –    JSON	
  String/byte[]/InputStream	
                                     …	
  
     –    org.json.JSONObject	
                       InputStream	
                             JSON	
  
     –    …	
  
•  The	
  same	
  informa7on	
  with	
  different	
  representa7ons	
  
SCA	
  composite	
  applica7on	
  
•  SCA	
  (Service	
  Component	
  Architecture,	
  being	
  standardized	
  at	
  
   OASIS)	
  
    –  Composite	
  (a	
  collec7on	
  of	
  collabora7ng	
  components)	
  
         •  Component	
  (encapsula7on	
  of	
  reusable	
  business	
  logic)	
  
               –  Implementa7on	
  (the	
  code/script)	
  
               –  Service	
  (the	
  func7on	
  it	
  provides)	
  
                     »  Interface	
  
                     »  Binding	
  (how	
  is	
  the	
  service	
  exposed)	
  
               –  Reference	
  (the	
  func7on	
  it	
  consumes)	
  
                     »  Interface	
  
                     »  Binding	
  (how	
  is	
  the	
  service	
  accessed)	
  
What	
  is	
  Apache	
  Tuscany?	
  
•  Apache	
  Tuscany	
  (hp://tuscany.apache.org)	
  implements	
  Service	
  
   Component	
  Architecture	
  (SCA)	
  standard.	
  With	
  SCA	
  as	
  it's	
  founda7on,	
  
   Tuscany	
  offers	
  solu7on	
  developers	
  the	
  following	
  advantages:	
  	
  
    –  Provides	
  a	
  model	
  for	
  crea7ng	
  composite	
  applica7ons	
  by	
  defining	
  the	
  
       services	
  in	
  the	
  fabric	
  and	
  their	
  rela7onships	
  with	
  one	
  another.	
  The	
  
       services	
  can	
  be	
  implemented	
  in	
  any	
  technology.	
  
    –  Enables	
  service	
  developers	
  to	
  create	
  reusable	
  services	
  that	
  only	
  
       contain	
  business	
  logic.	
  Protocols	
  are	
  pushed	
  out	
  of	
  business	
  logic	
  and	
  
       are	
  handled	
  through	
  pluggable	
  bindings.	
  This	
  lowers	
  development	
  
       cost.	
  
    –  Applica7ons	
  can	
  easily	
  adapt	
  to	
  infrastructure	
  changes	
  without	
  
       recoding	
  since	
  protocols	
  are	
  handled	
  via	
  pluggable	
  bindings	
  and	
  
       quality	
  of	
  services	
  (transac7on,	
  security)	
  are	
  handled	
  declara7vely.	
  
    –  Exis7ng	
  applica7ons	
  can	
  work	
  with	
  new	
  SCA	
  composi7ons.	
  This	
  allows	
  
       for	
  incremental	
  growth	
  towards	
  a	
  more	
  flexible	
  architecture,	
  
       outsourcing	
  or	
  providing	
  services	
  to	
  others.	
  
Data	
  bindings	
  in	
  a	
  composite	
  
              applica7on	
  
Modeling,	
  represen7ng	
  and	
  flowing	
  data	
  
  across	
  components	
  and	
  protocols	
  
A	
  simple	
  scenario	
  
•  Two	
  SCA	
  components:	
  Payment	
  and	
  CreditCardPayment	
  
   (Payment	
  calls	
  CreditCardPayment	
  to	
  authorize	
  credit	
  card	
  
   charges)	
  
•  Two	
  developers:	
  Bob	
  and	
  Mary	
  
•  Payment	
  communicates	
  with	
  CreditCardPayment	
  using	
  SOAP/
   HTTP	
  web	
  service	
  
•  The	
  Payment	
  component	
  will	
  be	
  exposed	
  as	
  a	
  JSON-­‐RPC	
  
   service	
  
The	
  SCA	
  composite	
  file	
  
<composite	
  xmlns=“hp://docs.oasis-­‐open.org/ns/opencsa/sca/200912”	
  
                                       	
  xmlns:tuscany="hp://tuscany.apache.org/xmlns/sca/1.1"	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  targetNamespace="hp://tuscanyscatours.com/"	
  name=”Store”>	
  

	
  	
  	
  	
  <component	
  name="Payment">	
  
	
  	
  	
  	
  	
  	
  	
  	
  <implementa7on.java	
  class="com.tuscanyscatours.payment.impl.PaymentImpl"	
  />	
  
	
  	
  	
  	
  	
  	
  	
  	
  <service	
  name="Payment">	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <tuscany:binding.jsonrpc	
  uri="hp://localhost:8080/Payment"	
  />	
  
	
  	
  	
  	
  	
  	
  	
  </service>	
  
                                       	
  <reference	
  name="creditCardPayment">	
  
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  <binding.ws	
  uri="hp://localhost:8080/CreditCardPayment"	
  />	
  
	
  	
  	
  	
  	
  	
  	
  	
  </reference>	
  
</component>	
  

	
  	
  	
  	
  <component	
  name="CreditCardPayment">	
  
	
  	
  	
  	
  	
  	
  	
  	
  <implementa7on.java	
  class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl"	
  />	
  
	
  	
  	
  	
  	
  	
  	
  	
  <service	
  name="CreditCardPayment">	
  
                                 	
  <binding.ws	
  uri="hp://localhost:8080/CreditCardPayment"	
  />	
  
	
  	
  	
  	
  	
  	
  	
  </service>	
  
	
  	
  	
  	
  </component>	
  

</composite>	
  
Interface	
  and	
  data	
  modeling	
  
•  Bob	
  and	
  Mary	
  first	
  agree	
  on	
  what	
  data	
  needs	
  to	
  
   be	
  exchanged	
  between	
  the	
  two	
  components	
  
•  The	
  agreement	
  is	
  then	
  described	
  as	
  an	
  interface	
  
   (which	
  in	
  turn	
  references	
  the	
  data	
  types)	
  
    –  The	
  interface	
  becomes	
  the	
  key	
  contract	
  between	
  the	
  
       SCA	
  reference	
  and	
  service	
  that	
  are	
  wired	
  together	
  
    –  The	
  interfaces	
  can	
  be	
  described	
  using	
  different	
  IDLs	
  
       such	
  as	
  WSDL	
  (w/	
  XSD)	
  or	
  Java	
  interface	
  
    –  Interface	
  compa7bility	
  	
  
•  Things	
  to	
  consider:	
  efficiency,	
  simplicity,	
  
   remotablity	
  and	
  interoperability.	
  
Sample	
  interfaces	
  
JAX-­‐WS	
  w/	
  JAXB	
  (annota7ons	
  omied…):	
  

public	
  interface	
  CreditCardPayment	
  {	
  
      	
  String	
  authorize(JAXBCreditCardDetailsType	
  creditCard,	
  	
  float	
  amount);	
  
}	
  

SDO:	
  

public	
  interface	
  CreditCardPayment	
  {	
  
      	
  String	
  authorize(SDOCreditCardDetailsType	
  creditCard,	
  	
  float	
  amount);	
  
}	
  
How	
  are	
  data	
  represented	
  in	
  a	
  
          composite	
  applica7on?	
  
•  Component	
  implementa7ons	
  
    –  Business	
  logic	
  needs	
  to	
  consume/produce	
  data	
  in	
  a	
  
       representa7on	
  it	
  supports	
  
        •  Handling	
  incoming	
  service	
  calls	
  
        •  Calling	
  other	
  services	
  
        •  Receiving	
  property	
  values	
  
    –  Certain	
  implementa7on	
  containers	
  impose	
  the	
  data	
  
       representa7ons	
  (such	
  as	
  DOM	
  for	
  Apache	
  ODE	
  BPEL)	
  
•  Protocol	
  stacks	
  behind	
  the	
  bindings	
  
    –  Protocol	
  stacks	
  need	
  to	
  marshal/unmarshal	
  data	
  
        •  Internal	
  data	
  representa7on	
  	
  
        •  Wire	
  format	
  (XML,	
  JSON,	
  binary,	
  etc)	
  
Data	
  representa7ons	
  between	
  two	
  
        components	
  at	
  run7me	
  
The	
  reality	
  check	
  
•  Enforcing	
  one	
  data	
  binding	
  is	
  not	
  flexible	
  or	
  even	
  not	
  feasible	
  
     –  Components	
  can	
  be	
  implemented	
  using	
  different	
  technologies	
  which	
  could	
  
        impose	
  the	
  data	
  binding	
  requirements,	
  for	
  example,	
  a	
  BEPL	
  engine	
  may	
  
        require	
  DOM	
  
     –  Components	
  may	
  choose	
  to	
  use	
  different	
  data	
  bindings	
  to	
  represent	
  the	
  
        business	
  data	
  (input/output/fault),	
  for	
  example,	
  JAXB	
  vs.	
  SDO	
  for	
  the	
  XML	
  
        manipula7ons.	
  	
  
•  Service	
  providers	
  or	
  consumers	
  are	
  decoupled	
  and	
  it	
  is	
  
   impossible	
  to	
  have	
  a	
  fixed	
  data	
  binding	
  
     –  A	
  service	
  can	
  serve	
  different	
  consumers	
  that	
  can	
  only	
  handle	
  certain	
  data	
  
        bindings	
  na7vely	
  
     –  The	
  service	
  providers	
  for	
  a	
  given	
  consumer	
  can	
  be	
  replaced	
  
•  The	
  same	
  service	
  can	
  be	
  accessed	
  over	
  different	
  protocols	
  
   with	
  different	
  data	
  bindings	
  
Data	
  transforma7on	
  
•  Data	
  transforma7ons	
  are	
  required	
  to	
  get	
  two	
  
   components	
  talk	
  to	
  each	
  other	
  
•  Having	
  applica7on	
  code	
  to	
  deal	
  with	
  technological	
  
   data	
  transforma7on	
  is	
  a	
  nightmare	
  and	
  it	
  will	
  defeat	
  
   the	
  whole	
  purpose	
  and	
  promise	
  of	
  SCA	
  
Tuscany’s	
  data	
  binding	
  framework	
  
Introspect/transform	
  data	
  without	
  applica7on	
  
                   coding	
  	
  
What	
  does	
  the	
  framework	
  need	
  to	
  
                    figure	
  out?	
  
•  Understand	
  the	
  data	
  binding	
  requirements	
  at	
  
   different	
  places	
  for	
  the	
  data	
  flow	
  
•  Transform	
  the	
  data	
  from	
  one	
  data	
  binding	
  to	
  
   the	
  other	
  transparently	
  without	
  the	
  
   interven7ons	
  from	
  the	
  applica7on	
  developers	
  
•  Separate	
  the	
  data	
  transforma7on/marshaling/
   unmarshaling	
  from	
  the	
  business	
  logic	
  
Data	
  type	
  introspec7on	
  
•  Marker	
  interface	
  
   –  commonj.sdo.DataObject,	
  org.w3c.dom.Node	
  
•  Annota7ons	
  
   –  JAXB	
  annota7ons	
  
•  What	
  informa7on	
  is	
  captured?	
  
   –  Java	
  class	
  
   –  Java	
  generic	
  type	
  
   –  Logic	
  type	
  (XML	
  element/type,	
  Mime	
  types,	
  etc)	
  
The	
  magic	
  behind	
  the	
  scenes	
  
Transforma7on	
  paths	
  
•  Types	
  of	
  transforma7ons	
  
    –  Unmarshal/Deserialize	
  (	
  InputStream	
  	
  Object	
  )	
  
    –  Marshal/Serialize	
  (	
  Object	
  	
  OutputStream	
  )	
  
    –  Convert/Transform	
  (	
  Object	
  	
  Object)	
  
•  Direct	
  vs.	
  Mul7-­‐hops	
  
    –  JAXB	
  	
  DOM	
  
    –  JAXB	
  	
  DOM	
  	
  SDO	
  
    –  Weight	
  of	
  a	
  transforma7on	
  
•  Private	
  vs.	
  Public	
  
    –  Some	
  data	
  bindings	
  are	
  not	
  good	
  as	
  intermediaries	
  
       (data	
  round-­‐trip	
  issues)	
  
The	
  complete	
  data	
  flow	
  
•  Customer	
  data	
  come	
  in	
  JSON	
  from	
  HTTP	
  requests	
  
•  The	
  JSON	
  data	
  is	
  unmarshaled	
  into	
  JAXB	
  for	
  the	
  Payment	
  code	
  
   to	
  consume	
  
•  Payment	
  passes	
  CreditCard	
  (JAXB)	
  to	
  the	
  reference	
  binding	
  
   layer	
  which	
  in	
  turn	
  converts	
  JAXB	
  into	
  AXIOM	
  
•  The	
  service	
  binding	
  layer	
  unmarshals	
  the	
  XML	
  data	
  into	
  
   AXIOM	
  and	
  transform	
  it	
  into	
  SDO	
  for	
  the	
  CreditCardPayment	
  
•  The	
  response	
  path	
  is	
  reverse	
  for	
  the	
  data	
  transforma7ons	
  
Data	
  bindings	
  out	
  of	
  the	
  box	
  
•    DOM	
  
•    JAXB	
  (JavaBeans	
  are	
  treated	
  as	
  JAXB)	
  
•    SDO	
  
•    JSON	
  
•    StAX	
  
•    …	
  
Data	
  bindings	
  for	
  RESTful	
  services	
  
   Integra7ng	
  with	
  JAX-­‐RS	
  en7ty	
  providers	
  
JAX-­‐RS	
  en7ty	
  providers	
  
•  En7ty	
  providers	
  supply	
  mapping	
  services	
  
   between	
  representa7ons	
  and	
  their	
  associated	
  
   Java	
  types.	
  	
  
•  En7ty	
  providers	
  come	
  in	
  two	
  flavors:	
  	
  
   –  MessageBodyReader	
  
   –  MessageBodyWriter	
  
Tuscany’s	
  generic	
  en7ty	
  providers	
  
based	
  on	
  the	
  data	
  binding	
  framework	
  	
  
                                                                   Tuscany	
  data	
  binding	
  framework	
  
             JAX-­‐RS	
  run7me	
  
         (such	
  as	
  Apache	
  Wink)	
  


                En7ty	
  Providers	
  
                  En7ty	
  Providers	
  



             Message	
                                                        Message	
  
             Reader	
                                                          Writer	
  
                                                 En7ty	
  
                                              (JAXB,	
  SDO,	
  
                                               DOM,	
  etc)	
  
     InputStream	
                                                                OutputStream	
  
Extending	
  the	
  data	
  binding	
  
       framework	
  
Support	
  your	
  favorite	
  data	
  bindings	
  	
  
The	
  DataBinding	
  SPI	
  
public	
  interface	
  DataBinding	
  {	
  
String	
  getName();	
  

boolean	
  introspect(DataType	
  dataType,	
  Opera:on	
  opera:on);	
  

DataType	
  introspect(Object	
  value,	
  Opera7on	
  opera7on);	
  

WrapperHandler	
  getWrapperHandler();	
  

Object	
  copy(Object	
  object,	
  DataType	
  sourceDataType,	
  DataType	
  targetDataType,	
  
   Opera7on	
  sourceOpera7on,	
  Opera7on	
  targetOpera7on);	
  

XMLTypeHelper	
  getXMLTypeHelper();	
  

}	
  
The	
  Transformer	
  SPI	
  
public	
  interface	
  PullTransformer<S,	
  R>	
  extends	
  
      Transformer	
  {	
  
R	
  transform(S	
  source,	
  Transforma7onContext	
  context);	
  
}	
  

public	
  interface	
  PushTransformer<S,	
  R>	
  extends	
  
      Transformer	
  {	
  
void	
  transform(S	
  source,	
  R	
  sink,	
  Transforma:onContext	
  
      context);	
  
}	
  
Registering	
  your	
  data	
  bindings/
               transformers	
  
•  META-­‐INF/services/
   org.apache.tuscany.sca.databinding.DataBinding	
  
   org.apache.tuscany.sca.databinding.xml.DOMDataBinding;name=org.w3c
      .dom.Node	
  
•  META-­‐INF/services/
   org.apache.tuscany.sca.databinding.PullTransformer	
  
   org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader;source=org.w3
      c.dom.Node,target=javax.xml.stream.XMLStreamReader,weight=80	
  
•  META-­‐INF/services/
   org.apache.tuscany.sca.databinding.PushTransformer	
  
   org.apache.tuscany.sca.databinding.xml.Node2OutputStream;source=org
      .w3c.dom.Node,target=java.io.OutputStream,weight=80	
  
Q&A	
  
                 Find	
  more	
  details	
  from:	
  

        Chapter	
  9	
  of	
  Tuscany	
  In	
  SCA	
  Ac7on	
  
         hp://www.manning.com/laws/	
  

               Save	
  40%	
  at	
  manning.com.	
  
Enter	
  “javaone2010”	
  in	
  the	
  promo7onal	
  code	
  box	
  at	
  
                         check	
  out.	
  

Más contenido relacionado

La actualidad más candente

Java Web services
Java Web servicesJava Web services
Java Web services
Sujit Kumar
 
Utilized Code Gen To Save Our Efforts In Sap Integration
Utilized Code Gen To Save Our Efforts In Sap IntegrationUtilized Code Gen To Save Our Efforts In Sap Integration
Utilized Code Gen To Save Our Efforts In Sap Integration
Guo Albert
 
Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)
Paulo Gandra de Sousa
 
Artefactos biz talk 2006
Artefactos biz talk 2006Artefactos biz talk 2006
Artefactos biz talk 2006
Sandro Pereira
 
IBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons LearnedIBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons Learned
Ted Leung
 

La actualidad más candente (19)

JDBC : Java Database Connectivity
JDBC : Java Database Connectivity JDBC : Java Database Connectivity
JDBC : Java Database Connectivity
 
Service Oriented Architecture -Unit II - Modeling databases in xml
Service Oriented Architecture -Unit II - Modeling databases in xml Service Oriented Architecture -Unit II - Modeling databases in xml
Service Oriented Architecture -Unit II - Modeling databases in xml
 
Java Web services
Java Web servicesJava Web services
Java Web services
 
Xml schema
Xml schemaXml schema
Xml schema
 
Java web services using JAX-WS
Java web services using JAX-WSJava web services using JAX-WS
Java web services using JAX-WS
 
Utilized Code Gen To Save Our Efforts In Sap Integration
Utilized Code Gen To Save Our Efforts In Sap IntegrationUtilized Code Gen To Save Our Efforts In Sap Integration
Utilized Code Gen To Save Our Efforts In Sap Integration
 
WSMO-Lite
WSMO-LiteWSMO-Lite
WSMO-Lite
 
Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)Patterns of Enterprise Application Architecture (by example)
Patterns of Enterprise Application Architecture (by example)
 
Artefactos biz talk 2006
Artefactos biz talk 2006Artefactos biz talk 2006
Artefactos biz talk 2006
 
Efficient retrieval of web services using prioritization and clustering
Efficient retrieval of web services using prioritization and clusteringEfficient retrieval of web services using prioritization and clustering
Efficient retrieval of web services using prioritization and clustering
 
Web Services
Web ServicesWeb Services
Web Services
 
Web service
Web serviceWeb service
Web service
 
Bdc Screens
Bdc ScreensBdc Screens
Bdc Screens
 
Ado
AdoAdo
Ado
 
Change RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDBChange RelationalDB to GraphDB with OrientDB
Change RelationalDB to GraphDB with OrientDB
 
The Story of How an Oracle Classic Stronghold successfully embraced SOA
The Story of How an Oracle Classic Stronghold successfully embraced SOAThe Story of How an Oracle Classic Stronghold successfully embraced SOA
The Story of How an Oracle Classic Stronghold successfully embraced SOA
 
IBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons LearnedIBM Solutions '99 XML and Java: Lessons Learned
IBM Solutions '99 XML and Java: Lessons Learned
 
Web services tutorial
Web services tutorialWeb services tutorial
Web services tutorial
 
RESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services FrameworkRESTful Data Services with the ADO.NET Data Services Framework
RESTful Data Services with the ADO.NET Data Services Framework
 

Similar a Data Binding Unleashed for Composite Applications

The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
Lucas Jellema
 

Similar a Data Binding Unleashed for Composite Applications (20)

The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
The Story of How an Oracle Classic Stronghold successfully embraced SOA (ODTU...
 
A sane approach to microservices
A sane approach to microservicesA sane approach to microservices
A sane approach to microservices
 
N - Tier Applications, Enterprise Java Beans, Component technologies
N - Tier Applications, Enterprise Java Beans, Component technologiesN - Tier Applications, Enterprise Java Beans, Component technologies
N - Tier Applications, Enterprise Java Beans, Component technologies
 
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
S314011 - Developing Composite Applications for the Cloud with Apache TuscanyS314011 - Developing Composite Applications for the Cloud with Apache Tuscany
S314011 - Developing Composite Applications for the Cloud with Apache Tuscany
 
Modern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas JellemaModern Database Development Oow2008 Lucas Jellema
Modern Database Development Oow2008 Lucas Jellema
 
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database ProfessionalsIntroducing SOA and Oracle SOA Suite 11g for Database Professionals
Introducing SOA and Oracle SOA Suite 11g for Database Professionals
 
Adding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSASAdding Data into your SOA with WSO2 WSAS
Adding Data into your SOA with WSO2 WSAS
 
Web Services Foundation Technologies
Web Services Foundation TechnologiesWeb Services Foundation Technologies
Web Services Foundation Technologies
 
SOA for PL/SQL Developer (OPP 2010)
SOA for PL/SQL Developer (OPP 2010)SOA for PL/SQL Developer (OPP 2010)
SOA for PL/SQL Developer (OPP 2010)
 
Building apps with tuscany
Building apps with tuscanyBuilding apps with tuscany
Building apps with tuscany
 
Serious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST InterfaceSerious Sencha - Data Layer and Server-Side REST Interface
Serious Sencha - Data Layer and Server-Side REST Interface
 
Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)Camunda BPM 7.2: Performance and Scalability (English)
Camunda BPM 7.2: Performance and Scalability (English)
 
Overview of atg framework
Overview of atg frameworkOverview of atg framework
Overview of atg framework
 
Web services SOAP Notes
Web services SOAP NotesWeb services SOAP Notes
Web services SOAP Notes
 
Dojo - from web page to web apps
Dojo - from web page to web appsDojo - from web page to web apps
Dojo - from web page to web apps
 
L19 Application Architecture
L19 Application ArchitectureL19 Application Architecture
L19 Application Architecture
 
Web service architecture
Web service architectureWeb service architecture
Web service architecture
 
Cloud economics design, capacity and operational concerns
Cloud economics  design, capacity and operational concernsCloud economics  design, capacity and operational concerns
Cloud economics design, capacity and operational concerns
 
Ntg web services
Ntg   web servicesNtg   web services
Ntg web services
 
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS MiddlewareOracle OpenWorld 2014 Review Part Four - PaaS Middleware
Oracle OpenWorld 2014 Review Part Four - PaaS Middleware
 

Más de Raymond Feng

OSGi Remote Services With SCA using Apache Tuscany
OSGi Remote Services With SCA using Apache TuscanyOSGi Remote Services With SCA using Apache Tuscany
OSGi Remote Services With SCA using Apache Tuscany
Raymond Feng
 

Más de Raymond Feng (7)

Working with LoopBack Models
Working with LoopBack ModelsWorking with LoopBack Models
Working with LoopBack Models
 
Building a Node.js API backend with LoopBack in 5 Minutes
Building a Node.js API backend with LoopBack in 5 MinutesBuilding a Node.js API backend with LoopBack in 5 Minutes
Building a Node.js API backend with LoopBack in 5 Minutes
 
Building Flexible APIs for Web 2.x/Cloud Applications (JavaOne 2011 Session ...
Building Flexible APIs for Web 2.x/Cloud Applications (JavaOne 2011 Session ...Building Flexible APIs for Web 2.x/Cloud Applications (JavaOne 2011 Session ...
Building Flexible APIs for Web 2.x/Cloud Applications (JavaOne 2011 Session ...
 
RESTful SCA with Apache Tuscany
RESTful SCA with Apache TuscanyRESTful SCA with Apache Tuscany
RESTful SCA with Apache Tuscany
 
Apache Tuscany 2.x Extensibility And SPIs
Apache Tuscany 2.x Extensibility And SPIsApache Tuscany 2.x Extensibility And SPIs
Apache Tuscany 2.x Extensibility And SPIs
 
OSGi Enablement For Apache Tuscany
OSGi Enablement For Apache TuscanyOSGi Enablement For Apache Tuscany
OSGi Enablement For Apache Tuscany
 
OSGi Remote Services With SCA using Apache Tuscany
OSGi Remote Services With SCA using Apache TuscanyOSGi Remote Services With SCA using Apache Tuscany
OSGi Remote Services With SCA using Apache Tuscany
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 

Data Binding Unleashed for Composite Applications

  • 1. Data  Binding  Unleashed  for   Composite  Applica7ons   Raymond  Feng   Luciano  Resende   Apache  Tuscany  &  Nuvem  commi8er    
  • 2. Agenda   •  Introduc7on   –  Data  binding   –  SCA  Composite  applica7on   –  Apache  Tuscany  project   •  Data  bindings  in  a  composite  applica7on   •  Tuscany  data  binding  framework   •  Extending  Tuscany  data  binding  framework  
  • 3. Introduc7on   Understanding  the  concepts:  Data  binding  and   SCA  composite  applica7on  
  • 4. What’s  a  data  binding?   •  A  data  binding  (in  this  talk)  denotes  how  business  data  are   represented  in  memory  as  Java  objects.   •  For  example,  we  can  represent  a  customer  as:   –  JavaBean  (customer.Customer)   –  JAXB  (customer.Customer)   JAXB   –  SDO  (DataObject  or  customer.Customer)   –  StAX  XMLStreamReader   JavaBean   Customer   –  DOM  Node  (org.w3c.dom.Node)   Id   DOM   –  XML  String/byte[]/InputStream   lastName   firstName   –  JSON  String/byte[]/InputStream   …   –  org.json.JSONObject   InputStream   JSON   –  …   •  The  same  informa7on  with  different  representa7ons  
  • 5. SCA  composite  applica7on   •  SCA  (Service  Component  Architecture,  being  standardized  at   OASIS)   –  Composite  (a  collec7on  of  collabora7ng  components)   •  Component  (encapsula7on  of  reusable  business  logic)   –  Implementa7on  (the  code/script)   –  Service  (the  func7on  it  provides)   »  Interface   »  Binding  (how  is  the  service  exposed)   –  Reference  (the  func7on  it  consumes)   »  Interface   »  Binding  (how  is  the  service  accessed)  
  • 6. What  is  Apache  Tuscany?   •  Apache  Tuscany  (hp://tuscany.apache.org)  implements  Service   Component  Architecture  (SCA)  standard.  With  SCA  as  it's  founda7on,   Tuscany  offers  solu7on  developers  the  following  advantages:     –  Provides  a  model  for  crea7ng  composite  applica7ons  by  defining  the   services  in  the  fabric  and  their  rela7onships  with  one  another.  The   services  can  be  implemented  in  any  technology.   –  Enables  service  developers  to  create  reusable  services  that  only   contain  business  logic.  Protocols  are  pushed  out  of  business  logic  and   are  handled  through  pluggable  bindings.  This  lowers  development   cost.   –  Applica7ons  can  easily  adapt  to  infrastructure  changes  without   recoding  since  protocols  are  handled  via  pluggable  bindings  and   quality  of  services  (transac7on,  security)  are  handled  declara7vely.   –  Exis7ng  applica7ons  can  work  with  new  SCA  composi7ons.  This  allows   for  incremental  growth  towards  a  more  flexible  architecture,   outsourcing  or  providing  services  to  others.  
  • 7. Data  bindings  in  a  composite   applica7on   Modeling,  represen7ng  and  flowing  data   across  components  and  protocols  
  • 8. A  simple  scenario   •  Two  SCA  components:  Payment  and  CreditCardPayment   (Payment  calls  CreditCardPayment  to  authorize  credit  card   charges)   •  Two  developers:  Bob  and  Mary   •  Payment  communicates  with  CreditCardPayment  using  SOAP/ HTTP  web  service   •  The  Payment  component  will  be  exposed  as  a  JSON-­‐RPC   service  
  • 9. The  SCA  composite  file   <composite  xmlns=“hp://docs.oasis-­‐open.org/ns/opencsa/sca/200912”    xmlns:tuscany="hp://tuscany.apache.org/xmlns/sca/1.1"                        targetNamespace="hp://tuscanyscatours.com/"  name=”Store”>          <component  name="Payment">                  <implementa7on.java  class="com.tuscanyscatours.payment.impl.PaymentImpl"  />                  <service  name="Payment">                          <tuscany:binding.jsonrpc  uri="hp://localhost:8080/Payment"  />                </service>    <reference  name="creditCardPayment">                          <binding.ws  uri="hp://localhost:8080/CreditCardPayment"  />                  </reference>   </component>          <component  name="CreditCardPayment">                  <implementa7on.java  class="com.tuscanyscatours.payment.creditcard.impl.CreditCardPaymentImpl"  />                  <service  name="CreditCardPayment">    <binding.ws  uri="hp://localhost:8080/CreditCardPayment"  />                </service>          </component>   </composite>  
  • 10. Interface  and  data  modeling   •  Bob  and  Mary  first  agree  on  what  data  needs  to   be  exchanged  between  the  two  components   •  The  agreement  is  then  described  as  an  interface   (which  in  turn  references  the  data  types)   –  The  interface  becomes  the  key  contract  between  the   SCA  reference  and  service  that  are  wired  together   –  The  interfaces  can  be  described  using  different  IDLs   such  as  WSDL  (w/  XSD)  or  Java  interface   –  Interface  compa7bility     •  Things  to  consider:  efficiency,  simplicity,   remotablity  and  interoperability.  
  • 11. Sample  interfaces   JAX-­‐WS  w/  JAXB  (annota7ons  omied…):   public  interface  CreditCardPayment  {    String  authorize(JAXBCreditCardDetailsType  creditCard,    float  amount);   }   SDO:   public  interface  CreditCardPayment  {    String  authorize(SDOCreditCardDetailsType  creditCard,    float  amount);   }  
  • 12. How  are  data  represented  in  a   composite  applica7on?   •  Component  implementa7ons   –  Business  logic  needs  to  consume/produce  data  in  a   representa7on  it  supports   •  Handling  incoming  service  calls   •  Calling  other  services   •  Receiving  property  values   –  Certain  implementa7on  containers  impose  the  data   representa7ons  (such  as  DOM  for  Apache  ODE  BPEL)   •  Protocol  stacks  behind  the  bindings   –  Protocol  stacks  need  to  marshal/unmarshal  data   •  Internal  data  representa7on     •  Wire  format  (XML,  JSON,  binary,  etc)  
  • 13. Data  representa7ons  between  two   components  at  run7me  
  • 14. The  reality  check   •  Enforcing  one  data  binding  is  not  flexible  or  even  not  feasible   –  Components  can  be  implemented  using  different  technologies  which  could   impose  the  data  binding  requirements,  for  example,  a  BEPL  engine  may   require  DOM   –  Components  may  choose  to  use  different  data  bindings  to  represent  the   business  data  (input/output/fault),  for  example,  JAXB  vs.  SDO  for  the  XML   manipula7ons.     •  Service  providers  or  consumers  are  decoupled  and  it  is   impossible  to  have  a  fixed  data  binding   –  A  service  can  serve  different  consumers  that  can  only  handle  certain  data   bindings  na7vely   –  The  service  providers  for  a  given  consumer  can  be  replaced   •  The  same  service  can  be  accessed  over  different  protocols   with  different  data  bindings  
  • 15. Data  transforma7on   •  Data  transforma7ons  are  required  to  get  two   components  talk  to  each  other   •  Having  applica7on  code  to  deal  with  technological   data  transforma7on  is  a  nightmare  and  it  will  defeat   the  whole  purpose  and  promise  of  SCA  
  • 16. Tuscany’s  data  binding  framework   Introspect/transform  data  without  applica7on   coding    
  • 17. What  does  the  framework  need  to   figure  out?   •  Understand  the  data  binding  requirements  at   different  places  for  the  data  flow   •  Transform  the  data  from  one  data  binding  to   the  other  transparently  without  the   interven7ons  from  the  applica7on  developers   •  Separate  the  data  transforma7on/marshaling/ unmarshaling  from  the  business  logic  
  • 18. Data  type  introspec7on   •  Marker  interface   –  commonj.sdo.DataObject,  org.w3c.dom.Node   •  Annota7ons   –  JAXB  annota7ons   •  What  informa7on  is  captured?   –  Java  class   –  Java  generic  type   –  Logic  type  (XML  element/type,  Mime  types,  etc)  
  • 19. The  magic  behind  the  scenes  
  • 20. Transforma7on  paths   •  Types  of  transforma7ons   –  Unmarshal/Deserialize  (  InputStream    Object  )   –  Marshal/Serialize  (  Object    OutputStream  )   –  Convert/Transform  (  Object    Object)   •  Direct  vs.  Mul7-­‐hops   –  JAXB    DOM   –  JAXB    DOM    SDO   –  Weight  of  a  transforma7on   •  Private  vs.  Public   –  Some  data  bindings  are  not  good  as  intermediaries   (data  round-­‐trip  issues)  
  • 21. The  complete  data  flow   •  Customer  data  come  in  JSON  from  HTTP  requests   •  The  JSON  data  is  unmarshaled  into  JAXB  for  the  Payment  code   to  consume   •  Payment  passes  CreditCard  (JAXB)  to  the  reference  binding   layer  which  in  turn  converts  JAXB  into  AXIOM   •  The  service  binding  layer  unmarshals  the  XML  data  into   AXIOM  and  transform  it  into  SDO  for  the  CreditCardPayment   •  The  response  path  is  reverse  for  the  data  transforma7ons  
  • 22. Data  bindings  out  of  the  box   •  DOM   •  JAXB  (JavaBeans  are  treated  as  JAXB)   •  SDO   •  JSON   •  StAX   •  …  
  • 23. Data  bindings  for  RESTful  services   Integra7ng  with  JAX-­‐RS  en7ty  providers  
  • 24. JAX-­‐RS  en7ty  providers   •  En7ty  providers  supply  mapping  services   between  representa7ons  and  their  associated   Java  types.     •  En7ty  providers  come  in  two  flavors:     –  MessageBodyReader   –  MessageBodyWriter  
  • 25. Tuscany’s  generic  en7ty  providers   based  on  the  data  binding  framework     Tuscany  data  binding  framework   JAX-­‐RS  run7me   (such  as  Apache  Wink)   En7ty  Providers   En7ty  Providers   Message   Message   Reader   Writer   En7ty   (JAXB,  SDO,   DOM,  etc)   InputStream   OutputStream  
  • 26. Extending  the  data  binding   framework   Support  your  favorite  data  bindings    
  • 27. The  DataBinding  SPI   public  interface  DataBinding  {   String  getName();   boolean  introspect(DataType  dataType,  Opera:on  opera:on);   DataType  introspect(Object  value,  Opera7on  opera7on);   WrapperHandler  getWrapperHandler();   Object  copy(Object  object,  DataType  sourceDataType,  DataType  targetDataType,   Opera7on  sourceOpera7on,  Opera7on  targetOpera7on);   XMLTypeHelper  getXMLTypeHelper();   }  
  • 28. The  Transformer  SPI   public  interface  PullTransformer<S,  R>  extends   Transformer  {   R  transform(S  source,  Transforma7onContext  context);   }   public  interface  PushTransformer<S,  R>  extends   Transformer  {   void  transform(S  source,  R  sink,  Transforma:onContext   context);   }  
  • 29. Registering  your  data  bindings/ transformers   •  META-­‐INF/services/ org.apache.tuscany.sca.databinding.DataBinding   org.apache.tuscany.sca.databinding.xml.DOMDataBinding;name=org.w3c .dom.Node   •  META-­‐INF/services/ org.apache.tuscany.sca.databinding.PullTransformer   org.apache.tuscany.sca.databinding.xml.Node2XMLStreamReader;source=org.w3 c.dom.Node,target=javax.xml.stream.XMLStreamReader,weight=80   •  META-­‐INF/services/ org.apache.tuscany.sca.databinding.PushTransformer   org.apache.tuscany.sca.databinding.xml.Node2OutputStream;source=org .w3c.dom.Node,target=java.io.OutputStream,weight=80  
  • 30. Q&A   Find  more  details  from:   Chapter  9  of  Tuscany  In  SCA  Ac7on   hp://www.manning.com/laws/   Save  40%  at  manning.com.   Enter  “javaone2010”  in  the  promo7onal  code  box  at   check  out.