commit-gnue
[Top][All Lists]
Advanced

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

r5100 - in trunk/gnue-appserver: . samples src/classrep src/language


From: johannes
Subject: r5100 - in trunk/gnue-appserver: . samples src/classrep src/language
Date: Thu, 12 Feb 2004 08:24:23 -0600 (CST)

Author: johannes
Date: 2004-02-12 08:24:22 -0600 (Thu, 12 Feb 2004)
New Revision: 5100

Modified:
   trunk/gnue-appserver/BUGS
   trunk/gnue-appserver/samples/Makefile
   trunk/gnue-appserver/src/classrep/Class.py
   trunk/gnue-appserver/src/classrep/Module.py
   trunk/gnue-appserver/src/classrep/Procedure.py
   trunk/gnue-appserver/src/classrep/Property.py
   trunk/gnue-appserver/src/classrep/SchemaSupport.py
   trunk/gnue-appserver/src/language/Object.py
Log:
Optimized access to the gnue_id property in the class repository.
Removed gnue-schema-bugs from the BUGS file and changed samples-makefile to use
gnue-schema instead of xslt (sablotron).


Modified: trunk/gnue-appserver/BUGS
===================================================================
--- trunk/gnue-appserver/BUGS   2004-02-12 14:21:22 UTC (rev 5099)
+++ trunk/gnue-appserver/BUGS   2004-02-12 14:24:22 UTC (rev 5100)
@@ -3,30 +3,19 @@
 * GNUe_ClassRepository.gfd can not be used to create new classes and
   properties.  They just don't get saved.
 
-* gnue-common's gnue-scripter doesn't support boolean type, so the sample
-  .gsd's can't be processed with gnue-scripter.  gnue-common/utils/gsd2sql has
-  to be used.
-
-* .gsd's define the datatype "timestamp", AppServer uses "datetime".  IMHO
-  "datetime" is the more logical name, so this should be added to the .gsd
-  definition at least as an alias.
-
 * gnue-forms doesn't support format masks for date/time fields, so the time and
   datetime fields in the samples can't be used with gnue-forms
 
 * gnue-common's appserver dbdriver requests the list of types each time a query
   is done.  Actually it should be enough to request it once the form is opened.
 
-* gnue-common's appserver dbdriver doesn't  close a session after a connection 
is 
-  finished or authentication failed
+* gnue-common's appserver dbdriver doesn't  close a session after a connection
+  is finished or authentication failed
 
 * gnue-common's appserver dbdriver does a query with an impossible condition to
   create an empty result set.  This causes superflous RPC calls to AppServer.
   It should be possible for gnue-common to create an empty result set without
   doing a query at all.
 
-* There is no way for the user to access the functionality in SchemaSupport.py
-  (export class definitions into a .gsd file)
-
 * Not all strings are translatable, i.e. _() has to put around all strings
 

Modified: trunk/gnue-appserver/samples/Makefile
===================================================================
--- trunk/gnue-appserver/samples/Makefile       2004-02-12 14:21:22 UTC (rev 
5099)
+++ trunk/gnue-appserver/samples/Makefile       2004-02-12 14:24:22 UTC (rev 
5100)
@@ -1,62 +1,56 @@
-# this Makefile creates sql scripts for different databases
-# at the moment it requires the sablotron XSLT processor
-xsltcmd = sabcmd
-#xsltcmd = xsltproc
-xslpath = ../../gnue-common/utils/xml2sql/
-xslstrip = ${xslpath}strip.command.xsl
-src1 = base.gsd
-src2 = auth.gsd
-src3 = sample.gsd
-out1 = base
-out2 = auth
-out3 = sample
+#
+# This file is part of GNU Enterprise.
+#
+# GNU Enterprise is free software; you can redistribute it
+# and/or modify it under the terms of the GNU General Public
+# License as published by the Free Software Foundation; either
+# version 2, or (at your option) any later version.
+#
+# GNU Enterprise is distributed in the hope that it will be
+# useful, but WITHOUT ANY WARRANTY; without even the implied
+# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+# PURPOSE. See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public
+# License along with program; see the file COPYING. If not,
+# write to the Free Software Foundation, Inc., 59 Temple Place
+# - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright 2001-2004 Free Software Foundation
+#
+# $Id$
+# 
 
-all:  pgsql.sql mysql.sql mssql.sql sybase.sql interbase.sql html
+# Which scripter to use
+SCRIPTER = $(shell type -p "gsscvs")
+ifeq ($(SCRIPTER),)
+  SCRIPTER = $(shell type -p "gnue-schema")
+endif
 
+# Which processors to use
+PROCESSORS = postgresql interbase oracle mysql
 
