Hi,

I should add in my code the validator() method (third party method of
a class) in all my "service" ..... is there a way to automatize this ?
is there the possibility to generate the definition as well ?
and
something that doesn't align with the intrinsic purpose of what Thrift does.

Yes, exactly. In my opinion this is slighly beyond the scope of Thrift.

      service UserStorage {
        void store(1: UserProfile user),
        UserProfile retrieve(1: i32 uid)
      }
I have in my Thrift definition file a lot of service in which they
have to call a method (let´s say that the retrieve method have to call
the validator(this) method)  .....

I'm not sure if we are talking about client or server end here. In either case, the first approach that comes to my mind would be to encapsulate all the calls to/from the API into another layer that takes care of the validator() calls. The layer is located between the Thrift API implementation and the rest of the application logic, where it can do whatever he wants to do with the data structures that flow through. This method could work pretty much the same way with clients or servers, whatever you need.

http://en.wikipedia.org/wiki/Facade_pattern

JensG


-----Ursprüngliche Nachricht----- From: Knick, Scott E CTR USARMY RCERT-EUR (US)
Sent: Friday, November 30, 2012 1:38 PM
To: [email protected]
Subject: RE: generation code (method definition) (UNCLASSIFIED)

Classification: UNCLASSIFIED
Caveats: FOUO

I think he's suggesting that what you're trying to do is something that doesn't align with the intrinsic purpose of what Thrift does.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Onorato Vaticone
Sent: Friday, November 30, 2012 1:33 PM
To: [email protected]
Subject: Re: generation code (method definition)

what do you mean ?


On 30 November 2012 13:28, Jens Geyer <[email protected]> wrote:

Isn't that an merely orthogonal aspect, IMHO?

________________________________
Von: Onorato Vaticone
Gesendet: 30.11.2012 11:25
An: [email protected]
Betreff: generation code (method definition)

Hi there,
I´m just wandering if it´s possible to generate the definition of a
method as well.
Let me explain. It could happen that (from Thrift web page) :

      struct UserProfile {
        1: i32 uid,
        2: string name,
        3: string blurb
      }
      service UserStorage {
        void store(1: UserProfile user),
        UserProfile retrieve(1: i32 uid)
      }

I have in my Thrift definition file a lot of service in which they
have to call a method (let´s say that the retrieve method have to call
the
validator(this) method)  .....
I should add in my code the validator() method (third party method of
a
class) in all my "service" ..... is there a way to automatize this ?
is there the possibility to generate the definition as well ?


thanks a lot :-)




--
Onorato Vaticone
m : +39.3336048864
email : [email protected]
web : www.onoratovaticone.it

Classification: UNCLASSIFIED
Caveats: FOUO


Reply via email to