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

[Ganymede Dev] Re: Just a question

Date Thu, 10 Apr 2003 14:58:36 -0500
From Jonathan Abbey <jonabbey@arlut.utexas.edu>

On Thu, Apr 10, 2003 at 07:34:36PM +0000, John King wrote:
| Hi Jon,
| 
| I noticed you answered my last mail very quickly, thank you for that!
| 
| Did you get my mail with additional information for the other question, 
| too? The mail with the schema dump and some pictures.

Okay, I've looked at the image files and xml file you sent me.  The
error message you are seeing in the admin console is happening because
the embedded A-RR and DNS-Data-Set-Embedded objects are being created
with absolutely no fields.

Normally, this shouldn't happen.  All top-level (non-embedded) objects
will always have fields indicating the time and admin who created and
last edited the object, so they *have* to have some fields.

Embedded objects don't have history fields, but they are supposed to
have a field 0 which points to the parent object which contains the
embedded object.

For some reason, your A-RR and DNS-Data-Set-Embedded objects aren't
having this field 0 created.

I'm guessing this is because you are initializing the objects that
contain the A-RR and DNS-Data-Set-Embedded objects incorrectly.

The proper way to create embedded objects is to call

	createNewEmbedded()

on the InvidDBField which is to contain the link to the object.  For
example, in our systemCustom class:

  public ReturnVal initializeNewObject()
  {
    // If we are being created in an interactive context, 
    // create the first interface

    if (getGSession().enableOversight && getGSession().enableWizards)
      {
	InvidDBField invField = (InvidDBField) getField(systemSchema.INTERFACES);

	// we shouldn't throw a null pointer here, as we should always have the
	// INTERFACES field available

	try
	  {
	    return invField.createNewEmbedded(true);
	  }
	catch (NotLoggedInException ex)
	  {
	    return Ganymede.loginError(ex);
	  }
      }

    return null;
  }

The line

	return invField.createNewEmbedded(true);

actually creates an embedded interface object.

If instead this code said something like

	ReturnVal retVal = gsession.create_db_object(INTERFACE, true);
	DBEditObject eobj = (DBEditObject) retVal.getObject();

	InvidDBField invField = (InvidDBField) getField(systemSchema.INTERFACES);
	invField.addElement(eobj.getInvid());

then the eobj created by the create_db_object() call would not have
its parent-pointer initialized, which would lead to the sort of error
you are seeing.

Look at the createNewEmbedded() method in the InvidDBField.java class,
and you'll see what's supposed to happen.

| Regards,
| 
| Jan Bonne Aans
| DTO TU Delft
| The Netherlands

-- 
-------------------------------------------------------------------------------
Jonathan Abbey 				              jonabbey@arlut.utexas.edu
Applied Research Laboratories                 The University of Texas at Austin
GPG Key: 71767586 at keyserver pgp.mit.edu, http://www.ganymeta.org/workkey.gpg

Attachment: pgp00002.pgp
Description: PGP signature