synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hariharasudhan.D" <h...@infravio.com>
Subject Re: SynapseObject - Reminder...
Date Mon, 20 Mar 2006 15:26:15 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I was out of this for a while but just wanted to know what is the
co-relation between ADB and xpath in this context. ADB is more of&nbsp; a
light weight&nbsp; schema compiler and xpath works on xml. How are we
marrying these two aren't they parallel?<br>
<br>
The other obvious question is if we already have xmlBeans for data
binding then what's the need for ADB?<br>
<br>
Would highly appreciate if&nbsp; someone can enlighten me on this. FYI, I
could not make sense of what Saminda tried to explain. From the use
case described below I think SynapseObject would be very useful for
handling mediators. <br>
<br>
Hari<br>
<br>
Davanum Srinivas wrote:
<blockquote
 cite="mid19e0530f0603200606i1d7a7f67r132a0ba38ced8a9e@mail.gmail.com"
 type="cite">
  <pre wrap="">i *really* don't see a need for it. Let's make do with standard stuff
like saminda mentioned.

thanks,
dims

On 3/20/06, Vikas <a class="moz-txt-link-rfc2396E" href="mailto:vikas@infravio.com">&lt;vikas@infravio.com&gt;</a>
wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">
Hi...

I am using SynapseObject to handle mediator data, it works as an extension.
Is there a problem in adding extensions??
Extensions are not compulsary or imposed on others, just for convenience...

But to make things clear and sum up the points:

The problem is not with using DOM / OM..
Its the XML structure that gives the meaning, the JAVA/in-memory
representation is just an enabler for that..

I did try writing the 'utility' methods for OM...
But based on a generic XML structure, it just doesn't work out...
The XML representation along with the Utility classes gives SynapseObject
the actual strength and the users the ease..

SynapseObject is not just about ObjectModel [AXIOM/DOM] or about XML [the
structure]
or the data-binding [XMLBeans/ ADB]...

Its a variation in-between, a blend to be more precise...

The very problem with XPath is that they are based on the XML structure,
change the structure =&gt;change the X-Path...

But SynapseObject has only 2 structural constraints..
Every object has
* Attributes as child objects
* Has other SynapseObjects
In case I move an attribute from a parent to its child SynapseObject, the
search utility takes care of it, In case of an X-Path that mplies another
level of ../.. [hope you are not planning to use x-paths which always search
throughout i.e [//someName]

~Vikas..

----- Original Message -----
From: Saminda Abeyruwan

To: <a class="moz-txt-link-abbreviated" href="mailto:synapse-dev@ws.apache.org">synapse-dev@ws.apache.org</a>

Sent: Monday, March 20, 2006 2:51 PM
Subject: Re: SynapseObject - Reminder...

Hi Devs,

My comments are in line,

On 3/19/06, Soumadeep <a class="moz-txt-link-rfc2396E" href="mailto:soumadeep@infravio.com">&lt;soumadeep@infravio.com&gt;</a>
wrote:

    </pre>
    <blockquote type="cite">
      <pre wrap="">

Hi,

One thing I completely agree with Sanjiva is that this has been dragged
      </pre>
    </blockquote>
    <pre wrap="">unnecessarily for this long. Let me emphasize here one thing, that
the
intension is not to replace the concepts of data binding as used by XMLBeans
which is again an Apache project or trying to re-invent what has been
written. To this effect enough reasons have been provided as to why this
approach was taken.  For convenience let me give one of the use cases and
reasons for which SynapseObject was proposed:


Following reasons  is addressed by Axis2 's codegen concepts.


    </pre>
    <blockquote type="cite">
      <pre wrap="">

Reasons:
1) Java Properties class lets you handle name-value pairs in a very good
      </pre>
    </blockquote>
    <pre wrap="">way but when it comes to representing complex objects it becomes very
difficult.
    </pre>
    <blockquote type="cite">
      <pre wrap="">2) Using the concept of data binding introduces a very rigid and
tight
      </pre>
    </blockquote>
    <pre wrap="">coupling of data and schema. So if the schema changes the underlying
data
handling mechanism needs to be changed (which includes the beans/classes to
hold the complex data structure)


This is why there are two entities exists in Axis2.  If the xml is  schema
compliant  i will use XSD2Java, if not i will write my beans and use
BeanUtil.


    </pre>
    <blockquote type="cite">
      <pre wrap="">

3) Intelligent search features are either driven by xpath/xqueries for
      </pre>
    </blockquote>
    <pre wrap="">pure XML or embedded logic if beans are used, SynapseObject has inbuilt
