+1 on the proposal.

The interceptor could just return the flag based on its capability without asking the next one. And the runtime can query it from the head in the invocation chain and stop when it gets a true.

boolean allowsPBR = false;
Invoker i = invocationChain.getHead();
while(i!=null) {
   if(i instanceof PassByValueInvoker}
   {
       if((PassByValueInvoker) i).allowsPassByReference()) {
           allowsPBR = true;
           break;
       }
       if(i instanceof Interceptor) {
           i = ((Interceptor) i).getNext();
       }
   }
}

Thanks,
Raymond

----- Original Message ----- From: "Jean-Sebastien Delfino" <[EMAIL PROTECTED]>
To: <tuscany-dev@ws.apache.org>
Sent: Thursday, February 07, 2008 6:06 PM
Subject: Re: Bypassing unnecessary transforms by Tuscany databinding framework


Raymond Feng wrote:
One more question:

Do you think if the participants to enforce PBV know their data capability upfront (static) or do they have to defer the decision to the actual invocation time (dynamic)? It seems that you were leaning to the dynamic style in your proposal.

Static, per operation.


If it's static, we could have a flag set on the InvocationChain (instead of Message and Interceptor). The implementation/binding providers as well as other interception providers can call InvocationChain.setPBVEnsured().

A flag on interceptor will let its implementor decide the value of the flag according to what he's doing in the interceptor. That's more extensible than hardwired logic in the providers competing to set a single flag.

With my latest proposal we don't even need a message flag as an interceptor that copies data just needs to return the flag value indicating that the data is now safe from changes.

To summarize, and using the spec terminology:
AnInvoker {

  boolean allowsPassByReference() {
    // example implementation
    check the @AllowsPassByReference annotation or equivalent
    indication that the given data is safe and won't be altered
  }
}

and Interceptor {

  boolean allowsPassByReference() {
    // example implementation
    boolean doIAllowThat = depends on what I do with the data
      in the interceptor;
    return doIAllowThat && next.allowsPassByReference();
  }
}

--
Jean-Sebastien

---------------------------------------------------------------------
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