gnue-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnue-dev] geasInstance.py: When are methods loaded?


From: Reinhard Mueller
Subject: Re: [Gnue-dev] geasInstance.py: When are methods loaded?
Date: 14 May 2002 17:04:25 +0200

Am Sam, 2002-05-11 um 21.32 schrieb Jan Ischebeck:
> What do you think about an object "geasMethod", which handles
> method creation/loading, building/compiling, caching and releasing.
> These "geasMethod" would be the first building blocks of the
> GEMA (GNUe Method Adapter).
> 
> In source code it could be like the following:
> 
> #
> # The factory class to build new Methods 
> #
> class geasMethodFactory:
>    def registerNativeMethod(......)
>       pass
>    def registerPythonMethod(methodSource)
>       return new geasPythonMethod(methodSource)
>       ...

I'm not sure if I understand what we need this class for.

> #
> #  all methods can be stored in and restored from the database, but they will
> #  be more likely found in the 
> #  GNU Enterprise Object Repository (GEOR)
> #
>   
> class geasObjectRepository:
>   
>    def storeObject( OID ):
> 
>    def getObject( OID ):
>        ....
>       return Object
> 
> #
> #  geasMethod is the basic method class
> #  its most important feature is to be "callable",
> #
> class geasMethod(geasObject):
> 
>    def __call__(self,*params,**args):
>       pass

looks sane

> #
> #  geasPythonMethod takes python source code as parameter
> #  to compile this code to the method it represents.
> #
> class geasPythonMethod(geasMethod):
> 
>    def __init__(self, method_source):   
>       self.compiled_method = None
>       self.method_source = method_source      
>    
>    def compileMethod():
>       # ....
>       self.compiled_method = compile (self.method_source)
>       # ....
>       
>    def __call__(self,*params,**args):
>       if (self.compiled_method==None):
>          compileMethod();
>       self.compilted_method(self,*params,**args)
>       
> Now every other kind of method can be added with ease:
>  
> class geasPythonByteCodeMethod:
> class geasNativeMethod:

looks good at first sight.

Thanks,
-- 
Reinhard Mueller
GNU Enterprise project
http://www.gnue.org




reply via email to

[Prev in Thread] Current Thread [Next in Thread]