search features by which you can perform complex searches
    </pre>
    <blockquote type="cite">
      <pre wrap="">4) The reason people use Java Properties class is because name-value
pairs
      </pre>
    </blockquote>
    <pre wrap="">can be shared by other class without any dependency. SynapseObject
is more
like a Properties Class with added features to handle Complex Objects and
also allow search features.


Synapse is a user of Axis2, so let it be a user of  Axis2's XSD2Java,
BeanUtil and Jaxen compliant Xpath.


    </pre>
    <blockquote type="cite">
      <pre wrap="">

Uses Cases:
A) Data-Sharing between mediators: Consumers need to be identified, once
      </pre>
    </blockquote>
    <pre wrap="">it's identified the information could be shared by the SLA mediator
which
depending on a consumer will set the priority. Below is the pseudo code  of
how this can be achieved using SynapseObject and how datasharing would
become easy.
    </pre>
    <blockquote type="cite">
      <pre wrap="">Background Info:
-----------------------
ConsumerIdentification mediator needs to identify a client by the
      </pre>
    </blockquote>
    <pre wrap="">following ways:
    </pre>
    <blockquote type="cite">
      <pre wrap="">1) IP {eg. 192.168.5.*}
2) IP Range {eg. 192.168.5.20- 192.168.5.30}
3) WS-SEC auth token
4) HTTP auth token
5) certificate
(Other factors that need to be considered whether the incoming message was
      </pre>
    </blockquote>
    <pre wrap="">first encrypted and then signed or was it signed and then encrypted).
    </pre>
    <blockquote type="cite">
      <pre wrap="">Let's consider 1) IP

Using SynapseObject:
ConsumerIdentification
--------------------------------

xml frag:
&lt;?xml version='1.0' encoding='windows-1252'?&gt;
&lt;SynapseObject name="ci"&gt;

 &lt;SynapseObject name="consumer0"&gt;
   &lt;Attribute name="CONSUMER_TYPE" type="String"&gt;GOLD&lt;/Attribute&gt;

   &lt;Attribute name="IP_ADDRESS_FROM" type="String"&gt;192.168.6.0&lt;/Attribute&gt;

   &lt;Attribute name="IP_ADDRESS_TO" type="String"&gt;192.168.6.255&lt;/Attribute&gt;
   &lt;Attribute name="HTTP_AUTH_USERNAME" type="String"&gt;john&lt;/Attribute&gt;
   &lt;Attribute name="WS_SEC_USERNAME" type="String"&gt;john&lt;/Attribute&gt;
   &lt;SynapseObject name="assignedService"&gt;
    &lt;Attribute name="serviceid1"
      </pre>
    </blockquote>
    <pre wrap="">type="String"&gt;stockQuote1&lt;/Attribute&gt;
    </pre>
    <blockquote type="cite">
      <pre wrap="">   &lt;/SynapseObject&gt;
 &lt;/SynapseObject&gt;
 &lt;SynapseObject name="consumer1"&gt;
   &lt;Attribute name="CONSUMER_TYPE"
      </pre>
    </blockquote>
    <pre wrap="">type="String"&gt;SILVER&lt;/Attribute&gt;
    </pre>
    <blockquote type="cite">
      <pre wrap="">   &lt;Attribute name="IP_ADDRESS_FROM"
      </pre>
    </blockquote>
    <pre wrap="">type="String"&gt;192.168.6.255&lt;/Attribute&gt;
    </pre>
    <blockquote type="cite">
      <pre wrap="">   &lt;Attribute name="IP_ADDRESS_TO" type="String"&gt;192.167.6.255&lt;/Attribute&gt;
   &lt;Attribute name="HTTP_AUTH_USERNAME" type="String"&gt;mary&lt;/Attribute&gt;
   &lt;Attribute name="WS_SEC_USERNAME" type="String"&gt;mary&lt;/Attribute&gt;
   &lt;SynapseObject name="assignedService"&gt;
    &lt;Attribute name="serviceid1"
      </pre>
    </blockquote>
    <pre wrap="">type="String"&gt;stockQuote&lt;/Attribute&gt;
    </pre>
    <blockquote type="cite">
      <pre wrap="">    &lt;Attribute name="ip" type="String"&gt;192&lt;/Attribute&gt;
   &lt;/SynapseObject&gt;
 &lt;/SynapseObject&gt;
&lt;/SynapseObject&gt;
      </pre>
    </blockquote>
    <pre wrap="">
