commit-gnue
[Top][All Lists]
Advanced

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

r5080 - in trunk/gnue-appserver: doc/technotes src src/classrep


From: johannes
Subject: r5080 - in trunk/gnue-appserver: doc/technotes src src/classrep
Date: Sun, 8 Feb 2004 07:41:54 -0600 (CST)

Author: johannes
Date: 2004-02-08 07:41:54 -0600 (Sun, 08 Feb 2004)
New Revision: 5080

Modified:
   trunk/gnue-appserver/doc/technotes/00001.txt
   trunk/gnue-appserver/doc/technotes/00002.txt
   trunk/gnue-appserver/src/classrep/test.py
   trunk/gnue-appserver/src/test.py
Log:
appserver.test now uses 'appserver' as application-id, so values from gnue.conf
would be read correctly. Updated the technotes.


Modified: trunk/gnue-appserver/doc/technotes/00001.txt
===================================================================
--- trunk/gnue-appserver/doc/technotes/00001.txt        2004-02-08 13:30:18 UTC 
(rev 5079)
+++ trunk/gnue-appserver/doc/technotes/00001.txt        2004-02-08 13:41:54 UTC 
(rev 5080)
@@ -1,7 +1,7 @@
 Title:   The Python Language Interface
 Status:  Current 
 Created: 2003-09-16
-Revised: 2003-09-16
+Revised: 2004-02-08
 
 The Python Language Interface enables you to use GNUe Appserver business
 objects in python code as if they were python objects.
@@ -36,41 +36,55 @@
   from gnue.appserver.language import Session
   session = Session.InternalSession ()
 
-Procedures of Business Objects (not yet implemented)
+Procedures of Business Objects 
 ------------------------------
 Procedures will run as a method of a business object and therefore receive an
-instance of a business object as the "self" parameter. There will be a method
-to get the session object as a property of self.
+instance of a business object as the "self" parameter. Besides this every
+procedure has access to three global methods "find", "new" and "setcontext"
+(see below).
 
 
 Using the Session Object
 ========================
 
 The session object knows the following methods:
-* close (): Close the connection, log out from the server.
-* commit (): Commit the current transaction.
-* rollback (): Undo the current transaction.
-* setcontext (context): Set the current module context. Not yet implemented.
-* find (classname, conditions, sortorder, properties): Return a list of objects
-  that fulfill the conditions (TODO: describe the format of this parameter).
-  "sortorder" is a list of strings (property names) that define the sort order
-  of the returned list.
-  "properties" is a list of strings (property names) that define the properties
-  that should be preloaded from the database. Access to properties listed here
-  will be much faster afterwards than access to properties not listed, because
-  the latter cause a new query to the database.
-  The return value of this method is virutally a list of business objects.
-* new (classname): Create a new (empty) instance of the given class and return
-  it.
+* getSessionManager (): 
+  Get the underlying session manager
+* getSessionId (): 
+  Get the id of the session
+* setcontext (context): 
+  Set the current module context. All not fully qualified identifiers will be
+  qualified with this context. 
+* qualify (name): 
+  If 'name' is not fully qualified, it will be completed using the current
+  context. If no context is specified (using setcontext) an exception will be
+  raised.
+* close (): 
+  Close the connection, log out from the server.
+* commit (): 
+  Commit the current transaction.
+* rollback (): 
+  Undo the current transaction.
+* find (classname, conditions, sortorder, properties): 
+  Return a list of objects that fulfill the conditions (TODO: describe the
+  format of this parameter). "sortorder" is a list of strings (property names)
+  that define the sort order of the returned list.  "properties" is a list of
+  strings (property names) that define the properties that should be preloaded
+  from the database. Access to properties listed here will be much faster
+  afterwards than access to properties not listed, because the latter cause a
+  new query to the database. The return value of this method is virutally a
+  list of business objects. 
+* new (classname): 
+  Create a new (empty) instance of the given class and return it.
 
 
 Using Lists of Business Objects
 ===============================
 
-Lists of business objects (as returned by the find() method of the session
-object) can be regarded as normal Python lists. Especially list[i], len(list),
-and list.append(object) should work. Other list functions might be added later.
-list[i] will return a business object.
+Lists of business objects (as returned by the find () method of the session
+object) can be regarded as normal Python lists. Especially list[i], len(list)
+should work. Other list functions might be added later. list[i] will return a
+business object. These lists are immutable.
 
 
 Using Business Objects
@@ -88,15 +102,21 @@
 Properties defined in the class repository as "string" will be treated as
 Python type "string", properties defined as "number" will be Python type
 "float" if they have a fractional part and of type "int" otherwise.
-Properties defined as type "id" (that is, the gnue_id properties and reference
-properties) are treated as Python type "string". This will change in future
-versions, when reference properties will directly return the business object
-they point to.
+Properties defined as type "id" (that is, the gnue_id properties)
+are treated as Python type "string". Properties defined as "date", "time" or
+"datetime" will be treated as Python DateTime objects and "booleans" are
+handled as Python boolean values. 
 
-Every business object has the method "store" to post the changes made to the
-properties. Note that you also have to call the "commit" method of the session
-object to make the changes persistent.
+Properties of other types than listed before are treated as "reference
+properties" and theirfor they will return the busienss object they point to.
 
-Also, every business object has the method "delete" to destroy the object.
+A string representation (using the str() function) of a business object returns
+it's object-ID mentioned before.
+
+If you change the values of properties in a business object, it will call an
+implicit store () in the session manager. That's why there is no store ()
+method in the business object itself.
+
+Every business object has the method "delete" to destroy the object.
 Notice that you also have to call the "commit" method of the session object to
 make deletion of the object persistent.

