Raymond,

That works for me.

On Jan 10, 2008 2:54 PM, Raymond Feng <[EMAIL PROTECTED]> wrote:

> Hi, Scott.
>
> I did more test. I came to a conclusion that the private edge can only be
> selected if the edge connects to the target (i.e., the edge is the last
> one
> on the path). The private edge should NOT be used as the first one on the
> transformation path unless it's the only edge on the path.
>
> In your case, we should mark Node2DataObject as private and
> DataObject2XMLStreamReader should be kept public. This way, we can prevent
> Node2DataObject to be used as intermediate hop.  But we still can do SDO
> to
> JAXB conversion via XMLStreamReader.
>
> The simple rule should be: if the target type of a transformer cannot be
> used as an intermediary (for example, SDO, JAXB or JSON, which either
> requires extra metadata or cannot go roundtrip), we should mark it
> private.
>
> In summary, I think the correct fix should be:
>
> if (edge.isPublic() || edge.getTargetVertex() == target) {
>    ...
> }
>
> Thanks,
> Raymond
>
> ----- Original Message -----
> From: "Scott Kurz" <[EMAIL PROTECTED]>
> To: <[email protected]>
> Sent: Wednesday, January 09, 2008 2:23 PM
> Subject: Re: Does the public/private transformer support have a bug?
>
>
> > Yep, that works.   Thanks for interjecting since I wasn't sure I was
> > understanding the intent.
> >
> >
> >
> >
> > On Jan 9, 2008 5:08 PM, Raymond Feng <[EMAIL PROTECTED]> wrote:
> >
> >> Hi, Scott.
> >>
> >> Can you try to fix the issue as follows?
> >> if (edge.isPublic() || edge.getSourceVertex() == source ||
> >> edge.getTargetVertex() == target) {
> >>    ...
> >> }
> >>
> >> Thanks,
> >> Raymond
> >>
> >> ----- Original Message -----
> >> From: "Scott Kurz" <[EMAIL PROTECTED]>
> >> To: <[email protected]>
> >> Sent: Wednesday, January 09, 2008 2:02 PM
> >> Subject: Re: Does the public/private transformer support have a bug?
> >>
> >>
> >> > I'll follow up my own question and ask whether we need to do more in
> >> order
> >> > to avoid an unwanted intermediate transformation such as this (a
> >> transform
> >> > into SDO in the midst of converting between JAXB and AXIOM).
> >> >
> >> > So even if I fix what I was assuming was a bug (though I'm still not
> >> sure
> >> > I
> >> > understand 100% the design intent) by doing:
> >> >
> >> >                // Only look for public edge unless this is the first
> >> node
> >> >                if (nextNode.vertex.equals(source) || edge.isPublic())
> {
> >> >
> >> > I still have the same problem in the other direction.
> >> >
> >> > That is, not only do I want to only convert from SDO to something
> else
> >> > ONLY
> >> > if this is the first transform outbound....  I also want to convert
> >> > from
> >> > something else to SDO ONLY
> >> > if this is the last transform "inbound", i.e. the transform resulting
> >> > in
> >> > the
> >> > ultimate target DB.
> >> >
> >> > Does this sound reasonable?
> >> > Scott
> >> >
> >> >
> >> >
> >> >
> >> >
> >> > On Jan 9, 2008 3:19 PM, Scott Kurz <[EMAIL PROTECTED]> wrote:
> >> >
> >> >>
> >> >> I have some code around the r603995 level... and I noticed the
> >> following
> >> >> transformer chain when the impl uses JAXB with the WS binding (using
> >> >> AXIOM
> >> >> DB):
> >> >>
> >> >> org.apache.tuscany.sca.databinding.jaxb.JAXB2Node
> >> >> org.apache.tuscany.sca.databinding.sdo.Node2DataObject
> >> >> org.apache.tuscany.sca.databinding.sdo.DataObject2XMLStreamReader
> >> >> org.apache.tuscany.sca.databinding.axiom.XMLStreamReader2OMElement
> >> >> This let me to try to mark the DataObject2XMLStreamReader
> transformer
> >> as
> >> >> private in order to get it out of the picture.       However, I'm
> >> >> wondering
> >> >> if this code has a bug.
> >> >>
> >> >> Though as I understand it, the idea behind marking a transformer as
> >> >> 'private' is to only allow it to be used during the first outbound
> >> >> transform, it appears the code doesn't match up
> >> >> with this.
> >> >>
> >> >> In  org.apache.tuscany.sca.databinding.impl.DirectedGraph we do:
> >> >>
> >> >>     public Path getShortestPath(V sourceValue, V targetValue) {
> >> >>         ....
> >> >>         while (!otherNodes.isEmpty()) {
> >> >>             nextNode = extractMin(otherNodes);
> >> >>             if (nextNode.vertex == target) {
> >> >>                 path = getPath(nextNode);
> >> >>                 paths.put(pair, path); // Cache it
> >> >>                 return path;
> >> >>             }
> >> >>             nodesOnPath.add(nextNode);
> >> >>             for (Edge edge : nextNode.vertex.outEdges.values()) {
> >> >>                 Node adjacentNode = nodes.get(edge.targetVertex);
> >> >>                 // Only look for public edge
> >> >>                 if (edge.isPublic()) {
> >> >>                     if (nextNode.distance + edge.weight <
> >> >> adjacentNode.distance) {
> >> >>                         adjacentNode.distance = nextNode.distance +
> >> >> edge.weight;
> >> >>                         adjacentNode.previous = nextNode;
> >> >>                     }
> >> >>                 }
> >> >>             }
> >> >>         }
> >> >>
> >> >> So, the first time through this while loop, the 'nextNode' will
> simply
> >> be
> >> >> the original source node.    We immediately disallow private
> >> >> transformers,
> >> >> then, via the isPublic() check in this logic, even in the first
> >> >> outbound transform.
> >> >>
> >> >> Am I understanding this correctly?
> >> >> Scott
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to