Back to  square  one,

Above  can be written as,
&lt;ci&gt;
     &lt;consumer name="consumer0"&gt;
            &lt;type&gt;GOLD&lt;/type&gt;
            &lt;ip_address_from&gt;192.168.6.0 &lt;/ip_address_from&gt;
            &lt;ip_address_to&gt;192.167.6.255 &lt;/ip_address_to&gt;
            &lt;http_auth_username&gt;Mary&lt;/http_auth_username&gt;
             &lt;ws_sec_username&gt;Mary&lt;/ws_sec_username&gt;
     &lt;/consumer&gt;
     &lt;service name="assingedservice"&gt;
        &lt;!-- other stuff --&gt;
     &lt;/service&gt;
     &lt;consumer name="consumer1"&gt;
         &lt;!-- related suff --&gt;
     &lt;/consumer&gt;
        &lt;!-- other services or consumers or related stuff --&gt;
&lt;/ci&gt;

which is much more readable,

If i want intelligent search i use xpath. A lot of users know how to use
xpath, so it's Zero training. If i write  simple beans, i can populate the
bean objects using BeanUtil. Now in production the above xml should be
schema aware. That's the whole point of inventing schema. So i will use
XSD2Java. Now these technologies are not going to hook into Synapse core.


    </pre>
    <blockquote type="cite">
      <pre wrap="">

in the ci mediator  code fragment

// the the requester ip
ip = {get the remote ip from the messageContext/SynapseContext }

//Identify if the consumer is there and get appropriate details and store
      </pre>
    </blockquote>
    <pre wrap="">the consumer related details in the messageContext, one more things
to note
is that storing shared data is by the mediator name itself eg. ci
    </pre>
    <blockquote type="cite">
      <pre wrap="">SynapseObject obj =
      </pre>
    </blockquote>
    <pre wrap="">consumerIdentification.findSynapseObjectByAttributeValueStartingWith(ip);
    </pre>
    <blockquote type="cite">
      <pre wrap="">messageContext.setProperty(consumerIdentification.getName(),obj);
obj will contain all the required values if identified!

SLA
------

xml Fragment:

&lt;SynapseObject name="SLA"&gt;
    &lt;SynapseObject name="consumer0"&gt;
        &lt;SynapseObject name="Service0"&gt;
            &lt;Attribute name="EPR"
      </pre>
    </blockquote>
    <pre wrap="">type="String"&gt;<a class="moz-txt-link-freetext" href="http://www.webservicex.net/stockquote.asmx">http://www.webservicex.net/stockquote.asmx</a>&lt;/Atrribute&gt;
    </pre>
    <blockquote type="cite">
      <pre wrap="">            &lt;Attribute name="priority" type="Integer"&gt;0&lt;/Attribute&gt;
        &lt;/SynapseObject&gt;


        &lt;SynapseObject name="Service1"&gt;
            &lt;Attribute name="EPR"
      </pre>
    </blockquote>
    <pre wrap="">type="String"&gt;<a class="moz-txt-link-freetext" href="http://www.webservicex.net/findZIPCode.asmx">http://www.webservicex.net/findZIPCode.asmx</a>&lt;/Atrribute&gt;
    </pre>
    <blockquote type="cite">
      <pre wrap="">            &lt;Attribute name="priority" type="Integer"&gt;1&lt;/Attribute&gt;
        &lt;/SynapseObject&gt;
    &lt;/SynapseObject&gt;
&lt;/SynapseObject&gt;
      </pre>
    </blockquote>
    <pre wrap="">
IMHO  above xml fragment would treat as the prior.


    </pre>
    <blockquote type="cite">
      <pre wrap="">

in the SLA Mediator code fragment

//As there is a dependency between the SLA mediator and CI the SLA
      </pre>
    </blockquote>
    <pre wrap="">mediator will pick information for its dependency (Note: we also proposed
a
concept
    </pre>
    <blockquote type="cite">
      <pre wrap="">//of MediatorContext which will have dependency and other information
for
      </pre>
    </blockquote>
    <pre wrap="">a particular mediator)


Excuse me btw :)


    </pre>
    <blockquote type="cite">
      <pre wrap="">

//Get the identified consumer from the messagecontext
SynapseObject consumerIdentification =
      </pre>
    </blockquote>
    <pre wrap="">(SynapseObject)messageContext.getProperty("ci");
    </pre>
    <blockquote type="cite">
      <pre wrap="">// get the consumer name and consumer type