-mysql.sql: ${xslpath}mysql.xsl ${src1} ${src2} ${src3}
-       mkdir -p mysql
-       ${xsltcmd} ${xslpath}mysql.xsl ${src1} | ${xsltcmd} ${xslstrip} > 
mysql/${out1}.sql
-       ${xsltcmd} ${xslpath}mysql.xsl ${src2} | ${xsltcmd} ${xslstrip} > 
mysql/${out2}.sql
-       ${xsltcmd} ${xslpath}mysql.xsl ${src3} | ${xsltcmd} ${xslstrip} > 
mysql/${out3}.sql
-       cat mysql/${out1}.sql mysql/${out2}.sql mysql/${out3}.sql > mysql.sql 
+# Which files to process
+SRC        = base.gsd test.gsd
 
-pgsql.sql: ${xslpath}pgsql.xsl ${src1} ${src2} ${src3}
-       mkdir -p pgsql
-       ${xsltcmd} ${xslpath}pgsql.xsl ${src1} | ${xsltcmd} ${xslstrip} > 
pgsql/${out1}.sql
-       ${xsltcmd} ${xslpath}pgsql.xsl ${src2} | ${xsltcmd} ${xslstrip} > 
pgsql/${out2}.sql
-       ${xsltcmd} ${xslpath}pgsql.xsl ${src3} | ${xsltcmd} ${xslstrip} > 
pgsql/${out3}.sql
-       cat pgsql/${out1}.sql pgsql/${out2}.sql pgsql/${out3}.sql > pgsql.sql 
+OPTS = 
 
-mssql.sql: ${xslpath}mssql.xsl ${src1} ${src2} ${src3}
-       mkdir -p mssql
-       ${xsltcmd} ${xslpath}mssql.xsl ${src1} | ${xsltcmd} ${xslstrip} > 
mssql/${out1}.sql
-       ${xsltcmd} ${xslpath}mssql.xsl ${src2} | ${xsltcmd} ${xslstrip} > 
mssql/${out2}.sql
-       ${xsltcmd} ${xslpath}mssql.xsl ${src3} | ${xsltcmd} ${xslstrip} > 
mssql/${out3}.sql
-       cat mssql/${out1}.sql mssql/${out2}.sql mssql/${out3}.sql > mssql.sql 
+# ---------------------------------------------------------------------------
+# Rules to build all SQL files
+# ---------------------------------------------------------------------------
 
-sybase.sql: ${xslpath}sybase.xsl ${src1} ${src2} ${src3}
-       mkdir -p sybase
-       ${xsltcmd} ${xslpath}sybase.xsl ${src1} | ${xsltcmd} ${xslstrip} > 
sybase/${out1}.sql
-       ${xsltcmd} ${xslpath}sybase.xsl ${src2} | ${xsltcmd} ${xslstrip} > 
sybase/${out2}.sql
-       ${xsltcmd} ${xslpath}sybase.xsl ${src3} | ${xsltcmd} ${xslstrip} > 
sybase/${out3}.sql
-       cat sybase/${out1}.sql sybase/${out2}.sql sybase/${out3}.sql > 
sybase.sql 
+.PHONY: all clean
 
-interbase.sql: ${xslpath}interbase.xsl ${src1} ${src2} ${src3}
-       mkdir -p interbase
-       ${xsltcmd} ${xslpath}interbase.xsl ${src1} | ${xsltcmd} ${xslstrip} > 
interbase/${out1}.sql
-       ${xsltcmd} ${xslpath}interbase.xsl ${src2} | ${xsltcmd} ${xslstrip} > 
interbase/${out2}.sql
-       ${xsltcmd} ${xslpath}interbase.xsl ${src3} | ${xsltcmd} ${xslstrip} > 
interbase/${out3}.sql
-       cat interbase/${out1}.sql interbase/${out2}.sql interbase/${out3}.sql > 
interbase.sql 
+all: $(PROCESSORS)
 
-html: ${xslpath}display.xsl ${src1} ${src2} ${src3}
-       mkdir -p html
-       ${xsltcmd} ${xslpath}display.xsl ${src1} > html/${out1}.html
-       ${xsltcmd} ${xslpath}display.xsl ${src2} > html/${out2}.html
-       ${xsltcmd} ${xslpath}display.xsl ${src3} > html/${out3}.html
-       ln -f ${xslpath}no.png html
-       ln -f ${xslpath}yes.png html
-       ln -f ${xslpath}key.png html
+$(PROCESSORS):
+       rm -f address@hidden
 
+       for gsd in $(SRC); do \
+         $(SCRIPTER) $(OPTS) --vendor=$@ --output=$$gsd.tmp $$gsd; \
+         cat $$gsd.tmp >> address@hidden; \
+         rm $$gsd.tmp; \
+       done
+
 clean:
-       rm -rf *.sql mysql pgsql mssql sybase interbase html
+       rm -f *.sql


