[Top][All Lists]

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

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

From: Jan Ischebeck
Subject: Re: [Gnue-dev] When are methods loaded?
Date: Sat, 11 May 2002 21:32:40 +0200
User-agent: Mutt/1.3.28i

Hi Reinhard,

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(......)
   def registerPythonMethod(methodSource)
      return new geasPythonMethod(methodSource)
#  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):

#  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):
Now every other kind of method can be added with ease:
class geasPythonByteCodeMethod:
class geasNativeMethod:

In the example above geasMethod was the child of an geasObject.
This geasObject would be the object type which could be stored
in GEOR.

Jan (siesel) Ischebeck
University of Bonn

reply via email to

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