String consumerName = consumerIdentification.getName();
String consumerType =
      </pre>
    </blockquote>
    <pre wrap="">consumerIdentification.getString("CONSUMER_TYPE");
    </pre>
    <blockquote type="cite">
      <pre wrap="">//find the sla details for the identified consumer
SynapseObject consumer =
      </pre>
    </blockquote>
    <pre wrap="">sla.findSynapseObjectByAttributeValue(consumerName);
    </pre>
    <blockquote type="cite">
      <pre wrap="">String fromAddress =
      </pre>
    </blockquote>
    <pre wrap="">(String)synapseMessageContext.getTo();
    </pre>
    <blockquote type="cite">
      <pre wrap="">SynapseObject service =
      </pre>
    </blockquote>
    <pre wrap="">consumer.findSynapseObjectByAttributeValue(fromAddress );
    </pre>
    <blockquote type="cite">
      <pre wrap="">// The priority value would be used by the SLA mediator to forward
the
      </pre>
    </blockquote>
    <pre wrap="">request to the provider depending on the priority.
    </pre>
    <blockquote type="cite">
      <pre wrap="">String priority = service.getString("priority");
      </pre>
    </blockquote>
    <pre wrap="">
Now as i can understand from the above code fragments, SynaspeObject has to
have a hook to Synapse core. As we agreed, SO should be  an extension.
Besides, as technology exists for manipulating the required xml, (xpath,
XSD2Java, BeanUtil) for mediators without having a hook to Synapse core, why
on earth we make SO a core feature?

Thank you

Saminda


    </pre>
    <blockquote type="cite">
      <pre wrap="">

Regards
Soumadeep


-----Original Message-----
From: Saminda Abeyruwan [<a class="moz-txt-link-freetext" href="mailto:samindaa@gmail.com">mailto:samindaa@gmail.com</a>]
Sent: Saturday, March 18, 2006 6:59 PM
To: <a class="moz-txt-link-abbreviated" href="mailto:synapse-dev@ws.apache.org">synapse-dev@ws.apache.org</a>
Subject: Re: SynapseObject - Reminder...


Hi Devs,

These are my concern regarding SynapseObject,

If the following XML is considered wrt SynapseObject semantics,

&lt;SynapseObject name="sla"&gt;
     &lt;attribute name="service"
      </pre>
    </blockquote>
    <pre wrap="">type="STRING"&gt;<a class="moz-txt-link-freetext" href="http://myhost:myport/Service">http://myhost:myport/Service</a>&lt;/attribute&gt;
    </pre>
    <blockquote type="cite">
      <pre wrap="">     &lt;SynapseObject name="consumer"&gt;
     &lt;attribute name="ip" type="STRING"&gt;192.9.2.11&lt;/attribute&gt;
     &lt;/SynapseObject&gt;
&lt;/SynapseObject&gt;

which is similar to,

&lt;sla&gt;
     &lt;service&gt; <a class="moz-txt-link-freetext" href="http://myhost:myport/Service">http://myhost:myport/Service</a>
&lt;/service&gt;
     &lt;consumer&gt;
          &lt;ip&gt;192.9.2.11&lt;/ip&gt;
     &lt;/consumer&gt;
&lt;/sla&gt;

Now if we have Java beans as follows,

public class sla {
    private String service;
    private Consumer consumer;

   //getter and setters
}

public class Consumer {
     private String ip;

   //getter and setters
}

and using the Axis2's
      </pre>
    </blockquote>
    <pre wrap="">org.apache.axis2.databinding.utils.BeanUtil.getPullParser(Object
beanObject, QName beanName);
    </pre>
    <blockquote type="cite">
      <pre wrap="">i can get a XMLStreamReader and build the OMElement i need. And if
i have
      </pre>
    </blockquote>
    <pre wrap="">prior XML, using
    </pre>
    <blockquote type="cite">
      <pre wrap="">Object []
      </pre>
    </blockquote>
    <pre wrap="">org.apache.axis2.databinding.utils.BeanUtil.deserialize(OMElement
response, Object [] javaTypes); i can fill the bean object.
    </pre>
    <blockquote type="cite">
      <pre wrap="">So if I'm a Mediator author, using BeanUtil i can manipulate XML
with Zero
      </pre>
    </blockquote>
    <pre wrap="">training.
    </pre>
    <blockquote type="cite">
      <pre wrap="">Now if my XML is schema complaint, using XSD2Java i can generate
