[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnue/geas lib/classdefs/classdata_database.h li...
From: |
Neil Tiffin |
Subject: |
gnue/geas lib/classdefs/classdata_database.h li... |
Date: |
Sat, 09 Jun 2001 08:20:37 -0700 |
CVSROOT: /home/cvs
Module name: gnue
Changes by: Neil Tiffin <address@hidden> 01/06/09 08:20:37
Modified files:
geas/lib/classdefs: classdata_database.h lparser.l
geas/lib/md5 : md5.c
geas/src : admin.h collectiondata.c connection.c
dataobject.c event_log_code.h geas-server.h
geas-skeleton.h security.c security.h
geas/src/objectstore: mysql.c
Log message:
Clean up compiler warnings and reformat some code to GNU standards.
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/classdata_database.h.diff?cvsroot=OldCVS&tr1=1.6&tr2=1.7&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/classdefs/lparser.l.diff?cvsroot=OldCVS&tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/lib/md5/md5.c.diff?cvsroot=OldCVS&tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/admin.h.diff?cvsroot=OldCVS&tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/collectiondata.c.diff?cvsroot=OldCVS&tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/connection.c.diff?cvsroot=OldCVS&tr1=1.59&tr2=1.60&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/dataobject.c.diff?cvsroot=OldCVS&tr1=1.54&tr2=1.55&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/event_log_code.h.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/geas-server.h.diff?cvsroot=OldCVS&tr1=1.44&tr2=1.45&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/geas-skeleton.h.diff?cvsroot=OldCVS&tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/security.c.diff?cvsroot=OldCVS&tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/security.h.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/geas/src/objectstore/mysql.c.diff?cvsroot=OldCVS&tr1=1.2&tr2=1.3&r1=text&r2=text
Patches:
Index: gnue/geas/lib/classdefs/classdata_database.h
diff -u gnue/geas/lib/classdefs/classdata_database.h:1.6
gnue/geas/lib/classdefs/classdata_database.h:1.7
--- gnue/geas/lib/classdefs/classdata_database.h:1.6 Tue Jun 5 14:42:07 2001
+++ gnue/geas/lib/classdefs/classdata_database.h Sat Jun 9 08:20:36 2001
@@ -1,5 +1,7 @@
/*
- geas - GNU Enterprise Application Server
+ classdata_database.h
+
+ Part of GNU Enterprise Application Server (GEAS)
Copyright (C) 2001 Free Software Foundation
@@ -17,6 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ $Id: classdata_database.h,v 1.7 2001/06/09 15:20:36 ntiffin Exp $
*/
/** \file classdata_database.h
@@ -44,63 +47,85 @@
typedef struct
{
- int type;
- char *name;
- enum odl_datatype datatype;
- char *format;
- gboolean notnull;
- GList *columns;
-} DBchange;
+ int type;
+ char *name;
+ enum odl_datatype datatype;
+ char *format;
+ gboolean notnull;
+ GList *columns;
+}
+DBchange;
typedef struct
{
- GList *adds;
- GList *removes;
-} DatabaseChange;
+ GList *adds;
+ GList *removes;
+}
+DatabaseChange;
typedef struct
{
- char *name;
- enum odl_datatype datatype; /* GEAS datatype to store in this column */
-} DatabaseColumn;
+ char *name;
+ enum odl_datatype datatype; /** \brief GEAS datatype to store in
this column */
+}
+DatabaseColumn;
typedef struct
{
- char *name;
- GList *columns;
-} DatabaseTable;
+ char *name;
+ GList *columns;
+}
+DatabaseTable;
typedef struct
{
- GList *tables;
- char *name;
-} DatabaseDefinition;
+ GList *tables;
+ char *name;
+}
+DatabaseDefinition;
+
+void show_database_definition (DatabaseDefinition * def);
+
+DatabaseDefinition *create_database_definition (const char *name);
+void free_database_definition (DatabaseDefinition * def);
+
+gboolean add_database_table (DatabaseDefinition * def,
+ const char *name);
+int count_database_tables (DatabaseDefinition * def);
+DatabaseTable *get_database_table (DatabaseDefinition * def,
+ int which);
+DatabaseTable *find_database_table (DatabaseDefinition * def,
+ const char *name);
+DatabaseColumn *add_database_column (DatabaseTable * table,
+ const char *name,
+ enum odl_fieldtype type);
+
+DatabaseChange *create_database_change (void);
+void free_database_change (DatabaseChange * change);
+
+/** \brief Add a table and get ptr to DBchange for adding column info. */
+DBchange *dbchange_add_table (DatabaseChange * dbchange,
+ const char *name);
+/** \brief Remove a table. */
+DBchange *dbchange_remove_table (DatabaseChange * dbchange,
+ const char *name);
+
+/** \brief add a column to/from a table. */
+DBchange *dbchange_add_column (DBchange * change,
+ const char *name,
+ enum odl_fieldtype fieldtype,
+ const char *format,
+ gboolean notnull);
+/** \brief Remove a column to/from a table. */
+DBchange *dbchange_remove_column (DBchange * change,
+ const char *name);
-void show_database_definition( DatabaseDefinition *def );
-
-DatabaseDefinition *create_database_definition( const char *name );
-void free_database_definition ( DatabaseDefinition *def );
-
-gboolean add_database_table ( DatabaseDefinition *def , const
char *name );
-int count_database_tables( DatabaseDefinition *def );
-DatabaseTable *get_database_table ( DatabaseDefinition *def , int which
);
-DatabaseTable *find_database_table ( DatabaseDefinition *def , const
char *name );
-DatabaseColumn *add_database_column ( DatabaseTable *table , const char
*name , enum odl_fieldtype type );
-
-DatabaseChange *create_database_change( void);
-void free_database_change ( DatabaseChange *change );
-
-/* add or remove a table. get ptr to DBchange for adding column info */
-DBchange *dbchange_add_table ( DatabaseChange *dbchange , const char *name );
-DBchange *dbchange_remove_table( DatabaseChange *dbchange , const char *name );
-
-/* add or remove a column to/from a table */
-DBchange *dbchange_add_column ( DBchange *change , const char *name , enum
odl_fieldtype fieldtype , const char *format , gboolean notnull );
-DBchange *dbchange_remove_column( DBchange *change , const char *name );
-
-/* scan a database definition and compare to the current class definitions */
+/** \brief Scan a database definition and compare to the current class
definitions. */
/* if there's a difference, produce a DatabaseChange object, which can be used
to make */
/* database specific commands to update the database definitions */
-DatabaseChange *compare_classes_to_database( odl_tree *tree , GList
*requiredclasses , DatabaseDefinition *database );
+DatabaseChange *compare_classes_to_database (odl_tree * tree,
+ GList * requiredclasses,
+ DatabaseDefinition *
+ database);
#endif
Index: gnue/geas/lib/classdefs/lparser.l
diff -u gnue/geas/lib/classdefs/lparser.l:1.25
gnue/geas/lib/classdefs/lparser.l:1.26
--- gnue/geas/lib/classdefs/lparser.l:1.25 Tue Jun 5 14:42:07 2001
+++ gnue/geas/lib/classdefs/lparser.l Sat Jun 9 08:20:36 2001
@@ -24,9 +24,10 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: lparser.l,v 1.25 2001/06/05 21:42:07 ntiffin Exp $
+ $Id: lparser.l,v 1.26 2001/06/09 15:20:36 ntiffin Exp $
*/
+#include "config.h"
#include <glib.h>
#include <string.h>
@@ -35,6 +36,7 @@
#include "gcdparser.h"
#include "classdata.h"
#include "yparser.h"
+#include "lparser.h"
unsigned int expecting_datatype = 1;
unsigned int expecting_fieldprop = 0;
@@ -98,7 +100,7 @@
#ifdef DEBUG
static void dump_filedata_struct(struct FileData * filedata_ptr);
-static void dump_file_stack(char * note);
+static void dump_file_stack(char * note) __attribute__ ((unused));
#endif
typedef char *charptr;
@@ -725,7 +727,7 @@
static int
file_processed (const char *filename)
{
- int i;
+ unsigned int i;
/* empty list? */
if (processed_files == NULL)
@@ -749,7 +751,7 @@
void
clear_file_history (void)
{
- int i;
+ unsigned int i;
g_assert (processed_files);
if (processed_files == NULL)
{
Index: gnue/geas/lib/md5/md5.c
diff -u gnue/geas/lib/md5/md5.c:1.1 gnue/geas/lib/md5/md5.c:1.2
--- gnue/geas/lib/md5/md5.c:1.1 Thu Dec 21 20:27:40 2000
+++ gnue/geas/lib/md5/md5.c Sat Jun 9 08:20:36 2001
@@ -16,7 +16,10 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ $Id: md5.c,v 1.2 2001/06/09 15:20:36 ntiffin Exp $
+
+ */
/* Written by Ulrich Drepper <address@hidden>, 1995. */
@@ -25,6 +28,7 @@
#endif
#include <sys/types.h>
+#include <string.h>
#if STDC_HEADERS || defined _LIBC
# include <stdlib.h>
Index: gnue/geas/src/admin.h
diff -u gnue/geas/src/admin.h:1.3 gnue/geas/src/admin.h:1.4
--- gnue/geas/src/admin.h:1.3 Fri Jan 12 17:37:16 2001
+++ gnue/geas/src/admin.h Sat Jun 9 08:20:37 2001
@@ -1,6 +1,8 @@
/*
- geas - GNU Enterprise Application Server
+ admin.h
+
+ Part of GNU Enterprise Application Server (GEAS)
Copyright (C) 2000 Free Software Foundation
@@ -17,7 +19,8 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
+
+ $Id: admin.h,v 1.4 2001/06/09 15:20:37 ntiffin Exp $
*/
#ifndef ADMIN_H
@@ -25,17 +28,17 @@
#include "geas-skeleton.h"
-CORBA_long Admin__get_debuglevel(GEAS_object_reference * id,
- CORBA_Environment * ev);
-void Admin__set_debuglevel(GEAS_object_reference * id, int value,
- CORBA_Environment * ev);
+CORBA_long Admin__get_debuglevel (GEAS_object_reference * id,
+ CORBA_Environment * ev);
+void Admin__set_debuglevel (GEAS_object_reference * id, int value,
+ CORBA_Environment * ev);
-CORBA_boolean Admin__get_verbose(GEAS_object_reference * id,
- CORBA_Environment * ev);
-void Admin__set_verbose(GEAS_object_reference * id, CORBA_boolean value,
- CORBA_Environment * ev);
+CORBA_boolean Admin__get_verbose (GEAS_object_reference * id,
+ CORBA_Environment * ev);
+void Admin__set_verbose (GEAS_object_reference * id, CORBA_boolean value,
+ CORBA_Environment * ev);
-void Admin_restart(GEAS_object_reference * id, CORBA_Environment * ev);
-void Admin_shutdown(GEAS_object_reference * id, CORBA_Environment * ev);
+void Admin_restart (GEAS_object_reference * id, CORBA_Environment * ev);
+void Admin_shutdown (GEAS_object_reference * id, CORBA_Environment * ev);
#endif
Index: gnue/geas/src/collectiondata.c
diff -u gnue/geas/src/collectiondata.c:1.20 gnue/geas/src/collectiondata.c:1.21
--- gnue/geas/src/collectiondata.c:1.20 Sat Jun 9 06:35:12 2001
+++ gnue/geas/src/collectiondata.c Sat Jun 9 08:20:37 2001
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: collectiondata.c,v 1.20 2001/06/09 13:35:12 reinhard Exp $
+ $Id: collectiondata.c,v 1.21 2001/06/09 15:20:37 ntiffin Exp $
*/
@@ -41,9 +41,9 @@
}
ObjectCollection_t;
-static GList *object_collections = NULL;
+/* static GList *object_collections = NULL; */
-static ObjectCollection_t *allocate_object_collection ();
+static ObjectCollection_t *allocate_object_collection (void);
#ifndef MAX
#define MAX(a,b) ( (a) > (b) ? (a) : (b) )
@@ -62,7 +62,9 @@
GEAS_DataObject lst;
struct query_result *result;
char *errmsg;
- int err, i, idx;
+ int err;
+ unsigned int i;
+ int idx;
char *classname;
char buf[64];
char *listid;
Index: gnue/geas/src/connection.c
diff -u gnue/geas/src/connection.c:1.59 gnue/geas/src/connection.c:1.60
--- gnue/geas/src/connection.c:1.59 Fri Jun 8 15:42:42 2001
+++ gnue/geas/src/connection.c Sat Jun 9 08:20:37 2001
@@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: connection.c,v 1.59 2001/06/08 22:42:42 reinhard Exp $
+ $Id: connection.c,v 1.60 2001/06/09 15:20:37 ntiffin Exp $
*/
@@ -664,7 +664,7 @@
CORBA_Environment * ev)
{
oql_constraint *parent = c;
- enum oql_logic logic = oql_and;
+ /* enum oql_logic logic = oql_and; */
GEAS_ObjectList list = CORBA_OBJECT_NIL;
GEAS_DataObject obj = CORBA_OBJECT_NIL;
int len = 0, ii = 0;
Index: gnue/geas/src/dataobject.c
diff -u gnue/geas/src/dataobject.c:1.54 gnue/geas/src/dataobject.c:1.55
--- gnue/geas/src/dataobject.c:1.54 Fri Jun 8 15:42:42 2001
+++ gnue/geas/src/dataobject.c Sat Jun 9 08:20:37 2001
@@ -20,7 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: dataobject.c,v 1.54 2001/06/08 22:42:42 reinhard Exp $
+ $Id: dataobject.c,v 1.55 2001/06/09 15:20:37 ntiffin Exp $
*/
@@ -51,977 +51,1088 @@
/* raises: */
GEAS_ObjectReference
-DataObject__get_objectID(GEAS_object_reference * id, CORBA_Environment * ev)
- {
- return( (GEAS_ObjectReference)DataObject_getField(id,"objectid",ev) );
- }
+DataObject__get_objectID (GEAS_object_reference * id, CORBA_Environment * ev)
+{
+ return ((GEAS_ObjectReference) DataObject_getField (id, "objectid", ev));
+}
/* raises: */
CORBA_boolean
-DataObject_ofclass(GEAS_object_reference * id, CORBA_char * classname,
- CORBA_Environment * ev)
- {
- CORBA_boolean retval = CORBA_FALSE;
- odl_class *cl;
-
- cl = odl_find_class( all_classes , id->classname , NULL );
- if( !cl ) return( CORBA_FALSE );
+DataObject_ofclass (GEAS_object_reference * id, CORBA_char * classname,
+ CORBA_Environment * ev)
+{
+ CORBA_boolean retval = CORBA_FALSE;
+ odl_class *cl;
- if( odl_class_is_instanceof(cl,classname) ) retval = CORBA_TRUE;
- else retval = CORBA_FALSE;
+ cl = odl_find_class (all_classes, id->classname, NULL);
+ if (!cl)
+ return (CORBA_FALSE);
+
+ if (odl_class_is_instanceof (cl, classname))
+ retval = CORBA_TRUE;
+ else
+ retval = CORBA_FALSE;
- return (retval);
- }
+ return (retval);
+}
/* raises: */
CORBA_char *
-DataObject__get_classname(GEAS_object_reference * id, CORBA_Environment * ev)
- {
- CORBA_char *retval = CORBA_string_dup(id->classname);
- return (retval);
- }
+DataObject__get_classname (GEAS_object_reference * id, CORBA_Environment * ev)
+{
+ CORBA_char *retval = CORBA_string_dup (id->classname);
+ return (retval);
+}
/* raises: */
GEAS_classnames *
-DataObject__get_classes(GEAS_object_reference * id, CORBA_Environment * ev)
- {
- GEAS_classnames *retval = NULL;
- odl_class *c;
- GList *parents,*l;
- int count,i;
- g_assert( id != NULL );
- g_assert( ev != NULL );
-
- c = odl_find_class( all_classes , id->classname , NULL );
- if( !c )
- {
- return(NULL);
- }
- retval = GEAS_classnames__alloc();
- CORBA_sequence_set_release(retval, CORBA_TRUE);
- if( !retval )
- return( NULL );
-
- /* get list of parent classes */
- parents = odl_class_get_parentnames( c );
- count = g_list_length( parents );
-printf( "count = %d\n" , count );
- /* store data to return */
- retval->_maximum = (count+1);
- retval->_length = (count+1);
- retval->_buffer = CORBA_sequence_CORBA_string_allocbuf(count + 1);
- retval->_buffer[0] = CORBA_string_dup( id->classname );
-printf( "%s\n" , retval->_buffer[0] );
- /* if there were any parent classes, record their name too */
- l = parents;
- i = 1;
- while( l )
- {
- retval->_buffer[i] = CORBA_string_dup( l->data );
-printf( "%s\n" , retval->_buffer[i] );
- i++;
- l = g_list_next( l );
- }
- if( parents )
- g_list_free( parents );
+DataObject__get_classes (GEAS_object_reference * id, CORBA_Environment * ev)
+{
+ GEAS_classnames *retval = NULL;
+ odl_class *c;
+ GList *parents, *l;
+ int count, i;
+ g_assert (id != NULL);
+ g_assert (ev != NULL);
+
+ c = odl_find_class (all_classes, id->classname, NULL);
+ if (!c)
+ {
+ return (NULL);
+ }
+ retval = GEAS_classnames__alloc ();
+ CORBA_sequence_set_release (retval, CORBA_TRUE);
+ if (!retval)
+ return (NULL);
+
+ /* get list of parent classes */
+ parents = odl_class_get_parentnames (c);
+ count = g_list_length (parents);
+ printf ("count = %d\n", count);
+ /* store data to return */
+ retval->_maximum = (count + 1);
+ retval->_length = (count + 1);
+ retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (count + 1);
+ retval->_buffer[0] = CORBA_string_dup (id->classname);
+ printf ("%s\n", retval->_buffer[0]);
+ /* if there were any parent classes, record their name too */
+ l = parents;
+ i = 1;
+ while (l)
+ {
+ retval->_buffer[i] = CORBA_string_dup (l->data);
+ printf ("%s\n", retval->_buffer[i]);
+ i++;
+ l = g_list_next (l);
+ }
+ if (parents)
+ g_list_free (parents);
- return (retval);
- }
+ return (retval);
+}
/* raises: */
GEAS_fieldlist *
-DataObject__get_allfields(GEAS_object_reference * id, CORBA_Environment * ev)
- {
- return( schema_get_fields(id,id->classname,TRUE,ev) );
- }
+DataObject__get_allfields (GEAS_object_reference * id, CORBA_Environment * ev)
+{
+ return (schema_get_fields (id, id->classname, TRUE, ev));
+}
/* raises: UnknownField, NotLookupField, Interrupted, ServerError, Locked,
TransactionNotInProgress */
GEAS_LookupOptions *
-DataObject_getLookupFieldOptions(GEAS_object_reference * id, char *field,
- CORBA_Environment * ev)
- {
- /* Note: in the proposed security system, the Connection class's mehtod
- * will believe it's been called directly by the current user, so can
- * do appropriate security checks there as well */
- return(
GEAS_Connection_getLookupFieldOptions(id->server,id->classname,field,ev) );
- }
+DataObject_getLookupFieldOptions (GEAS_object_reference * id, char *field,
+ CORBA_Environment * ev)
+{
+ /* Note: in the proposed security system, the Connection class's mehtod
+ * will believe it's been called directly by the current user, so can
+ * do appropriate security checks there as well */
+ return (GEAS_Connection_getLookupFieldOptions
+ (id->server, id->classname, field, ev));
+}
/* raises: UnknownField, NotWriteable, Interrupted, ServerError, Locked,
TransactionNotInProgress */
void
-DataObject_setLookupField(GEAS_object_reference * id,
- GEAS_LookupOption * setting, CORBA_Environment * ev)
- {
- int i;
- GEAS_setlookuplist *list;
-
- /* TODO */
- list = &setting->setdata;
-
- for( i=0 ; i<list->_length ; i++ )
- {
- DataObject_setField( id , list->_buffer[i].field ,
list->_buffer[i].value , ev );
- if (ev->_major != CORBA_NO_EXCEPTION)
- return;
- }
- }
+DataObject_setLookupField (GEAS_object_reference * id,
+ GEAS_LookupOption * setting,
+ CORBA_Environment * ev)
+{
+ unsigned int i;
+ GEAS_setlookuplist *list;
+
+ /* TODO */
+ list = &setting->setdata;
+ for (i = 0; i < list->_length; i++)
+ {
+ DataObject_setField (id, list->_buffer[i].field, list->_buffer[i].value,
+ ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ {
+ return;
+
+ }
+ }
+}
+
/* raises: UnknownField, NotReadable, Interrupted, NullField, ServerError,
NotDataField, Locked, TransactionNotInProgress */
CORBA_char *
-DataObject_getField(GEAS_object_reference * id, CORBA_char * fieldname,
- CORBA_Environment * ev)
- {
- CORBA_char *retval = NULL;
- ObjectData *obj;
- odl_class *cl;
- odl_field *f;
- /* int err; */
+DataObject_getField (GEAS_object_reference * id, CORBA_char * fieldname,
+ CORBA_Environment * ev)
+{
+ CORBA_char *retval = NULL;
+ ObjectData *obj;
+ odl_class *cl;
+ odl_field *f;
+ /* int err; */
- trace_functioncall();
+ trace_functioncall ();
/* printf( "get %s.%s" , id->classname , fieldname ); */
- /* which class are we interested in? */
- if( strcasecmp(fieldname,"objectid") == 0 )
- return( CORBA_string_dup(id->objectid) );
-
- cl = odl_find_class(all_classes, id->classname , NULL );
- if (!cl)
- {
+ /* which class are we interested in? */
+ if (strcasecmp (fieldname, "objectid") == 0)
+ return (CORBA_string_dup (id->objectid));
+
+ cl = odl_find_class (all_classes, id->classname, NULL);
+ if (!cl)
+ {
/* should never happen */
- make_ServerError_exception(ev, "Unknown class %s", id->classname);
+ make_ServerError_exception (ev, "Unknown class %s", id->classname);
+ return (NULL);
+ }
+
+ cl = odl_field_defined_in (cl, fieldname);
+ if (!cl)
+ {
+ make_UnknownField_exception (ev,
+ "Field '%s' is not defined in class '%s'",
+ fieldname, id->classname);
+ return (NULL);
+ }
+
+ f = odl_class_get_field (cl, fieldname);
+ switch (odl_field_get_type (f))
+ {
+ case FT_basic:
+ case FT_lookup:
+ /* normal fields, handled by cache */
+ break;
+
+ case FT_reference:
+ case FT_list:
+ make_NotDataField_exception (ev,
+ "Field '%s' is not a plain data field.",
+ fieldname);
+ return (NULL);
+
+ case FT_method:
+ case FT_calculated:
+ case FT_readonly:
+ make_ServerError_exception (ev,
+ "Field '%s' has an unsupported type
identifier (%s).",
+ fieldname,
+ odl_fieldtype_name (odl_field_get_type
+ (f)));
return (NULL);
- }
- cl = odl_field_defined_in(cl, fieldname);
- if (!cl)
- {
- make_UnknownField_exception(ev,
- "Field '%s' is not defined in class '%s'",
- fieldname, id->classname);
+ case FT_unknown:
+ make_ServerError_exception (ev,
+ "Field '%s' has an unknown type identifier.",
+ fieldname);
return (NULL);
- }
+ }
- f = odl_class_get_field( cl , fieldname );
- switch( odl_field_get_type(f) )
- {
- case FT_basic:
- case FT_lookup:
- /* normal fields, handled by cache */
- break;
-
- case FT_reference:
- case FT_list:
- make_NotDataField_exception(ev,"Field '%s' is not a plain data
field.",fieldname);
- return( NULL );
-
- case FT_method:
- case FT_calculated:
- case FT_readonly:
- make_ServerError_exception(ev,"Field '%s' has an unsupported type
identifier (%s).",fieldname, odl_fieldtype_name(odl_field_get_type(f)) );
- return( NULL );
-
- case FT_unknown:
- make_ServerError_exception(ev,"Field '%s' has an unknown type
identifier.",fieldname);
- return( NULL );
- }
-
- /* find object in cache, and get field */
- /* printf( "looking for %s/%s\n" , odl_class_get_full_name(cl),
id->objectid ); */
- /* don't log GEAS classes */
- if( allow_log_class_event(odl_class_get_full_name(cl)) )
- dm_event( id->username , id->currenttransaction , DM_EVENT_FIELD_READ ,
odl_class_get_full_name(cl) , id->objectid , fieldname );
- obj = oc_find_object_by_key(odl_class_get_full_name(cl), id->objectid);
- if (obj)
- {
- retval = (char *)oc_get_object_field(obj, fieldname);
+ /* find object in cache, and get field */
+ /* printf( "looking for %s/%s\n" , odl_class_get_full_name(cl), id->objectid
); */
+ /* don't log GEAS classes */
+ if (allow_log_class_event (odl_class_get_full_name (cl)))
+ dm_event (id->username, id->currenttransaction, DM_EVENT_FIELD_READ,
+ odl_class_get_full_name (cl), id->objectid, fieldname);
+ obj = oc_find_object_by_key (odl_class_get_full_name (cl), id->objectid);
+ if (obj)
+ {
+ retval = (char *) oc_get_object_field (obj, fieldname);
if (retval)
- {
- char *t = CORBA_string_dup(retval);
- g_free( retval );
- retval = t;
- }
+ {
+ char *t = CORBA_string_dup (retval);
+ g_free (retval);
+ retval = t;
+ }
else
- {
- retval = CORBA_string_dup("");
- /* make_NullField_exception(ev, "No data in field %s.%s" ,
id->classname , fieldname ); */
- }
- }
- else
- {
+ {
+ retval = CORBA_string_dup ("");
+ /* make_NullField_exception(ev, "No data in field %s.%s" ,
id->classname , fieldname ); */
+ }
+ }
+ else
+ {
/* this should, in theory, be impossible */
- make_ServerError_exception(ev,
- "1 Impossible error: object went missing.
(%s/%s)",id->classname,id->objectid);
- errormsg("Impossible error: object %s/%s went
missing.",id->classname,id->objectid);
- }
-
- /* message( "returning '%s'" , retval ); */
- /* if( ev->_major != CORBA_NO_EXCEPTION ) message( "exception: %s\n" ,
- CORBA_exception_id(ev) ); */
- return (retval);
- }
+ make_ServerError_exception (ev,
+ "1 Impossible error: object went missing.
(%s/%s)",
+ id->classname, id->objectid);
+ errormsg ("Impossible error: object %s/%s went missing.", id->classname,
+ id->objectid);
+ }
+
+ /* message( "returning '%s'" , retval ); */
+ /* if( ev->_major != CORBA_NO_EXCEPTION ) message( "exception: %s\n" ,
+ CORBA_exception_id(ev) ); */
+ return (retval);
+}
/* raises: UnknownField, NotWriteable, Interrupted, ServerError, NotDataField,
Locked, TransactionNotInProgress, Format */
void
-DataObject_setField(GEAS_object_reference * id, CORBA_char * fieldname,
- CORBA_char * value, CORBA_Environment * ev)
- {
- ObjectData *obj;
- odl_class *cl;
- odl_field *f;
-
- /* message( "\n%s/%s.%s = %s" , id->classname , id->objectid , fieldname ,
value ); */
- /* which class are we interested in? */
- cl = odl_find_class(all_classes, id->classname , NULL );
- if (!cl)
- {
- make_ServerError_exception(ev, "Unknown class %s", id->classname);
- return ;
- }
- cl = odl_field_defined_in(cl, fieldname);
- if (!cl)
- {
- make_UnknownField_exception(ev,
- "Field '%s' is not defined in class '%s'",
- fieldname, id->classname);
- return ;
- }
-
- f = odl_class_get_field( cl , fieldname );
- switch( odl_field_get_type(f) )
- {
- case FT_basic:
- /* normal fields, handled by cache */
- if( odl_field_has_property(f,ODL_PROP_READONLY) )
- {
- make_NotWriteable_exception(ev,"Field '%s' is not writeable." ,
fieldname );
- return;
- }
- break;
-
- case FT_reference:
- case FT_list:
- make_NotDataField_exception(ev,"Field '%s' is not a plain data
field.",fieldname);
- return;
-
- case FT_lookup:
- case FT_method:
- case FT_calculated:
- case FT_readonly:
- make_NotWriteable_exception(ev,"Field '%s' is not writeable." ,
fieldname );
- return;
-
- case FT_unknown:
- make_ServerError_exception(ev,"Field '%s' has an unknown type
identifier.",fieldname);
- return;
- }
-
- /* find object in cache, and get field */
- obj = oc_find_object_by_key( odl_class_get_full_name(cl), id->objectid);
- if (obj)
- {
- if( allow_log_class_event(odl_class_get_full_name(cl)) )
- dm_event( id->username , id->currenttransaction ,
DM_EVENT_FIELD_WRITE , odl_class_get_full_name(cl) , id->objectid , fieldname ,
value );
+DataObject_setField (GEAS_object_reference * id, CORBA_char * fieldname,
+ CORBA_char * value, CORBA_Environment * ev)
+{
+ ObjectData *obj;
+ odl_class *cl;
+ odl_field *f;
+
+ /* message( "\n%s/%s.%s = %s" , id->classname , id->objectid , fieldname ,
value ); */
+ /* which class are we interested in? */
+ cl = odl_find_class (all_classes, id->classname, NULL);
+ if (!cl)
+ {
+ make_ServerError_exception (ev, "Unknown class %s", id->classname);
+ return;
+ }
+ cl = odl_field_defined_in (cl, fieldname);
+ if (!cl)
+ {
+ make_UnknownField_exception (ev,
+ "Field '%s' is not defined in class '%s'",
+ fieldname, id->classname);
+ return;
+ }
+
+ f = odl_class_get_field (cl, fieldname);
+ switch (odl_field_get_type (f))
+ {
+ case FT_basic:
+ /* normal fields, handled by cache */
+ if (odl_field_has_property (f, ODL_PROP_READONLY))
+ {
+ make_NotWriteable_exception (ev, "Field '%s' is not writeable.",
+ fieldname);
+ return;
+ }
+ break;
+
+ case FT_reference:
+ case FT_list:
+ make_NotDataField_exception (ev,
+ "Field '%s' is not a plain data field.",
+ fieldname);
+ return;
+
+ case FT_lookup:
+ case FT_method:
+ case FT_calculated:
+ case FT_readonly:
+ make_NotWriteable_exception (ev, "Field '%s' is not writeable.",
+ fieldname);
+ return;
+
+ case FT_unknown:
+ make_ServerError_exception (ev,
+ "Field '%s' has an unknown type identifier.",
+ fieldname);
+ return;
+ }
+
+ /* find object in cache, and get field */
+ obj = oc_find_object_by_key (odl_class_get_full_name (cl), id->objectid);
+ if (obj)
+ {
+ if (allow_log_class_event (odl_class_get_full_name (cl)))
+ dm_event (id->username, id->currenttransaction, DM_EVENT_FIELD_WRITE,
+ odl_class_get_full_name (cl), id->objectid, fieldname,
+ value);
/* check the datatype being set */
- switch( odl_field_get_datatype(f) )
- {
- case DT_char:
- case DT_text:
- /* accept without validation */
- break;
- case DT_int:
- case DT_unsignedint:
- /* validate an integer */
- {
- int i;
- for( i=0 ; i<strlen(value) ; i++ )
- if( isdigit(value[i]) == 0 || (i==0 && (value[0] == '-' ||
value[0] == '-')) )
- {
- make_Format_exception(ev,"Expected an integer.");
- return;
- }
- if( odl_field_get_datatype(f) == DT_unsignedint && value[0]
== '-' )
- {
- make_Format_exception(ev,"Expected an unsigned
integer.");
- return;
- }
- }
- break;
- case DT_bool:
- /* andrew murie: I'ld like to take this opportunity to say that
- defining a boolean like this just really isn't bright
- and it wasn't my decision.
-
- encouraging code like this is bad:
- if( strcmp(value,"T") == 0 || strcmp(value,"0")==0 ) ... ;
- */
- if( g_strcasecmp(value,"-1") == 0 ) value[0] = 'F';
- value[0] = toupper(value[0]);
- value[1] = '\0';
- if( g_strcasecmp(value,"T") == 0 ) ;
- else if( g_strcasecmp(value,"F") == 0 ) ;
- else if( g_strcasecmp(value,"1") == 0 ) value[0] = 'T';
- else if( g_strcasecmp(value,"0") == 0 ) value[0] = 'F';
- else if( g_strcasecmp(value,"Y") == 0 ) value[0] = 'T';
- else if( g_strcasecmp(value,"N") == 0 ) value[0] = 'F';
- else
- {
- make_Format_exception(ev,"Expected 'TRUE' or 'FALSE' or 'T'
or 't' or 'F' or 'f' or '0' or '1' or '-1' or 'YES' or 'Y' or 'NO' or 'N'");
- return;
- }
- if( value[0] == 'T' ) value[0] = '1';
- if( value[0] == 'F' ) value[0] = '0';
- break;
- case DT_float:
- {
- char *end = NULL;
- strtod(value,&end);
- if( end == value )
- make_Format_exception(ev,"Floating point number expected
(eg -123.45 or 123.45)");
- }
- break;
- case DT_date:
- /* make sure the date is in the correct format (YYYY-MM-DD) */
- /* 'value' is a NULL terminated string containing the date */
- break;
- case DT_time:
- /* make sure the time is in the correct format (HH:MM:SS) */
- break;
- case DT_datetime:
- /* make sure the time is in the correct format (YYYY-MM-DD
HH:MM:SS) */
- break;
- default:
- /* accept anything else */
- break;
- }
-
- if (oc_set_object_field(obj, fieldname, value,FALSE) == FALSE)
- {
- make_ServerError_exception(ev, "Write failure.");
- }
+ switch (odl_field_get_datatype (f))
+ {
+ case DT_char:
+ case DT_text:
+ /* accept without validation */
+ break;
+ case DT_int:
+ case DT_unsignedint:
+ /* validate an integer */
+ {
+ unsigned int i;
+ for (i = 0; i < strlen (value); i++)
+ if (isdigit (value[i]) == 0
+ || (i == 0 && (value[0] == '-' || value[0] == '-')))
+ {
+ make_Format_exception (ev, "Expected an integer.");
+ return;
+ }
+ if (odl_field_get_datatype (f) == DT_unsignedint
+ && value[0] == '-')
+ {
+ make_Format_exception (ev, "Expected an unsigned integer.");
+ return;
+ }
+ }
+ break;
+ case DT_bool:
+ /* andrew murie: I'ld like to take this opportunity to say that
+ defining a boolean like this just really isn't bright
+ and it wasn't my decision.
+
+ encouraging code like this is bad:
+ if( strcmp(value,"T") == 0 || strcmp(value,"0")==0 ) ... ;
+ */
+ if (g_strcasecmp (value, "-1") == 0)
+ value[0] = 'F';
+ value[0] = toupper (value[0]);
+ value[1] = '\0';
+ if (g_strcasecmp (value, "T") == 0);
+ else if (g_strcasecmp (value, "F") == 0);
+ else if (g_strcasecmp (value, "1") == 0)
+ value[0] = 'T';
+ else if (g_strcasecmp (value, "0") == 0)
+ value[0] = 'F';
+ else if (g_strcasecmp (value, "Y") == 0)
+ value[0] = 'T';
+ else if (g_strcasecmp (value, "N") == 0)
+ value[0] = 'F';
+ else
+ {
+ make_Format_exception (ev,
+ "Expected 'TRUE' or 'FALSE' or 'T' or 't'
or 'F' or 'f' or '0' or '1' or '-1' or 'YES' or 'Y' or 'NO' or 'N'");
+ return;
+ }
+ if (value[0] == 'T')
+ value[0] = '1';
+ if (value[0] == 'F')
+ value[0] = '0';
+ break;
+ case DT_float:
+ {
+ char *end = NULL;
+ strtod (value, &end);
+ if (end == value)
+ make_Format_exception (ev,
+ "Floating point number expected (eg
-123.45 or 123.45)");
+ }
+ break;
+ case DT_date:
+ /* make sure the date is in the correct format (YYYY-MM-DD) */
+ /* 'value' is a NULL terminated string containing the date */
+ break;
+ case DT_time:
+ /* make sure the time is in the correct format (HH:MM:SS) */
+ break;
+ case DT_datetime:
+ /* make sure the time is in the correct format (YYYY-MM-DD HH:MM:SS)
*/
+ break;
+ default:
+ /* accept anything else */
+ break;
+ }
+
+ if (oc_set_object_field (obj, fieldname, value, FALSE) == FALSE)
+ {
+ make_ServerError_exception (ev, "Write failure.");
+ }
else
- {
- /* immediately write it to the database */
- /* message( "attempting write" ); */
- Connection_logEdit( id->classname , id->objectid , fieldname , id );
- oc_flush_object_to_store(obj);
- }
- }
- else
- {
+ {
+ /* immediately write it to the database */
+ /* message( "attempting write" ); */
+ Connection_logEdit (id->classname, id->objectid, fieldname, id);
+ oc_flush_object_to_store (obj);
+ }
+ }
+ else
+ {
/* this should, in theory, be impossible */
- make_ServerError_exception(ev,
- "2 Impossible error: object went missing.
(%s/%s)",id->classname,id->objectid);
- errormsg("Impossible error: object went missing.");
- }
- }
+ make_ServerError_exception (ev,
+ "2 Impossible error: object went missing.
(%s/%s)",
+ id->classname, id->objectid);
+ errormsg ("Impossible error: object went missing.");
+ }
+}
/* raises: UnknownField, NotReferenceField, Interrupted, ServerError, Locked,
TransactionNotInProgress */
GEAS_DataObject
-DataObject_getReference(GEAS_object_reference * id, CORBA_char * field,
- CORBA_Environment * ev)
- {
- GList *s,*t;
- char *value;
- /* char *targetfield; */
- odl_class *cl,*c;
- odl_field *f;
- char *loadclass;
- QueryData *q;
- ObjectData *o;
- char *keystr;
- int idfield;
- GEAS_DataObject retval = CORBA_OBJECT_NIL;
- struct query_result *result;
- int err;
- char *errmsg;
-
- /* find and validate the field */
- cl = odl_find_class( all_classes , id->classname , NULL );
- if( !cl )
- {
- make_ServerError_exception( ev , "Class '%s' has gone away" ,
id->classname );
- return( CORBA_OBJECT_NIL );
- }
- f = odl_class_get_field( cl , field );
- if( !f )
- {
- make_UnknownField_exception( ev , "Field '%s' is not defined in
class '%s'" , field , id->classname );
- return( CORBA_OBJECT_NIL );
- }
- if( odl_field_get_type(f) != FT_reference )
- {
- make_WrongType_exception( ev , "Field '%s' in class '%s' is not a
reference field." , field , id->classname );
- return( CORBA_OBJECT_NIL );
- }
- loadclass = (char *)odl_field_get_sourceclass( f );
-
- /* create query */
- q = create_base_query (loadclass);
- if (!q)
- {
- make_ServerError_exception(ev, "Could not create query");
- return (CORBA_OBJECT_NIL);
- }
-
- /* add constraints to find just members of this list */
- /* ... WHERE loadclass.t1 = this.s1 AND loadclass.t2 = this.s2 ... */
-
- s = odl_field_get_this_fields( f );
- t = odl_field_get_source_fields( f );
- while( s && t )
- {
- /* value = this.(s->data) */
- /* note: inheritance has to be considered as well */
- c = odl_field_defined_in( cl , (const char *)s->data );
- if( !c )
- {
- make_ServerError_exception( ev , "Reference requires field %s,
but this is not defined in class %s" , s->data , id->classname );
- oql_free_query( q );
- return( CORBA_OBJECT_NIL );
- }
- o = oc_find_object_by_key( odl_class_get_full_name(c) , id->objectid
);
- if( !o )
- {
- make_ServerError_exception( ev , "Reference requires field
%s.%s, but this could not be found in the database" , id->classname , s->data );
- oql_free_query( q );
- return( CORBA_OBJECT_NIL );
- }
- value = (char *)oc_get_object_field( o , s->data );
- if( !value )
- value = g_strdup( "" );
-
- /* add constraint to query */
- if( !oql_add_query_constraint(q,id->classname,(const char
*)value,"=",loadclass,(const char *)t->data) )
- {
- oql_free_query( q );
- make_ServerError_exception( ev , "Error making query." );
- g_free( value );
- return( CORBA_OBJECT_NIL );
- }
- g_free( value );
- s = g_list_next( s );
- t = g_list_next( t );
- }
- if( s != NULL || t != NULL )
- {
- oql_free_query( q );
- make_ServerError_exception( ev , "Mismatch in field definition for
%s.%s" , id->classname , field );
- return( CORBA_OBJECT_NIL );
- }
- /* perform query */
- result = query_objectstore( q , &err , &errmsg );
- if( errmsg )
- {
- if( result ) free_query_result( result );
- make_ServerError_exception(ev,errmsg);
- errormsg( errmsg );
- g_free( errmsg );
- return( CORBA_OBJECT_NIL );
- }
- if( !result )
- {
- oql_free_query(q);
- make_ServerError_exception(ev,"Error locating object");
- return( CORBA_OBJECT_NIL );
- }
-
- /* create DataObject reference */
- idfield = oql_query_get_field_position( q , "objectid" );
- keystr = (char *)get_result_field(result,0,idfield);
- retval = (GEAS_DataObject)
make_dataobject_reference(loadclass,keystr,id->username,id->sessionid,ev);
- oql_free_query(q);
- if( result ) free_query_result( result );
- return retval;
- }
+DataObject_getReference (GEAS_object_reference * id, CORBA_char * field,
+ CORBA_Environment * ev)
+{
+ GList *s, *t;
+ char *value;
+ /* char *targetfield; */
+ odl_class *cl, *c;
+ odl_field *f;
+ char *loadclass;
+ QueryData *q;
+ ObjectData *o;
+ char *keystr;
+ int idfield;
+ GEAS_DataObject retval = CORBA_OBJECT_NIL;
+ struct query_result *result;
+ int err;
+ char *errmsg;
+
+ /* find and validate the field */
+ cl = odl_find_class (all_classes, id->classname, NULL);
+ if (!cl)
+ {
+ make_ServerError_exception (ev, "Class '%s' has gone away",
+ id->classname);
+ return (CORBA_OBJECT_NIL);
+ }
+ f = odl_class_get_field (cl, field);
+ if (!f)
+ {
+ make_UnknownField_exception (ev,
+ "Field '%s' is not defined in class '%s'",
+ field, id->classname);
+ return (CORBA_OBJECT_NIL);
+ }
+ if (odl_field_get_type (f) != FT_reference)
+ {
+ make_WrongType_exception (ev,
+ "Field '%s' in class '%s' is not a reference
field.",
+ field, id->classname);
+ return (CORBA_OBJECT_NIL);
+ }
+ loadclass = (char *) odl_field_get_sourceclass (f);
+
+ /* create query */
+ q = create_base_query (loadclass);
+ if (!q)
+ {
+ make_ServerError_exception (ev, "Could not create query");
+ return (CORBA_OBJECT_NIL);
+ }
+ /* add constraints to find just members of this list */
+ /* ... WHERE loadclass.t1 = this.s1 AND loadclass.t2 = this.s2 ... */
+
+ s = odl_field_get_this_fields (f);
+ t = odl_field_get_source_fields (f);
+ while (s && t)
+ {
+ /* value = this.(s->data) */
+ /* note: inheritance has to be considered as well */
+ c = odl_field_defined_in (cl, (const char *) s->data);
+ if (!c)
+ {
+ make_ServerError_exception (ev,
+ "Reference requires field %s, but this
is not defined in class %s",
+ s->data, id->classname);
+ oql_free_query (q);
+ return (CORBA_OBJECT_NIL);
+ }
+ o = oc_find_object_by_key (odl_class_get_full_name (c), id->objectid);
+ if (!o)
+ {
+ make_ServerError_exception (ev,
+ "Reference requires field %s.%s, but
this could not be found in the database",
+ id->classname, s->data);
+ oql_free_query (q);
+ return (CORBA_OBJECT_NIL);
+ }
+ value = (char *) oc_get_object_field (o, s->data);
+ if (!value)
+ value = g_strdup ("");
+
+ /* add constraint to query */
+ if (!oql_add_query_constraint
+ (q, id->classname, (const char *) value, "=", loadclass,
+ (const char *) t->data))
+ {
+ oql_free_query (q);
+ make_ServerError_exception (ev, "Error making query.");
+ g_free (value);
+ return (CORBA_OBJECT_NIL);
+ }
+ g_free (value);
+ s = g_list_next (s);
+ t = g_list_next (t);
+ }
+ if (s != NULL || t != NULL)
+ {
+ oql_free_query (q);
+ make_ServerError_exception (ev,
+ "Mismatch in field definition for %s.%s",
+ id->classname, field);
+ return (CORBA_OBJECT_NIL);
+ }
+ /* perform query */
+ result = query_objectstore (q, &err, &errmsg);
+ if (errmsg)
+ {
+ if (result)
+ free_query_result (result);
+ make_ServerError_exception (ev, errmsg);
+ errormsg (errmsg);
+ g_free (errmsg);
+ return (CORBA_OBJECT_NIL);
+ }
+ if (!result)
+ {
+ oql_free_query (q);
+ make_ServerError_exception (ev, "Error locating object");
+ return (CORBA_OBJECT_NIL);
+ }
+
+ /* create DataObject reference */
+ idfield = oql_query_get_field_position (q, "objectid");
+ keystr = (char *) get_result_field (result, 0, idfield);
+ retval =
+ (GEAS_DataObject) make_dataobject_reference (loadclass, keystr,
+ id->username, id->sessionid,
+ ev);
+ oql_free_query (q);
+ if (result)
+ free_query_result (result);
+ return retval;
+}
+
/* raises: UnknownField, NotReferenceField, Interrupted, ServerError, Locked,
TransactionNotInProgress */
GEAS_ObjectList
-DataObject_getList(GEAS_object_reference * id, CORBA_char * field,
- CORBA_Environment * ev)
- {
- GList *s,*t;
- char *value;
- /* char *targetfield; */
- odl_class *cl,*c;
- odl_field *f;
- char *loadclass;
- QueryData *q;
- ObjectData *o;
- char *keystr;
- GEAS_ObjectList retval;
- /* int idfield; */
- /* int err; */
+DataObject_getList (GEAS_object_reference * id, CORBA_char * field,
+ CORBA_Environment * ev)
+{
+ GList *s, *t;
+ char *value;
+ /* char *targetfield; */
+ odl_class *cl, *c;
+ odl_field *f;
+ char *loadclass;
+ QueryData *q;
+ ObjectData *o;
+ char *keystr;
+ GEAS_ObjectList retval;
+ /* int idfield; */
+ /* int err; */
+
+ /* find and validate the field */
+ cl = odl_find_class (all_classes, id->classname, NULL);
+ if (cl)
+ f = odl_class_get_field (cl, field);
+ if (!cl)
+ {
+ make_ServerError_exception (ev, "Class '%s' has gone away",
+ id->classname);
+ return (CORBA_OBJECT_NIL);
+ }
+ if (!f)
+ {
+ make_UnknownField_exception (ev,
+ "Field '%s' is not defined in class '%s'",
+ field, id->classname);
+ return (CORBA_OBJECT_NIL);
+ }
+ if (odl_field_get_type (f) != FT_list)
+ {
+ make_WrongType_exception (ev,
+ "Field '%s' in class '%s' is not a list
field.",
+ field, id->classname);
+ return (CORBA_OBJECT_NIL);
+ }
- /* find and validate the field */
- cl = odl_find_class( all_classes , id->classname , NULL );
- if( cl )
- f = odl_class_get_field( cl , field );
- if( !cl )
- {
- make_ServerError_exception( ev , "Class '%s' has gone away" ,
id->classname );
- return( CORBA_OBJECT_NIL );
- }
- if( !f )
- {
- make_UnknownField_exception( ev , "Field '%s' is not defined in
class '%s'" , field , id->classname );
- return( CORBA_OBJECT_NIL );
- }
- if( odl_field_get_type(f) != FT_list )
- {
- make_WrongType_exception( ev , "Field '%s' in class '%s' is not a
list field." , field , id->classname );
- return( CORBA_OBJECT_NIL );
- }
-
- loadclass = (char *)odl_field_get_sourceclass( f );
-
- /* create query */
- q = create_base_query (loadclass);
- if (!q)
- {
- make_ServerError_exception(ev, "Could not create query");
- return (CORBA_OBJECT_NIL);
- }
-
- /* add constraints to find just members of this list */
- /* ... WHERE loadclass.t1 = this.s1 AND loadclass.t2 = this.s2 ... */
-
- s = odl_field_get_this_fields( f );
- t = odl_field_get_source_fields( f );
- while( s && t )
- {
- /* value = this.(s->data) */
- /* note: inheritance has to be considered as well */
- /* message( "looking for class containing field %s" , s->data ); */
- c = odl_field_defined_in( cl , (const char *)s->data );
- if( !c )
- {
- make_ServerError_exception( ev , "Reference requires field %s,
but this is not defined in class %s" , s->data , id->classname );
- oql_free_query( q );
- return( CORBA_OBJECT_NIL );
- }
- o = oc_find_object_by_key( odl_class_get_full_name(cl) ,
id->objectid );
- if( !o )
- {
- make_ServerError_exception( ev , "Reference requires field
%s.%s, but this could not be found in the database" , id->classname , s->data );
- oql_free_query( q );
- return( CORBA_OBJECT_NIL );
- }
- value = (char *)oc_get_object_field( o , s->data );
- if( !value )
- g_free( value );
-
- /* add constraint to query */
- if( !oql_add_query_constraint(q,id->classname,(const char
*)value,"=",loadclass,(const char *)t->data) )
- {
- g_free( value );
- oql_free_query( q );
- make_ServerError_exception( ev , "Error making query." );
- return( CORBA_OBJECT_NIL );
- }
- g_free( value );
- s = g_list_next( s );
- t = g_list_next( t );
- }
- if( s != NULL || t != NULL )
- {
- oql_free_query( q );
- make_ServerError_exception( ev , "Mismatch in field definition for
%s.%s" , id->classname , field );
- return( CORBA_OBJECT_NIL );
- }
-
- /* get data */
- keystr = new_object_collection_from_query(q,id,ev);
- oql_free_query(q);
- if( !keystr )
- {
- make_ServerError_exception(ev,
- "3 Could not create list storage structure");
- return (CORBA_OBJECT_NIL);
- }
-
- /* create ObjectList reference */
- retval = (GEAS_ObjectList) make_list_reference(keystr, id->username,
id->sessionid, ev);
- CORBA_free(keystr);
+ loadclass = (char *) odl_field_get_sourceclass (f);
- return retval;
- }
+ /* create query */
+ q = create_base_query (loadclass);
+ if (!q)
+ {
+ make_ServerError_exception (ev, "Could not create query");
+ return (CORBA_OBJECT_NIL);
+ }
+
+ /* add constraints to find just members of this list */
+ /* ... WHERE loadclass.t1 = this.s1 AND loadclass.t2 = this.s2 ... */
+ s = odl_field_get_this_fields (f);
+ t = odl_field_get_source_fields (f);
+ while (s && t)
+ {
+ /* value = this.(s->data) */
+ /* note: inheritance has to be considered as well */
+ /* message( "looking for class containing field %s" , s->data ); */
+ c = odl_field_defined_in (cl, (const char *) s->data);
+ if (!c)
+ {
+ make_ServerError_exception (ev,
+ "Reference requires field %s, but this
is not defined in class %s",
+ s->data, id->classname);
+ oql_free_query (q);
+ return (CORBA_OBJECT_NIL);
+ }
+ o = oc_find_object_by_key (odl_class_get_full_name (cl), id->objectid);
+ if (!o)
+ {
+ make_ServerError_exception (ev,
+ "Reference requires field %s.%s, but
this could not be found in the database",
+ id->classname, s->data);
+ oql_free_query (q);
+ return (CORBA_OBJECT_NIL);
+ }
+ value = (char *) oc_get_object_field (o, s->data);
+ if (!value)
+ g_free (value);
+
+ /* add constraint to query */
+ if (!oql_add_query_constraint
+ (q, id->classname, (const char *) value, "=", loadclass,
+ (const char *) t->data))
+ {
+ g_free (value);
+ oql_free_query (q);
+ make_ServerError_exception (ev, "Error making query.");
+ return (CORBA_OBJECT_NIL);
+ }
+ g_free (value);
+ s = g_list_next (s);
+ t = g_list_next (t);
+ }
+ if (s != NULL || t != NULL)
+ {
+ oql_free_query (q);
+ make_ServerError_exception (ev,
+ "Mismatch in field definition for %s.%s",
+ id->classname, field);
+ return (CORBA_OBJECT_NIL);
+ }
+
+ /* get data */
+ keystr = new_object_collection_from_query (q, id, ev);
+ oql_free_query (q);
+ if (!keystr)
+ {
+ make_ServerError_exception (ev,
+ "3 Could not create list storage structure");
+ return (CORBA_OBJECT_NIL);
+ }
+
+ /* create ObjectList reference */
+ retval =
+ (GEAS_ObjectList) make_list_reference (keystr, id->username,
+ id->sessionid, ev);
+ CORBA_free (keystr);
+
+ return retval;
+}
+
/* raises: UnknownField, NotListField, WrongClass, Interrupted, NotWriteable,
ServerError, Locked, TransactionNotInProgress */
void
-DataObject_insert(GEAS_object_reference * id, CORBA_char * fieldname,
- GEAS_DataObject obj, CORBA_Environment * ev)
+DataObject_insert (GEAS_object_reference * id, CORBA_char * fieldname,
+ GEAS_DataObject obj, CORBA_Environment * ev)
{
- /* TODO */
- /* add 'obj' to the list in classname.fieldname */
+ /* TODO */
+ /* add 'obj' to the list in classname.fieldname */
- /*
- * eg cust_obj.insert( "invoices" , invoice_obj );
- * invoice_obj.customerid = cust_obj.id
- *
- * find fields in 'object' that need to be changed to make it appear in
- * this.fieldname
- *
- * get lookup_field struct for this.fieldname
- * set object.(lookup_field.targetfield<N>) =
this.(lookup_field.searchfield<N>)
- * set obj1.fieldlist1<N> = obj2.fieldlist<N>
- *
- * this.fieldname must be type LF_LIST
- */
-
- ObjectData *container,*object;
- odl_field *f;
- char *classname,*key;
- odl_class *cl_container,*cl_object;
- GList *fields = NULL,*values = NULL,*l = NULL;
+ /*
+ * eg cust_obj.insert( "invoices" , invoice_obj );
+ * invoice_obj.customerid = cust_obj.id
+ *
+ * find fields in 'object' that need to be changed to make it appear in
+ * this.fieldname
+ *
+ * get lookup_field struct for this.fieldname
+ * set object.(lookup_field.targetfield<N>) =
this.(lookup_field.searchfield<N>)
+ * set obj1.fieldlist1<N> = obj2.fieldlist<N>
+ *
+ * this.fieldname must be type LF_LIST
+ */
+
+ ObjectData *container, *object;
+ odl_field *f;
+ char *classname, *key;
+ odl_class *cl_container, *cl_object;
+ GList *fields = NULL, *values = NULL, *l = NULL;
/* debug_output( DEBUGLEVEL_ALWAYS , "Inserting object" ); */
- /* find container data */
- container = oc_find_object_by_key( id->classname , id->objectid );
- cl_container = odl_find_class( all_classes , id->classname , NULL );
- if( !container )
- {
- make_ServerError_exception(ev, "Container object %s/%s has gone away" ,
id->classname , id->objectid );
- return;
- }
-
- /* find object data */
- classname = GEAS_DataObject__get_classname(obj,ev);
- if( ev->_major != CORBA_NO_EXCEPTION )
- {
- make_ServerError_exception(ev,"Could not find classname of object to
insert");
- return;
- }
- key = GEAS_DataObject__get_objectID(obj,ev);
- if( ev->_major != CORBA_NO_EXCEPTION )
- {
- CORBA_free( classname );
- make_ServerError_exception(ev,"Could not find object identifier of
object to insert");
- return;
- }
- object = oc_find_object_by_key( classname , key );
- cl_object = odl_find_class( all_classes , classname , NULL );
- if( !object )
- {
- make_ServerError_exception(ev, "Object %s/%s has gone away" , classname
, key );
- CORBA_free( classname );
- CORBA_free( key );
- return;
- }
-
- if( !cl_container )
- {
- make_UnknownClass_exception(ev, "%s" , id->classname );
- CORBA_free( classname );
- CORBA_free( key );
- return;
- }
- if( !cl_object )
- {
- make_UnknownClass_exception(ev, "%s" , classname );
- CORBA_free( classname );
- CORBA_free( key );
- return;
- }
-
- /* is 'field' a container field in the container class */
- f = odl_class_get_field( cl_container , fieldname );
- if( !f )
- {
- CORBA_free( classname );
- CORBA_free( key );
- make_UnknownField_exception(ev,"Field '%s' is not defined in class
'%s'",fieldname,id->classname);
- return;
- }
- if( odl_field_get_type(f) != FT_list )
- {
- CORBA_free( classname );
- CORBA_free( key );
- make_NotListField_exception(ev,"Field '%s' in class '%s' is not a list
field",fieldname,id->classname);
- return;
- }
-
- /* does this class go in that field? */
- if( !odl_class_is_instanceof(cl_object,odl_field_get_sourceclass(f)) )
- {
- CORBA_free( classname );
- CORBA_free( key );
- make_WrongClass_exception(ev,"%s.%s requires objects of class '%s' but
received class '%s'" ,fieldname,id->classname , odl_field_get_sourceclass(f) ,
odl_class_get_full_name(cl_object) );
- return;
- }
+ /* find container data */
+ container = oc_find_object_by_key (id->classname, id->objectid);
+ cl_container = odl_find_class (all_classes, id->classname, NULL);
+ if (!container)
+ {
+ make_ServerError_exception (ev, "Container object %s/%s has gone away",
+ id->classname, id->objectid);
+ return;
+ }
+
+ /* find object data */
+ classname = GEAS_DataObject__get_classname (obj, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ {
+ make_ServerError_exception (ev,
+ "Could not find classname of object to
insert");
+ return;
+ }
+ key = GEAS_DataObject__get_objectID (obj, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ {
+ CORBA_free (classname);
+ make_ServerError_exception (ev,
+ "Could not find object identifier of object
to insert");
+ return;
+ }
+ object = oc_find_object_by_key (classname, key);
+ cl_object = odl_find_class (all_classes, classname, NULL);
+ if (!object)
+ {
+ make_ServerError_exception (ev, "Object %s/%s has gone away", classname,
+ key);
+ CORBA_free (classname);
+ CORBA_free (key);
+ return;
+ }
+
+ if (!cl_container)
+ {
+ make_UnknownClass_exception (ev, "%s", id->classname);
+ CORBA_free (classname);
+ CORBA_free (key);
+ return;
+ }
+ if (!cl_object)
+ {
+ make_UnknownClass_exception (ev, "%s", classname);
+ CORBA_free (classname);
+ CORBA_free (key);
+ return;
+ }
+
+ /* is 'field' a container field in the container class */
+ f = odl_class_get_field (cl_container, fieldname);
+ if (!f)
+ {
+ CORBA_free (classname);
+ CORBA_free (key);
+ make_UnknownField_exception (ev,
+ "Field '%s' is not defined in class '%s'",
+ fieldname, id->classname);
+ return;
+ }
+ if (odl_field_get_type (f) != FT_list)
+ {
+ CORBA_free (classname);
+ CORBA_free (key);
+ make_NotListField_exception (ev,
+ "Field '%s' in class '%s' is not a list
field",
+ fieldname, id->classname);
+ return;
+ }
+
+ /* does this class go in that field? */
+ if (!odl_class_is_instanceof (cl_object, odl_field_get_sourceclass (f)))
+ {
+ CORBA_free (classname);
+ CORBA_free (key);
+ make_WrongClass_exception (ev,
+ "%s.%s requires objects of class '%s' but
received class '%s'",
+ fieldname, id->classname,
+ odl_field_get_sourceclass (f),
+ odl_class_get_full_name (cl_object));
+ return;
+ }
- /* validation complete. now attempt to place 'object' into
'container.fieldname' */
+ /* validation complete. now attempt to place 'object' into
'container.fieldname' */
/* debug_output( DEBUGLEVEL_ALWAYS , "Validation complete" ); */
- /* read data from this.<fields> */
- fields = odl_field_get_this_fields(f);
- values = NULL;
- while( fields )
- {
- char *fn,*data;
- odl_class *cl;
- ObjectData *o;
- /* int err; */
-
- /* find data in this.field<N> */
- fn = fields->data; /* name of field in container */
- cl = odl_field_defined_in( cl_container , fn ); /* what class is it
defined in */
- o = oc_find_object_by_key( odl_class_get_full_name(cl) , id->objectid );
- data = (char *)oc_get_object_field( o , fn );
+ /* read data from this.<fields> */
+ fields = odl_field_get_this_fields (f);
+ values = NULL;
+ while (fields)
+ {
+ char *fn, *data;
+ odl_class *cl;
+ ObjectData *o;
+ /* int err; */
- /* record data */
+ /* find data in this.field<N> */
+ fn = fields->data; /* name of field in container */
+ cl = odl_field_defined_in (cl_container, fn); /* what class is it
defined in */
+ o = oc_find_object_by_key (odl_class_get_full_name (cl), id->objectid);
+ data = (char *) oc_get_object_field (o, fn);
+
+ /* record data */
/* debug_output( DEBUGLEVEL_ALWAYS , "read: container : %s.%s = %s" ,
odl_class_get_full_name(cl_container) , fn , data ); */
- values = g_list_append( values , data );
- fields = g_list_next( fields );
- }
-
- /* validate that the writes are all possible */
-
- /* perform writes to source.<fields> */
- fields = odl_field_get_source_fields( f );
- l = values;
- while( fields )
- {
- char *fn;
- /* char *data; */
- odl_class *cl;
- ObjectData *o;
- /* int err; */
-
- /* find obj.field<N> */
- fn = fields->data; /* name of field in container */
- cl = odl_field_defined_in( cl_object , fn ); /* what class is it
defined in */
- o = oc_find_object_by_key( odl_class_get_full_name(cl) , key );
-
- /* write data */
- if( allow_log_class_event(oc_get_object_class(o)) )
- dm_event( id->username , id->currenttransaction ,
DM_EVENT_FIELD_WRITE , oc_get_object_class(o) , oc_get_object_key(o) , fn ,
l->data );
- oc_set_object_field( o , fn , l->data , FALSE );
-
- oc_flush_object_to_store(o);
- fields = g_list_next( fields );
- l = g_list_next( l );
- }
-
- /* done */
- g_list_free( values );
- CORBA_free( classname );
- CORBA_free( key );
+ values = g_list_append (values, data);
+ fields = g_list_next (fields);
+ }
+
+ /* validate that the writes are all possible */
+
+ /* perform writes to source.<fields> */
+ fields = odl_field_get_source_fields (f);
+ l = values;
+ while (fields)
+ {
+ char *fn;
+ /* char *data; */
+ odl_class *cl;
+ ObjectData *o;
+ /* int err; */
+
+ /* find obj.field<N> */
+ fn = fields->data; /* name of field in container */
+ cl = odl_field_defined_in (cl_object, fn); /* what class is it
defined in */
+ o = oc_find_object_by_key (odl_class_get_full_name (cl), key);
+
+ /* write data */
+ if (allow_log_class_event (oc_get_object_class (o)))
+ dm_event (id->username, id->currenttransaction, DM_EVENT_FIELD_WRITE,
+ oc_get_object_class (o), oc_get_object_key (o), fn,
+ l->data);
+ oc_set_object_field (o, fn, l->data, FALSE);
+
+ oc_flush_object_to_store (o);
+ fields = g_list_next (fields);
+ l = g_list_next (l);
+ }
+
+ /* done */
+ g_list_free (values);
+ CORBA_free (classname);
+ CORBA_free (key);
}
/* raises: UnknownField, NotReferenceField, WrongClass, Interrupted,
NotWriteable, ServerError, Locked, TransactionNotInProgress */
void
-DataObject_setReference(GEAS_object_reference * id, CORBA_char * fieldname,
- GEAS_DataObject obj , CORBA_Environment * ev)
- {
- ObjectData *container,*object;
- odl_field *f;
- char *classname,*key;
- odl_class *cl_container,*cl_object;
- GList *fields = NULL,*values = NULL,*l = NULL;
+DataObject_setReference (GEAS_object_reference * id, CORBA_char * fieldname,
+ GEAS_DataObject obj, CORBA_Environment * ev)
+{
+ ObjectData *container, *object;
+ odl_field *f;
+ char *classname, *key;
+ odl_class *cl_container, *cl_object;
+ GList *fields = NULL, *values = NULL, *l = NULL;
/* debug_output( DEBUGLEVEL_ALWAYS , "Setting reference" ); */
- /* find container data */
- container = oc_find_object_by_key( id->classname , id->objectid );
- cl_container = odl_find_class( all_classes , id->classname , NULL );
- if( !container )
- {
- make_ServerError_exception(ev, "Container object %s/%s has gone away" ,
id->classname , id->objectid );
- return;
- }
-
- /* find object data */
- classname = GEAS_DataObject__get_classname(obj,ev);
- if( ev->_major != CORBA_NO_EXCEPTION )
- {
- make_ServerError_exception(ev,"Could not find classname of object to
reference");
- return;
- }
- key = GEAS_DataObject__get_objectID(obj,ev);
- if( ev->_major != CORBA_NO_EXCEPTION )
- {
- CORBA_free( classname );
- make_ServerError_exception(ev,"Could not find object identifier of
object to reference");
- return;
- }
- object = oc_find_object_by_key( classname , key );
- cl_object = odl_find_class( all_classes , classname , NULL );
- if( !object )
- {
- make_ServerError_exception(ev, "Object %s/%s has gone away" , classname
, key );
- CORBA_free( classname );
- CORBA_free( key );
- return;
- }
-
- if( !cl_container )
- {
- make_UnknownClass_exception(ev, "%s" , id->classname );
- CORBA_free( classname );
- CORBA_free( key );
- return;
- }
- if( !cl_object )
- {
- make_UnknownClass_exception(ev, "%s" , classname );
- CORBA_free( classname );
- CORBA_free( key );
- return;
- }
-
- /* is 'field' a container field in the container class */
- f = odl_class_get_field( cl_container , fieldname );
- if( !f )
- {
- CORBA_free( classname );
- CORBA_free( key );
- make_UnknownField_exception(ev,"Field '%s' is not defined in class
'%s'",fieldname,id->classname);
- return;
- }
- if( odl_field_get_type(f) != FT_reference )
- {
- CORBA_free( classname );
- CORBA_free( key );
- make_NotReferenceField_exception(ev,"Field '%s' in class '%s' is not a
list field",fieldname,id->classname);
- return;
- }
-
- /* does this class go in that field? */
- if( !odl_class_is_instanceof(cl_object,odl_field_get_sourceclass(f)) )
- {
- CORBA_free( classname );
- CORBA_free( key );
- make_WrongClass_exception(ev,"%s.%s requires objects of class '%s' but
received class '%s'" ,fieldname,id->classname , odl_field_get_sourceclass(f) ,
odl_class_get_full_name(cl_object) );
- return;
- }
+ /* find container data */
+ container = oc_find_object_by_key (id->classname, id->objectid);
+ cl_container = odl_find_class (all_classes, id->classname, NULL);
+ if (!container)
+ {
+ make_ServerError_exception (ev, "Container object %s/%s has gone away",
+ id->classname, id->objectid);
+ return;
+ }
+
+ /* find object data */
+ classname = GEAS_DataObject__get_classname (obj, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ {
+ make_ServerError_exception (ev,
+ "Could not find classname of object to
reference");
+ return;
+ }
+ key = GEAS_DataObject__get_objectID (obj, ev);
+ if (ev->_major != CORBA_NO_EXCEPTION)
+ {
+ CORBA_free (classname);
+ make_ServerError_exception (ev,
+ "Could not find object identifier of object
to reference");
+ return;
+ }
+ object = oc_find_object_by_key (classname, key);
+ cl_object = odl_find_class (all_classes, classname, NULL);
+ if (!object)
+ {
+ make_ServerError_exception (ev, "Object %s/%s has gone away", classname,
+ key);
+ CORBA_free (classname);
+ CORBA_free (key);
+ return;
+ }
+
+ if (!cl_container)
+ {
+ make_UnknownClass_exception (ev, "%s", id->classname);
+ CORBA_free (classname);
+ CORBA_free (key);
+ return;
+ }
+ if (!cl_object)
+ {
+ make_UnknownClass_exception (ev, "%s", classname);
+ CORBA_free (classname);
+ CORBA_free (key);
+ return;
+ }
+
+ /* is 'field' a container field in the container class */
+ f = odl_class_get_field (cl_container, fieldname);
+ if (!f)
+ {
+ CORBA_free (classname);
+ CORBA_free (key);
+ make_UnknownField_exception (ev,
+ "Field '%s' is not defined in class '%s'",
+ fieldname, id->classname);
+ return;
+ }
+ if (odl_field_get_type (f) != FT_reference)
+ {
+ CORBA_free (classname);
+ CORBA_free (key);
+ make_NotReferenceField_exception (ev,
+ "Field '%s' in class '%s' is not a
list field",
+ fieldname, id->classname);
+ return;
+ }
+
+ /* does this class go in that field? */
+ if (!odl_class_is_instanceof (cl_object, odl_field_get_sourceclass (f)))
+ {
+ CORBA_free (classname);
+ CORBA_free (key);
+ make_WrongClass_exception (ev,
+ "%s.%s requires objects of class '%s' but
received class '%s'",
+ fieldname, id->classname,
+ odl_field_get_sourceclass (f),
+ odl_class_get_full_name (cl_object));
+ return;
+ }
- /* validation complete. now attempt to place 'object' into
'container.fieldname' */
+ /* validation complete. now attempt to place 'object' into
'container.fieldname' */
/* debug_output( DEBUGLEVEL_ALWAYS , "Validation complete" ); */
- /* read data from source.<fields> */
- fields = odl_field_get_source_fields(f);
- values = NULL;
- while( fields )
- {
- char *fn,*data;
- odl_class *cl;
- ObjectData *o;
- /* int err; */
-
- /* find data in this.field<N> */
- fn = fields->data; /* name of field in container */
- cl = odl_field_defined_in( cl_object , fn ); /* what class is it
defined in */
- o = oc_find_object_by_key( odl_class_get_full_name(cl) , key );
- data = (char *)oc_get_object_field( o , fn );
-
- /* record data */
- values = g_list_append( values , data );
- fields = g_list_next( fields );
- }
+ /* read data from source.<fields> */
+ fields = odl_field_get_source_fields (f);
+ values = NULL;
+ while (fields)
+ {
+ char *fn, *data;
+ odl_class *cl;
+ ObjectData *o;
+ /* int err; */
- /* validate that the writes are all possible */
+ /* find data in this.field<N> */
+ fn = fields->data; /* name of field in container */
+ cl = odl_field_defined_in (cl_object, fn); /* what class is it
defined in */
+ o = oc_find_object_by_key (odl_class_get_full_name (cl), key);
+ data = (char *) oc_get_object_field (o, fn);
+
+ /* record data */
+ values = g_list_append (values, data);
+ fields = g_list_next (fields);
+ }
+
+ /* validate that the writes are all possible */
/* debug_output( DEBUGLEVEL_ALWAYS , "Read data" ); */
+
+ /* perform writes */
+ fields = odl_field_get_this_fields (f);
+ l = values;
+ while (fields)
+ {
+ char *fn;
+ /* char *data; */
+ odl_class *cl;
+ ObjectData *o;
+ /* int err; */
- /* perform writes */
- fields = odl_field_get_this_fields(f);
- l = values;
- while( fields )
- {
- char *fn;
- /* char *data; */
- odl_class *cl;
- ObjectData *o;
- /* int err; */
-
- /* find obj.field<N> */
- fn = (char *)fields->data; /* name of field in container */
- cl = odl_field_defined_in( cl_container , fn ); /* what class is it
defined in */
- o = oc_find_object_by_key( odl_class_get_full_name(cl) , id->objectid );
-
- /* write data to fields in this/container object */
- if( allow_log_class_event(oc_get_object_class(o)) )
- dm_event( id->username , id->currenttransaction ,
DM_EVENT_FIELD_WRITE , oc_get_object_class(o) , oc_get_object_key(o) , fn ,
l->data );
- oc_set_object_field( o , fields->data,l->data , FALSE );
- oc_flush_object_to_store(o);
- fields = g_list_next( fields );
- l = g_list_next(l);
- }
-
- /* done */
- g_list_free( values );
- CORBA_free( classname );
- CORBA_free( key );
+ /* find obj.field<N> */
+ fn = (char *) fields->data; /* name of field in container */
+ cl = odl_field_defined_in (cl_container, fn); /* what class is it
defined in */
+ o = oc_find_object_by_key (odl_class_get_full_name (cl), id->objectid);
+
+ /* write data to fields in this/container object */
+ if (allow_log_class_event (oc_get_object_class (o)))
+ dm_event (id->username, id->currenttransaction, DM_EVENT_FIELD_WRITE,
+ oc_get_object_class (o), oc_get_object_key (o), fn,
+ l->data);
+ oc_set_object_field (o, fields->data, l->data, FALSE);
+ oc_flush_object_to_store (o);
+ fields = g_list_next (fields);
+ l = g_list_next (l);
+ }
+
+ /* done */
+ g_list_free (values);
+ CORBA_free (classname);
+ CORBA_free (key);
/* debug_output( DEBUGLEVEL_ALWAYS , "done setReference" ); */
- }
+}
/* raises: */
void
-DataObject_flush(GEAS_object_reference * id, CORBA_Environment * ev)
- {
- /* not really needed: leave empty until further notice */
- }
+DataObject_flush (GEAS_object_reference * id, CORBA_Environment * ev)
+{
+ /* not really needed: leave empty until further notice */
+}
/* raises: Interrupted, ServerError, Locked, TransactionNotInProgress */
void
-DataObject_delete(GEAS_object_reference * id, CORBA_Environment * ev)
- {
- odl_class *cl = odl_find_class( all_classes , id->classname , NULL );
- if( cl ) {
- if( strncmp(id->classname,"geas::",6) != 0 )
- dm_event( id->username , id->currenttransaction ,
DM_EVENT_OBJECT_DELETE ,
- odl_class_get_full_name(cl) , id->objectid );
- Connection_logDelete( odl_class_get_full_name(cl) , id->objectid , id
);
- oc_delete_object( odl_class_get_full_name(cl) , id->objectid );
- }
- }
+DataObject_delete (GEAS_object_reference * id, CORBA_Environment * ev)
+{
+ odl_class *cl = odl_find_class (all_classes, id->classname, NULL);
+ if (cl)
+ {
+ if (strncmp (id->classname, "geas::", 6) != 0)
+ dm_event (id->username, id->currenttransaction,
+ DM_EVENT_OBJECT_DELETE, odl_class_get_full_name (cl),
+ id->objectid);
+ Connection_logDelete (odl_class_get_full_name (cl), id->objectid, id);
+ oc_delete_object (odl_class_get_full_name (cl), id->objectid);
+ }
+}
/* raises: UnknownMethod, InvalidArgument, MethodError, ServerError, Locked,
TransactionNotInProgress */
CORBA_char *
-DataObject_callMethod(GEAS_object_reference * id, CORBA_char * methodname,
- GEAS_Arguments * args, CORBA_Environment * ev)
- {
- int i;
- /* CORBA_char *retval = NULL; */
- /* ObjectData *obj = NULL; */
- odl_class *cl = NULL;
- odl_field *f = NULL;
+DataObject_callMethod (GEAS_object_reference * id, CORBA_char * methodname,
+ GEAS_Arguments * args, CORBA_Environment * ev)
+{
+ unsigned int i;
+ /* CORBA_char *retval = NULL; */
+ /* ObjectData *obj = NULL; */
+ odl_class *cl = NULL;
+ odl_field *f = NULL;
/* debug_output( DEBUGLEVEL_ALWAYS , "Calling method %s in object %s/%s"
, methodname , id->classname , id->objectid ); */
+
+ /* validate class/object/method */
+ cl = odl_find_class (all_classes, id->classname, NULL);
+ if (!cl)
+ {
+ make_ServerError_exception (ev, "Class %s has gone missing",
+ id->classname);
+ return (NULL);
+ }
+ cl = odl_field_defined_in (cl, methodname);
+ if (cl)
+ {
+ f = odl_class_get_field (cl, methodname);
+ }
+ if (!f)
+ {
+ make_UnknownMethod_exception (ev, "Method %s was not found in class %s",
+ methodname, id->classname);
+ return (NULL);
+ }
+ /* done */
- /* validate class/object/method */
- cl = odl_find_class( all_classes , id->classname , NULL );
- if( !cl )
- {
- make_ServerError_exception( ev , "Class %s has gone missing" ,
id->classname );
- return( NULL );
- }
- cl = odl_field_defined_in( cl , methodname );
- if( cl ) f = odl_class_get_field( cl , methodname );
- if( !f )
- {
- make_UnknownMethod_exception( ev , "Method %s was not found in class
%s" , methodname , id->classname );
- return( NULL );
- }
- /* done */
-
- /* validate arguments */
- if( args->_length != odl_method_argument_count(f) )
- {
-
make_ArgumentCount_exception(ev,odl_method_argument_count(f),args->_length,
- "%s.%s requires %d arguments, but
received %d" ,
- id->classname , methodname ,
odl_method_argument_count(f),args->_length);
- return( NULL );
- }
+ /* validate arguments */
+ if (args->_length != odl_method_argument_count (f))
+ {
+ make_ArgumentCount_exception (ev, odl_method_argument_count (f),
+ args->_length,
+ "%s.%s requires %d arguments, but received
%d",
+ id->classname, methodname,
+ odl_method_argument_count (f),
+ args->_length);
+ return (NULL);
+ }
#ifdef DEBUG
- /* display arguments */
- if( debuglevel >= DEBUGLEVEL_HIGH )
- {
- for( i=0 ; i<args->_length ; i++ )
- debug_output( DEBUGLEVEL_ALWAYS , "Arg %2d: %s" , i ,
args->_buffer[i] );
- }
+ /* display arguments */
+ if (debuglevel >= DEBUGLEVEL_HIGH)
+ {
+ for (i = 0; i < args->_length; i++)
+ debug_output (DEBUGLEVEL_ALWAYS, "Arg %2d: %s", i, args->_buffer[i]);
+ }
#endif
- return ( execute_method( id , methodname , args , ev ) );
- }
+ return (execute_method (id, methodname, args, ev));
+}
Index: gnue/geas/src/event_log_code.h
diff -u gnue/geas/src/event_log_code.h:1.2 gnue/geas/src/event_log_code.h:1.3
--- gnue/geas/src/event_log_code.h:1.2 Wed May 23 17:57:11 2001
+++ gnue/geas/src/event_log_code.h Sat Jun 9 08:20:37 2001
@@ -1,280 +1,339 @@
+/*
+ event_log_code.h
+
+ Part of GNU Enterprise Application Server (GEAS)
+
+ Copyright (C) 2000-2001 Free Software Foundation
+
+ This program 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.
+
+ This program 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 this program; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+ $Id: event_log_code.h,v 1.3 2001/06/09 15:20:37 ntiffin Exp $
+*/
+
+#include <time.h>
static GList *event_logs = NULL;
-static GHashTable *edits = NULL;
+static GHashTable *edits = NULL;
static GHashTable *deletes = NULL;
typedef struct EventLog
{
- char *sessionid;
- GList *edits,*deletes;
-} EventLog;
+ char *sessionid;
+ GList *edits, *deletes;
+}
+EventLog;
typedef struct LoggableEvent
{
- signed int usagecount;
- char *classname;
- char *oid;
- char *fieldname;
- char *when;
-} LoggableEvent;
+ signed int usagecount;
+ char *classname;
+ char *oid;
+ char *fieldname;
+ char *when;
+}
+LoggableEvent;
static void
-free_event_entry( LoggableEvent *e )
+free_event_entry (LoggableEvent * e)
{
- if( e )
- {
- if( e->classname ) g_free( e->classname );
- if( e->oid ) g_free( e->oid );
- if( e->fieldname ) g_free( e->fieldname );
- if( e->when ) g_free( e->when );
- g_free( e );
- }
+ if (e)
+ {
+ if (e->classname)
+ g_free (e->classname);
+ if (e->oid)
+ g_free (e->oid);
+ if (e->fieldname)
+ g_free (e->fieldname);
+ if (e->when)
+ g_free (e->when);
+ g_free (e);
+ }
}
static const char *
-evt_get_now( void )
+evt_get_now (void)
{
- static char buf[1024];
- char x[32];
- static int y = 1;
- struct tm *tm;
- static time_t last = 0;
- time_t t = 0;
-
- t = time(NULL);
- tm = localtime( &t );
- strftime( buf , 1020 , "%G-%m-%y %H:%M:%S" , tm );
- sprintf( x , ".%d" , y );
- strcat( buf , x );
-
- if( last < t ) y = 1;
- else y++;
- last = t;
-
- return( buf );
+ static char buf[1024];
+ char x[32];
+ static int y = 1;
+ struct tm *tm;
+ static time_t last = 0;
+ time_t t = 0;
+
+ t = time (NULL);
+ tm = localtime (&t);
+ strftime (buf, 1020, "%G-%m-%y %H:%M:%S", tm);
+ sprintf (x, ".%d", y);
+ strcat (buf, x);
+ if (last < t)
+ {
+ y = 1;
+ }
+ else
+ {
+ y++;
+ }
+ last = t;
+ return (buf);
}
static LoggableEvent *
-log_edit_event( char *classname, char *oid, char *fieldname )
+log_edit_event (char *classname, char *oid, char *fieldname)
{
- LoggableEvent *e = g_new0( LoggableEvent , 1 );
- if( e )
- {
- e->classname = g_strdup( classname );
- e->oid = g_strdup( oid );
- e->fieldname = g_strdup( fieldname );
- e->when = g_strdup( evt_get_now() );
- e->usagecount = 0;
- }
- return( e );
+ LoggableEvent *e = g_new0 (LoggableEvent, 1);
+ if (e)
+ {
+ e->classname = g_strdup (classname);
+ e->oid = g_strdup (oid);
+ e->fieldname = g_strdup (fieldname);
+ e->when = g_strdup (evt_get_now ());
+ e->usagecount = 0;
+ }
+ return (e);
}
static guint
-logevt_hash_func( gconstpointer ptr )
+logevt_hash_func (gconstpointer ptr)
{
+ return 0;
}
static gint
-logevt_cmp_func( gconstpointer ptr1 , gconstpointer ptr2 )
+logevt_cmp_func (gconstpointer ptr1, gconstpointer ptr2)
{
-
+ return 0;
}
-
+
static LoggableEvent *
-log_delete_event( char *classname, char *oid )
+log_delete_event (char *classname, char *oid)
{
- LoggableEvent *e = g_new0( LoggableEvent , 1 );
- if( e )
- {
- e->classname = g_strdup( classname );
- e->oid = g_strdup( oid );
- e->fieldname = NULL;
- e->when = g_strdup( evt_get_now() );
- e->usagecount = 0;
- }
- return( e );
+ LoggableEvent *e = g_new0 (LoggableEvent, 1);
+ if (e)
+ {
+ e->classname = g_strdup (classname);
+ e->oid = g_strdup (oid);
+ e->fieldname = NULL;
+ e->when = g_strdup (evt_get_now ());
+ e->usagecount = 0;
+ }
+ return (e);
}
void
-Connection_activateEventLog(GEAS_object_reference * id, CORBA_Environment * ev)
- {
- EventLog *elog = g_new0( EventLog , 1 );
- if( elog )
- {
- elog->sessionid = g_strdup( id->sessionid );
- elog->edits = NULL;
- elog->deletes = NULL;
-
- event_logs = g_list_append( event_logs , elog );
- printf( "elog: Added log '%s'\n" , elog->sessionid );
- }
- }
-
-
-GEAS_Changes *
-Connection__get_latestChanges(GEAS_object_reference * id, CORBA_Environment *
ev)
- {
- LoggableEvent *evt;
- GEAS_Changes *c = GEAS_Changes__alloc();
- GList *l = event_logs;
- EventLog *elog = NULL;
- int n1,n2,count;
-
- while( l )
- {
- elog = l->data;
- if( strcmp(elog->sessionid,id->sessionid) == 0 )
- break;
- else
- elog = NULL;
- l = g_list_next( l );
- }
- if( !elog ) {
- /* not found, or no changes, return empty result */
- return( c );
- }
-
- n1 = g_list_length( elog->edits );
- n2 = g_list_length( elog->deletes );
-
- /* if no changes then return empty result */
- if( n1 == 0 && n2 == 0 )
- return( c );
-
- l = elog->edits;
- c->edited._length = c->edited._maximum = n1;
- c->edited._buffer = CORBA_sequence_GEAS_FieldEdit_allocbuf( n1 );
-
- count = 1;
- while( l )
- {
- evt = l->data;
-
- /* debug */
- printf( " evt %2d : edit field %15s in %s/%s at %s\n" , count ,
- evt->fieldname , evt->classname , evt->oid , evt->when );
-
- /* return data... */
- c->edited._buffer[count-1].classname = CORBA_string_dup(
evt->classname );
- c->edited._buffer[count-1].objectid = CORBA_string_dup( evt->oid );
- c->edited._buffer[count-1].fieldname = CORBA_string_dup(
evt->fieldname );
-
- evt->usagecount--;
- if( evt->usagecount <= 0 )
- free_event_entry( evt );
-
- /* next... */
- l = g_list_next( l );
- count++;
- }
- g_list_free( elog->edits );
+Connection_activateEventLog (GEAS_object_reference * id,
+ CORBA_Environment * ev)
+{
+ EventLog *elog = g_new0 (EventLog, 1);
+ if (elog)
+ {
+ elog->sessionid = g_strdup (id->sessionid);
elog->edits = NULL;
-
-
- l = elog->deletes;
- c->deleted._length = c->deleted._maximum = n2;
- c->deleted._buffer = CORBA_sequence_GEAS_ObjectDeleted_allocbuf( n2 );
-
- count = 1;
- while( l )
- {
- evt = l->data;
-
- /* debug */
- printf( " evt %2d : delete object %s/%s at %s\n" , count ,
- evt->classname , evt->oid , evt->when );
-
- /* return data... */
- c->deleted._buffer[count-1].classname = CORBA_string_dup(
evt->classname );
- c->deleted._buffer[count-1].objectid = CORBA_string_dup( evt->oid );
-
- evt->usagecount--;
- if( evt->usagecount <= 0 )
- free_event_entry( evt );
-
- /* next... */
- l = g_list_next( l );
- count++;
- }
- g_list_free( elog->deletes );
elog->deletes = NULL;
+ event_logs = g_list_append (event_logs, elog);
+ printf ("elog: Added log '%s'\n", elog->sessionid);
+ }
+}
- return( c );
- }
+GEAS_Changes *
+Connection__get_latestChanges (GEAS_object_reference * id,
+ CORBA_Environment * ev)
+{
+ LoggableEvent *evt;
+ GEAS_Changes *c = GEAS_Changes__alloc ();
+ GList *l = event_logs;
+ EventLog *elog = NULL;
+ int n1, n2, count;
+
+ while (l)
+ {
+ elog = l->data;
+ if (strcmp (elog->sessionid, id->sessionid) == 0)
+ {
+ break;
+ }
+ else
+ {
+ elog = NULL;
+ }
+ l = g_list_next (l);
+ }
+ if (!elog)
+ {
+ /* not found, or no changes, return empty result */
+ return (c);
+ }
+ n1 = g_list_length (elog->edits);
+ n2 = g_list_length (elog->deletes);
+ /* if no changes then return empty result */
+ if (n1 == 0 && n2 == 0)
+ {
+ return (c);
+ }
+ l = elog->edits;
+ c->edited._length = c->edited._maximum = n1;
+ c->edited._buffer = CORBA_sequence_GEAS_FieldEdit_allocbuf (n1);
+ count = 1;
+ while (l)
+ {
+ evt = l->data;
+ /* debug */
+ printf (" evt %2d : edit field %15s in %s/%s at %s\n", count,
+ evt->fieldname, evt->classname, evt->oid, evt->when);
+ /* return data... */
+ c->edited._buffer[count - 1].classname =
+ CORBA_string_dup (evt->classname);
+ c->edited._buffer[count - 1].objectid = CORBA_string_dup (evt->oid);
+ c->edited._buffer[count - 1].fieldname =
+ CORBA_string_dup (evt->fieldname);
+ evt->usagecount--;
+ if (evt->usagecount <= 0)
+ {
+ free_event_entry (evt);
+ }
+ /* next... */
+ l = g_list_next (l);
+ count++;
+ }
+ g_list_free (elog->edits);
+ elog->edits = NULL;
+ l = elog->deletes;
+ c->deleted._length = c->deleted._maximum = n2;
+ c->deleted._buffer = CORBA_sequence_GEAS_ObjectDeleted_allocbuf (n2);
+ count = 1;
+ while (l)
+ {
+ evt = l->data;
+ /* debug */
+ printf (" evt %2d : delete object %s/%s at %s\n", count,
+ evt->classname, evt->oid, evt->when);
+ /* return data... */
+ c->deleted._buffer[count - 1].classname =
+ CORBA_string_dup (evt->classname);
+ c->deleted._buffer[count - 1].objectid = CORBA_string_dup (evt->oid);
+ evt->usagecount--;
+ if (evt->usagecount <= 0)
+ {
+ free_event_entry (evt);
+ }
+ /* next... */
+ l = g_list_next (l);
+ count++;
+ }
+ g_list_free (elog->deletes);
+ elog->deletes = NULL;
+ return (c);
+}
+
void
-Connection_logEdit(const char *classname, const char *oid, const char
*fieldname, GEAS_object_reference * id)
- {
- LoggableEvent *evt;
- EventLog *e;
- GList *l = event_logs;
-
- /* on demand initialisation */
- if( edits == NULL ) edits = g_hash_table_new( logevt_hash_func ,
logevt_cmp_func );
- if( deletes == NULL ) deletes = g_hash_table_new( logevt_hash_func ,
logevt_cmp_func );
-
- /* don't log GEAS internal classes - they're irrelevant */
- if( strstr(classname,"geas::") != NULL )
- return;
-
- /* find old edits of this object, and decrement their usage count */
-
- if( l ) {
- if( strncmp(classname,"root::",6) == 0 )
- evt = log_edit_event( &classname[6] , oid , fieldname );
- else
- evt = log_edit_event( classname , oid , fieldname );
- }
- if( !evt ) {
- errormsg( "out of memory - please restart server and all clients." );
- abort();
- }
-
- while( l )
- {
- e = l->data;
- e->edits = g_list_prepend( e->edits , evt );
- evt->usagecount++;
- l = g_list_next( l );
- }
- }
+Connection_logEdit (const char *classname, const char *oid,
+ const char *fieldname, GEAS_object_reference * id)
+{
+ LoggableEvent *evt;
+ EventLog *e;
+ GList *l = event_logs;
+
+ /* on demand initialisation */
+ if (edits == NULL)
+ {
+ edits = g_hash_table_new (logevt_hash_func, logevt_cmp_func);
+ }
+ if (deletes == NULL)
+ {
+ deletes = g_hash_table_new (logevt_hash_func, logevt_cmp_func);
+ }
+ /* don't log GEAS internal classes - they're irrelevant */
+ if (strstr (classname, "geas::") != NULL)
+ {
+ return;
+ }
+ /* find old edits of this object, and decrement their usage count */
+
+ if (l)
+ {
+ if (strncmp (classname, "root::", 6) == 0)
+ {
+ evt = log_edit_event (&classname[6], oid, fieldname);
+ }
+ else
+ {
+ evt = log_edit_event (classname, oid, fieldname);
+ }
+ }
+ if (!evt)
+ {
+ errormsg ("out of memory - please restart server and all clients.");
+ abort ();
+ }
+ while (l)
+ {
+ e = l->data;
+ e->edits = g_list_prepend (e->edits, evt);
+ evt->usagecount++;
+ l = g_list_next (l);
+ }
+}
void
-Connection_logDelete(const char *classname, const char *oid,
GEAS_object_reference * id)
- {
- LoggableEvent *evt;
- EventLog *e;
- GList *l = event_logs;
-
- /* on demand initialisation */
- if( edits == NULL ) edits = g_hash_table_new( logevt_hash_func ,
logevt_cmp_func );
- if( deletes == NULL ) deletes = g_hash_table_new( logevt_hash_func ,
logevt_cmp_func );
-
- /* don't log GEAS internal classes - they're irrelevant */
- if( strstr(classname,"geas::") != NULL )
- return;
-
- if( l ) {
- if( strncmp(classname,"root::",6) == 0 )
- evt = log_delete_event( &classname[6] , oid );
- else
- evt = log_delete_event( classname , oid );
- }
- if( !evt ) {
- errormsg( "out of memory - please restart server and all clients." );
- abort();
- }
-
- while( l )
- {
- e = l->data;
- e->deletes = g_list_prepend( e->deletes , evt );
- evt->usagecount++;
-
- l = g_list_next( l );
- }
- }
+Connection_logDelete (const char *classname, const char *oid,
+ GEAS_object_reference * id)
+{
+ LoggableEvent *evt;
+ EventLog *e;
+ GList *l = event_logs;
+
+ /* on demand initialisation */
+ if (edits == NULL)
+ {
+ edits = g_hash_table_new (logevt_hash_func, logevt_cmp_func);
+ }
+ if (deletes == NULL)
+ {
+ deletes = g_hash_table_new (logevt_hash_func, logevt_cmp_func);
+ }
+ /* don't log GEAS internal classes - they're irrelevant */
+ if (strstr (classname, "geas::") != NULL)
+ {
+ return;
+ }
+ if (l)
+ {
+ if (strncmp (classname, "root::", 6) == 0)
+ {
+ evt = log_delete_event (&classname[6], oid);
+ }
+ else
+ {
+ evt = log_delete_event (classname, oid);
+ }
+ }
+ if (!evt)
+ {
+ errormsg ("out of memory - please restart server and all clients.");
+ abort ();
+ }
+ while (l)
+ {
+ e = l->data;
+ e->deletes = g_list_prepend (e->deletes, evt);
+ evt->usagecount++;
+
+ l = g_list_next (l);
+ }
+}
Index: gnue/geas/src/geas-server.h
diff -u gnue/geas/src/geas-server.h:1.44 gnue/geas/src/geas-server.h:1.45
--- gnue/geas/src/geas-server.h:1.44 Fri Jun 8 22:58:40 2001
+++ gnue/geas/src/geas-server.h Sat Jun 9 08:20:37 2001
@@ -1,6 +1,8 @@
/*
- GEAS - GNU Enterprise Application Server
+ geas-server.h
+
+ Part of GNU Enterprise Application Server (GEAS)
Copyright (C) 2000 Free Software Foundation
@@ -18,6 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ $Id: geas-server.h,v 1.45 2001/06/09 15:20:37 ntiffin Exp $
*/
/** \file geas-server.h
@@ -35,21 +38,21 @@
#define SERVER_PRIVATE_USERNAME "server_private_user"
/* error messages */
-void do_fatal_error(char *file, int line,char *func, char *fmt, ...);
+void do_fatal_error (char *file, int line, char *func, char *fmt, ...);
/* displays the message if settings.verbose is not TRUE */
/* adds a newline to the end of the message */
-void message (char *fmt, ...); /* to stdout */
+void message (char *fmt, ...); /* to stdout */
/* always printed */
-void criticalerror (char *fmt, ...); /* to stderr */
+void criticalerror (char *fmt, ...); /* to stderr */
#ifdef SELF_TEST
- void do_self_test_message (char *fmt, ...); /* to stdout */
- #define self_test_message(fmt,args...) do_self_test_message(fmt,##args)
+void do_self_test_message (char *fmt, ...); /* to stdout */
+#define self_test_message(fmt,args...) do_self_test_message(fmt,##args)
#else
- #define self_test_message(fmt,args...) /* empty */
+#define self_test_message(fmt,args...) /* empty */
#endif
/** \brief Display an error message
@@ -73,19 +76,19 @@
#define fatal_error(fmt,args...)
do_fatal_error(__FILE__,__LINE__,__PRETTY_FUNCTION__,fmt,##args)
/** \brief Holds current configuration information
- */
+ */
struct ServerSettings
- {
- gboolean verbose,quiet,showconfig,loggeasclasses,showclasses;
- gchar *configfile;
- guint64 cache_maximum_size;
- };
+{
+ gboolean verbose, quiet, showconfig, loggeasclasses, showclasses;
+ gchar *configfile;
+ guint64 cache_maximum_size;
+};
/* global variables */
extern struct ServerSettings settings;
-extern int debuglevel; /* configurable debugging output detail :
- 1-10, 1 = low detail, 10 = high detail */
+extern int debuglevel; /* configurable debugging output detail :
+ 1-10, 1 = low detail, 10 = high detail */
extern odl_tree *all_classes;
@@ -94,10 +97,10 @@
/* output function - not to be used directly, in most cases */
/* see macros below */
-void debug_output_f(char *type, int minlevel, char *file, char *func,
- unsigned int line, const char *msg, ...);
-void error_message_out(char *type, char *file, char *func,
- unsigned int line, char *msg, ...);
+void debug_output_f (char *type, int minlevel, char *file, char *func,
+ unsigned int line, const char *msg, ...);
+void error_message_out (char *type, char *file, char *func,
+ unsigned int line, char *msg, ...);
/* the higher the level (first num) the more debugging output is produced
* 1 = most general
@@ -107,26 +110,26 @@
/* set debuglevel in geas.conf to the numbers to get that level of detail */
/* intermediate levels are, of course, allowed */
-#define DEBUGLEVEL_ALWAYS (-2) /* always
display this message */
-#define DEBUGLEVEL_OFF (-1) /* no debug
info */
-#define DEBUGLEVEL_LOW 1 /* lowest
debugging detail */
-#define DEBUGLEVEL_MEDIUM 5 /* medium
detail message */
-#define DEBUGLEVEL_HIGH 10 /* high detail
message */
+#define DEBUGLEVEL_ALWAYS (-2) /* always display this message */
+#define DEBUGLEVEL_OFF (-1) /* no debug info */
+#define DEBUGLEVEL_LOW 1 /* lowest debugging detail */
+#define DEBUGLEVEL_MEDIUM 5 /* medium detail message */
+#define DEBUGLEVEL_HIGH 10 /* high detail message */
-#define DEBUGLEVEL_1 1 /* low */
+#define DEBUGLEVEL_1 1 /* low */
#define DEBUGLEVEL_2 2
#define DEBUGLEVEL_3 3
#define DEBUGLEVEL_4 4
-#define DEBUGLEVEL_5 5 /* medium */
+#define DEBUGLEVEL_5 5 /* medium */
#define DEBUGLEVEL_6 6
#define DEBUGLEVEL_7 7
#define DEBUGLEVEL_8 8
#define DEBUGLEVEL_9 9
-#define DEBUGLEVEL_10 10 /* high */
+#define DEBUGLEVEL_10 10 /* high */
/* set debug level for features */
-#define TRACE_FUNCTIONCALL 3 /* MEDIUM */
-#define TRACE_NOTDONE 0 /* ALWAYS */
+#define TRACE_FUNCTIONCALL 3 /* MEDIUM */
+#define TRACE_NOTDONE 0 /* ALWAYS */
#ifdef DEBUG
# define trace_functioncall() \
@@ -134,8 +137,8 @@
# define trace_functiondone() \
debug_output_f("function done", TRACE_FUNCTIONCALL, __FILE__,
__PRETTY_FUNCTION__, __LINE__ , "" )
#else
-#define trace_functioncall() /* empty */
-#define trace_functiondone() /* empty */
+#define trace_functioncall() /* empty */
+#define trace_functiondone() /* empty */
#endif
/* note: trace_debug priorities should be between 1 and 10, although this
@@ -145,10 +148,9 @@
#define debug_output(level,str,args...) \
debug_output_f(NULL,level,NULL,NULL,0,str,##args)
#else
-#define debug_output(level,str,args...) /* empty */
+#define debug_output(level,str,args...) /* empty */
#endif
-gboolean allow_log_class_event( const char *classname );
+gboolean allow_log_class_event (const char *classname);
#endif
-
Index: gnue/geas/src/geas-skeleton.h
diff -u gnue/geas/src/geas-skeleton.h:1.26 gnue/geas/src/geas-skeleton.h:1.27
--- gnue/geas/src/geas-skeleton.h:1.26 Wed Jun 6 14:10:10 2001
+++ gnue/geas/src/geas-skeleton.h Sat Jun 9 08:20:37 2001
@@ -1,8 +1,10 @@
/*
- geas - GNU Enterprise Application Server
+ geas-skeleton.h
+
+ Part of GNU Enterprise Application Server (GEAS)
- Copyright (C) 2000 Free Software Foundation
+ Copyright (C) 2000-2001 Free Software Foundation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -18,6 +20,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ $Id: geas-skeleton.h,v 1.27 2001/06/09 15:20:37 ntiffin Exp $
*/
#ifndef SKELETON_H
@@ -27,7 +30,7 @@
#include <stdio.h>
#include "geas.h"
-/* prepare servants for handling objects */
+/** \brief Prepare servants for handling objects. */
int initialise_object_servants(PortableServer_POA root_poa);
#define OBJECTTYPE_CONNECTION "01"
Index: gnue/geas/src/objectstore/mysql.c
diff -u gnue/geas/src/objectstore/mysql.c:1.2
gnue/geas/src/objectstore/mysql.c:1.3
--- gnue/geas/src/objectstore/mysql.c:1.2 Wed Jun 6 16:45:33 2001
+++ gnue/geas/src/objectstore/mysql.c Sat Jun 9 08:20:37 2001
@@ -20,7 +20,7 @@
along with GEAS; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: mysql.c,v 1.2 2001/06/06 23:45:33 ntiffin Exp $
+ $Id: mysql.c,v 1.3 2001/06/09 15:20:37 ntiffin Exp $
*/
#include "config.h"
@@ -66,7 +66,7 @@
struct MySQL_handle *h = (struct MySQL_handle *) hnd;
struct active_connection *retval = NULL;
/* struct active_connection *tmp = NULL; */
- int i;
+ unsigned int i;
/* unsigned long int queue = UINT_MAX; */
trace_functioncall ();
@@ -122,7 +122,7 @@
static gboolean
MySQL_connect (struct database_handle *hnd, unsigned long int index)
{
- struct MySQL_handle *h = (struct MySQL_handle *) hnd;
+ /* struct MySQL_handle *h = (struct MySQL_handle *) hnd; */
gboolean retval = FALSE;
struct MySQL_connection *c;
@@ -167,7 +167,7 @@
static gboolean
MySQL_disconnect (struct database_handle *hnd, unsigned long int index)
{
- struct MySQL_handle *h = (struct MySQL_handle *) hnd;
+ /* struct MySQL_handle *h = (struct MySQL_handle *) hnd; */
struct MySQL_connection *c;
/* range check */
@@ -202,7 +202,7 @@
struct query_result *result = new_query_result ();
/* convert to actual type */
- struct MySQL_handle *h = (struct MySQL_handle *) ph;
+ /* struct MySQL_handle *h = (struct MySQL_handle *) ph; */
struct MySQL_connection *con;
@@ -271,14 +271,14 @@
result->success = TRUE;
/* for each entry, extract object ID */
- while (row = mysql_fetch_row (res))
+ row = mysql_fetch_row (res);
+ while (row)
{
/* TODO: create list of objectIDs - need class
definitions */
- char *keydata = "";
- int i;
+ /* char *keydata = ""; */
+ unsigned int i;
DatabaseResultRow_t r = NULL;
-
result->rows_affected++;
/* the result set is a linked list of rows */
@@ -299,8 +299,8 @@
}
/* add entry to list */
result->data = g_list_prepend (result->data, r);
+ row = mysql_fetch_row (res);
}
-
mysql_free_result (res);
}
}
@@ -394,7 +394,7 @@
static void
MySQL_delete_database_handle (struct database_handle *hnd)
{
- int i;
+ unsigned int i;
struct MySQL_handle *h = (struct MySQL_handle *) hnd;
if (h)
@@ -480,7 +480,7 @@
for (i = 0; i < count_database_tables (db); i++)
{
DatabaseTable *tab = get_database_table (db, i);
- DatabaseColumn *c;
+ /* DatabaseColumn *c; */
enum odl_fieldtype type;
int err;
@@ -644,11 +644,12 @@
GString *buf;
DatabaseChange *changes = NULL;
GList *required = NULL;
- GList *tmp, *l;
+ GList *tmp;
+ /* GList *l; */
DatabaseDefinition *database = NULL;
MYSQL *handle;
- MYSQL_RES *res;
- MYSQL_ROW row;
+ /* MYSQL_RES *res; */
+ /* MYSQL_ROW row; */
int err;
FILE *changefile;
@@ -805,7 +806,7 @@
struct database_handle *
MySQL_create_database_handle (configuration config, const char *dbname)
{
- int i;
+ unsigned int i;
struct MySQL_handle *h =
(struct MySQL_handle *) g_malloc (sizeof (struct MySQL_handle));
Index: gnue/geas/src/security.c
diff -u gnue/geas/src/security.c:1.13 gnue/geas/src/security.c:1.14
--- gnue/geas/src/security.c:1.13 Thu Jun 7 16:37:05 2001
+++ gnue/geas/src/security.c Sat Jun 9 08:20:37 2001
@@ -19,7 +19,7 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- $Id: security.c,v 1.13 2001/06/07 23:37:05 ntiffin Exp $
+ $Id: security.c,v 1.14 2001/06/09 15:20:37 ntiffin Exp $
*/
@@ -35,6 +35,7 @@
#include "geas-server.h"
#include "globals.h"
#include "config/configuration.h"
+#include "security.h"
/** \brief Set up the security system
* Called by the main function, when initialising the server. Currently
Index: gnue/geas/src/security.h
diff -u gnue/geas/src/security.h:1.2 gnue/geas/src/security.h:1.3
--- gnue/geas/src/security.h:1.2 Thu Jun 7 16:37:05 2001
+++ gnue/geas/src/security.h Sat Jun 9 08:20:37 2001
@@ -1,5 +1,7 @@
/*
- geas - GNU Enterprise Application Server
+ security,h
+
+ Part of GNU Enterprise Application Server (GEAS)
Copyright (C) 2001 Free Software Foundation
@@ -17,13 +19,13 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ $Id: security.h,v 1.3 2001/06/09 15:20:37 ntiffin Exp $
*/
#ifndef SECURITY_H
#define SECURITY_H
-void init_security_system(void);
+void init_security_system (void);
#endif
-
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gnue/geas lib/classdefs/classdata_database.h li...,
Neil Tiffin <=