Modified: trunk/gnue-appserver/doc/technotes/00002.txt
===================================================================
--- trunk/gnue-appserver/doc/technotes/00002.txt        2004-02-08 13:30:18 UTC 
(rev 5079)
+++ trunk/gnue-appserver/doc/technotes/00002.txt        2004-02-08 13:41:54 UTC 
(rev 5080)
@@ -1,22 +1,25 @@
 Title:   The Class Repository
 Status:  Current 
 Created: 2003-09-17
-Revised: 2003-09-17
+Revised: 2004-02-08
 
 The Class Repository holds all information about the structure of the business
 objects.
 
-To use the Class Repository, you need to "from gnue.appserver import classrep".
-
 Please regard all class repository object as read-only object. To change data
 in the class repository, access the underlying business objects.
 
+To use the Class Repository, you need a session manager object from
+geasSessionManager. Such an instance provides two public properties, modules
+and classes.
 
+
 The Module Object
 =================
 
-The global variable "classrep.modules" holds a dictionary of all modules. Each
-module is represented by a module object, the key is the module name.
+The property "modules" of a session manager instance holds a dictionary of all
+modules. Each module is represented by a module object, the key is the module
+name.
 
 All properties of the gnue_module business object (described in the API
 documentation) are also accessible as properties of the module Python object.
@@ -28,20 +31,23 @@
 ================
 
 A dictionary of classes originally defined by a specific module can be obtained
-from "module.classes". A dictionary of all classes is available in the global
-variable "classrep.classes". Both dictionaries use the fully qualified class
-name as key.
+from "module.classes". A dictionary of all classes is available in the property
+"classes" of a session manager instance.  Both dictionaries use the fully
+qualified class name as key.
 
 All properties of the gnue_class business object (described in the API
 documentation) are also accessible as properties of the class Python object.
 
 Apart from that, the class Python object has these properties:
 
-* module: The module originally defining the class
-* fullName: The fully qualified name
-* table: The underlying database table
+* module:     The module originally defining the class
+* fullName:   The fully qualified name
+* table:      The underlying database table
+* classes:    The class dictionary of the class
 * properties: A dictionary of all properties of the class, where the fully
-  qualified property name acts as the key
+              qualified property name acts as the key
+* procedures: A dictionary of all procedures of the class, where the fully
+              qualified procedure name acts as the key
 
 
 The Property Object
@@ -55,5 +61,6 @@
 properties:
 
 * fullName: The fully qualified name
-* column: The underlying database column (or None if it is a calculated
-  property (not yet implemented))
+* fullType: The complete data type of the property, including length and scale
+* column:   The underlying database column (or None if it is a calculated
+            property (not yet implemented))

Modified: trunk/gnue-appserver/src/classrep/test.py
===================================================================
--- trunk/gnue-appserver/src/classrep/test.py   2004-02-08 13:30:18 UTC (rev 
5079)
+++ trunk/gnue-appserver/src/classrep/test.py   2004-02-08 13:41:54 UTC (rev 
5080)
@@ -22,11 +22,9 @@
 # $Id$
 #
 
-from gnue.appserver.language import App
-from gnue.appserver import classrep
-
 from gnue.appserver.test import testApp
 
+
 app = testApp ()
 sm  = app.getSessionManager ()
 

Modified: trunk/gnue-appserver/src/test.py
===================================================================
--- trunk/gnue-appserver/src/test.py    2004-02-08 13:30:18 UTC (rev 5079)
+++ trunk/gnue-appserver/src/test.py    2004-02-08 13:41:54 UTC (rev 5080)
@@ -22,38 +22,39 @@
 # $Id$
 
 import os
-from gnue.common.apps import GClientApp
-from gnue.common.datasources import GLoginHandler
-import geasSessionManager
+from gnue.common.apps.GClientApp import GClientApp
+from gnue.common.datasources.GLoginHandler import LoginHandler
+from gnue.appserver.geasSessionManager import geasSessionManager
 
 # =============================================================================
 # Test application
 # =============================================================================
 
-class testApp (GClientApp.GClientApp):
+class testApp (GClientApp):
 
-  def __init__(self, connections=None):
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+  def __init__ (self, connections = None):
     ConfigOptions = {}
-    GClientApp.GClientApp.__init__(self, connections,'none',ConfigOptions)
+    GClientApp.__init__ (self, connections, 'appserver', ConfigOptions)
 
 
   # ---------------------------------------------------------------------------
   # Create a session manager object
   # ---------------------------------------------------------------------------
-
   def getSessionManager (self):
-    # set up login handler
     self.connections.setLoginHandler (testLoginHandler ())
 
     print "Creating session manager ..."
-    sm = geasSessionManager.geasSessionManager (self.connections)
+    sm = geasSessionManager (self.connections)
 
     return sm
 
+
   # ---------------------------------------------------------------------------
   # Main program
   # ---------------------------------------------------------------------------
-
   def run (self):
     sm = self.getSessionManager ()
 
@@ -81,18 +82,19 @@
     print "Committing and closing session ..."
     sm.close (session, 1)
 
+
+
 # =============================================================================
 # Login Handler
 # =============================================================================
-
-class testLoginHandler (GLoginHandler.LoginHandler):
+class testLoginHandler (LoginHandler):
   def getLogin (self, *arguments):
-    return {"_username": "johannes", "_password": None}
+    return {"_username": "gnue", "_password": None}
 
+
 # =============================================================================
 # Let it rock
 # =============================================================================
-
 if __name__ == "__main__":
   testApp().run()
   print "Thank you for playing!"





reply via email to

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