Beans and
      </pre>
    </blockquote>
    <pre wrap="">using XX.parse() method i can fill the beans.
    </pre>
    <blockquote type="cite">
      <pre wrap="">So what is done by SynapseObject is already done by Axis2's BeanUtil
and
      </pre>
    </blockquote>
    <pre wrap="">XSD2Java and they can do much more. So  IMHO we do not need to reinvent
the
wheel with SynapseObject.
    </pre>
    <blockquote type="cite">
      <pre wrap="">Those are my concerns.

Thank you

Saminda




On 3/17/06, Sanjiva Weerawarana <a class="moz-txt-link-rfc2396E" href="mailto:sanjiva@opensource.lk">&lt;sanjiva@opensource.lk&gt;</a>
wrote:
      </pre>
      <blockquote type="cite">
        <pre wrap="">On Mon, 2006-03-27 at 18:44 +0530, Vikas wrote:
        </pre>
        <blockquote type="cite">
          <pre wrap="">Hi,

This is regarding the Synapse object proposed by me and Soumadeep...

For convenience I am putting below the links for reference:

          </pre>
        </blockquote>
      </blockquote>
    </blockquote>
    <pre wrap="">&lt;<a class="moz-txt-link-freetext" href="http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200602.mbox/%">http://mail-archives.apache.org/mod_mbox/ws-synapse-dev/200602.mbox/%</a>
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:3cPOEHIPNLJGDMKMMBHILOAECICBAA.soumadeep@infravio.com">3cPOEHIPNLJGDMKMMBHILOAECICBAA.soumadeep@infravio.com</a>
          </pre>
        </blockquote>
      </blockquote>
    </blockquote>
    <pre wrap="">%3e&gt;
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap="">and the source code has been available in the Scratch
&lt;
          </pre>
        </blockquote>
      </blockquote>
    </blockquote>
    <pre wrap=""><a class="moz-txt-link-freetext" href="http://svn.apache.org/repos/asf/incubator/synapse/trunk/scratch/infravio/synapse-SO">http://svn.apache.org/repos/asf/incubator/synapse/trunk/scratch/infravio/synapse-SO</a>
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <blockquote type="cite">
          <pre wrap="">I feel that it an effective utility and have made use of it in
a all
the mediators that I would like to commit . It sure has made handling
mediator's config data easier..
Would be checking in the cleaned up code for SynapseObject as an
extension...Which I guess is OK.

Please let me know if anyone has any concerns about it??
          </pre>
        </blockquote>
        <pre wrap="">I do .. I will write an explanatory reply tomrrow my time .. sorry
for
keeping quiet; I've been reading much of this thread but just haven't
had the time to jump in.

I *will* dive in tomorrow (later today my time really). I'm afraid its
going to have lots of -1s against SynapseObject features :( .. just to
give you a warning of where its going.

Sanjiva.




        </pre>
      </blockquote>
    </blockquote>
    <pre wrap="">---------------------------------------------------------------------
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">To unsubscribe, e-mail:
        </pre>
      </blockquote>
    </blockquote>
    <pre wrap=""><a class="moz-txt-link-abbreviated" href="mailto:synapse-dev-unsubscribe@ws.apache.org">synapse-dev-unsubscribe@ws.apache.org</a>
    </pre>
    <blockquote type="cite">
      <blockquote type="cite">
        <pre wrap="">For additional commands, e-mail: <a class="moz-txt-link-abbreviated"
href="mailto:synapse-dev-help@ws.apache.org">synapse-dev-help@ws.apache.org</a>


        </pre>
      </blockquote>
      <pre wrap="">

      </pre>
    </blockquote>
    <pre wrap="">
    </pre>
  </blockquote>
  <pre wrap=""><!---->

--
Davanum Srinivas : <a class="moz-txt-link-freetext" href="http://wso2.com/blogs/">http://wso2.com/blogs/</a>

---------------------------------------------------------------------
To unsubscribe, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:synapse-dev-unsubscribe@ws.apache.org">synapse-dev-unsubscribe@ws.apache.org</a>
For additional commands, e-mail: <a class="moz-txt-link-abbreviated" href="mailto:synapse-dev-help@ws.apache.org">synapse-dev-help@ws.apache.org</a>


  </pre>
</blockquote>
<br>
<br>
<div class="moz-signature">-- <br>
<hr><font color="#000000" size="3">
<pre>Regards,
Hariharasudhan.D.


When I do good, I feel good; when I do bad, I feel bad.That&#8217;s my religion .
- Abraham Lincoln
</pre>
</font>
</div>
</body>
</html>

---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org


Mime
View raw message