Property changes on: trunk/gnue-appserver/samples/Makefile
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/gnue-appserver/src/classrep/Class.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Class.py  2004-02-12 14:21:22 UTC (rev 
5099)
+++ trunk/gnue-appserver/src/classrep/Class.py  2004-02-12 14:24:22 UTC (rev 
5100)
@@ -79,7 +79,8 @@
   # ---------------------------------------------------------------------------
   def _getNewItem (self, object):
     module = self.modules.find (object.gnue_module)
-    return Class (self._session, self, module, object)
+    return Class (self._session, self, module, object, {"gnue_id":
+      object.objectId})
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-appserver/src/classrep/Module.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Module.py 2004-02-12 14:21:22 UTC (rev 
5099)
+++ trunk/gnue-appserver/src/classrep/Module.py 2004-02-12 14:24:22 UTC (rev 
5100)
@@ -49,7 +49,7 @@
   # Create a new module instance
   # ---------------------------------------------------------------------------
   def _getNewItem (self, aObject):
-    return Module (self._session, self, aObject)
+    return Module (self._session, self, aObject, {"gnue_id": aObject.objectId})
 
   # ---------------------------------------------------------------------------
   # Create a condition to reload a single module

Modified: trunk/gnue-appserver/src/classrep/Procedure.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Procedure.py      2004-02-12 14:21:22 UTC 
(rev 5099)
+++ trunk/gnue-appserver/src/classrep/Procedure.py      2004-02-12 14:24:22 UTC 
(rev 5100)
@@ -45,7 +45,7 @@
   # ---------------------------------------------------------------------------
   def _getNewItem (self, object):
     pMod = self.__module.modules.find (object.gnue_module)
-    return Procedure (self._session, pMod, object)
+    return Procedure (self._session, pMod, object, {"gnue_id": 
object.objectId})
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-appserver/src/classrep/Property.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Property.py       2004-02-12 14:21:22 UTC 
(rev 5099)
+++ trunk/gnue-appserver/src/classrep/Property.py       2004-02-12 14:24:22 UTC 
(rev 5100)
@@ -53,7 +53,7 @@
   # ---------------------------------------------------------------------------
   def _getNewItem (self, object):
     pMod = self.__module.modules.find (object.gnue_module)
-    return Property (self._session, pMod, object)
+    return Property (self._session, pMod, object, {"gnue_id": object.objectId})
 
 
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-appserver/src/classrep/SchemaSupport.py
===================================================================
--- trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-02-12 14:21:22 UTC 
(rev 5099)
+++ trunk/gnue-appserver/src/classrep/SchemaSupport.py  2004-02-12 14:24:22 UTC 
(rev 5100)
@@ -32,15 +32,6 @@
 from gnue.common.definitions.GParserHelpers import GContent
 import sys
 
-SCHEMA_STORE = [ 'schema', 'data', 'both' ]
-SCHEMA_TYPES = { 'string'  : 'string', 
-                 'number'  : 'number',
-                 'boolean' : 'boolean',
-                 'date'    : 'date',
-                 'time'    : 'time',
-                 'datetime': 'timestamp' }
-
-
 # =============================================================================
 # Exceptions: Base exception class
 # =============================================================================
@@ -67,6 +58,9 @@
 # =============================================================================
 class SchemaSupport:
 
+  SCHEMA_STORE = ["schema", "data", "both"]
+  SCHEMA_TYPES = ["string", "number", "boolean", "date", "time", "datetime"]
+
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
@@ -82,7 +76,7 @@
     if wtype is None:
       wtype = "both"
 
-    elif wtype.lower () not in SCHEMA_STORE:
+    elif wtype.lower () not in self.SCHEMA_STORE:
       raise EInvalidType (wtype.lower ())
 
     # If no specific items are requested, we will use classes
@@ -155,8 +149,8 @@
       field.description = cProp.gnue_comment
 
       # map known types 
-      if SCHEMA_TYPES.has_key (cProp.gnue_type):
-        field.type        = SCHEMA_TYPES [cProp.gnue_type]
+      if cProp.gnue_type in self.SCHEMA_TYPES:
+        field.type        = cProp.gnue_type
         field.length      = int (cProp.gnue_length)
         field.precision   = int (cProp.gnue_scale)
 

Modified: trunk/gnue-appserver/src/language/Object.py
===================================================================
--- trunk/gnue-appserver/src/language/Object.py 2004-02-12 14:21:22 UTC (rev 
5099)
+++ trunk/gnue-appserver/src/language/Object.py 2004-02-12 14:24:22 UTC (rev 
5100)
@@ -53,6 +53,8 @@
   # -------------------------------------------------------------------------
   def __getattr__ (self, attr):
     name = self.__session.qualify (attr)
+    if name == "gnue_id":
+      return self.objectId
 
     if self.__attrIsMethod (name):
       return Procedure (self.__session, self.objectId, self.__class, name)





reply via email to

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