[gme-users] JavaBON fixes

Alex Goos alexander.goos at epfl.ch
Sat Feb 18 16:08:40 CST 2006


Hello

Find here some Fixes to JavaBON as provided with GME 5.9.21. Most errors 
occur when you use JavaBON for updating/creating new Objects.
In the mentioned methods replace the lines commented-out with a // by 
the following one(s).

There remain some caveats in JavaBON, I just fixed the errors my program 
encountered.
Attached is a copy of gme.jar with the patches applied.

Alex

-------------------------------

CreateNewModel problem:
 
org.isis.mga.meta.MgaMetaModel:

   public MgaMetaRole getRoleByName( String name )
   {
//    return new MgaMetaRole( (Dispatch)call( "RoleByName", name ) );
     return new MgaMetaRole( (Dispatch)get( "RoleByName", name ) );
   }


org.isis.mga.meta.MgaMetaFolder:

    public MgaMetaFCO getLegalRootObjectByName( String name )
    {
   //    return new MgaMetaFCO( (Dispatch)call( "LegalRootObjectByName", 
name ) );
       return new MgaMetaFCO( (Dispatch)get( "LegalRootObjectByName", 
name ) );
    }

 
SetAttribute problem:

org.isis.jaut.Dispatch:

   public void put(String dispName, Object arg0, Object value)
   {
       //invokeSub(dispName, DISPATCH_PROPERTYPUT, new Object[] { value, 
arg0 }, DISPID_PROPERTYPUT_ARG);
       invokeSub(dispName, DISPATCH_PROPERTYPUT, new Object[] { arg0, 
value }, DISPID_PROPERTYPUT_ARG);
   }

Create RootFolder Models Problem:

org.isis.gme.bon.JBuilderFolder

    public JBuilderModel createNewModel(String kindName)
    {
    ...
        //return o;
        rootModels.add(o);
        return o;
    }

CreateNewConnection Problem:

org.isis.gme.bon.JBuilderModel (line 733)

    public JBuilderConnection createNewConnection(String connName, 
JBuilderObject source, JBuilderObject destination)
    {
    ...
        //MgaSimpleConnection sconn = (MgaSimpleConnection)iconn;
        MgaSimpleConnection sconn = new MgaSimpleConnection(iconn);
    ...
    }

CreateNewReference Problem

org.isis.gme.bon.JBuilderModel: (line 638)
    public JBuilderModelReference createNewModelReference(String 
refPartName, JBuilderObject refTo)
    {   
     ...
        //MgaMetaRole role = metaModel.getRoleByName(partName);
        MgaMetaRole role = metaModel.getRoleByName(refPartName);
     ...
    }

org.isis.gme.mga.MgaModel: (line 590)
    public MgaFCO createReference( MgaMetaRole meta, MgaFCO target )
    {
    ...
  
        //Variant arguments[] = new Variant[2];
        Variant arguments[] = new Variant[3];
        arguments[0]        = new Variant(meta);
        //arguments[1]        = new Variant(returned_fco_variant);
        arguments[1]        = new Variant(target);
        arguments[2]        = new Variant(returned_fco_variant);
    ...
    }

Other Problems:

Problem: Path of an Object cannot be read by getNamePath()
Reason: parameters are passed "copy by value" in Java, so getNamePath() 
fails.
Note: The function's siganture changed! And I deliberatly replaced the 
"_" separator by "#" as its much less frequent in my object's names

org.isis.gme.bon.JBuilderObject
public String getNamePath()
    {    return this.getExtendedName("","#",true);
    }
   
    public String getExtendedName(String extName, String seperator, 
boolean startWithRoot)
    {   
        if(!startWithRoot)
            extName += getName();
        JBuilderObject parent = this.getParent();
        if(parent!=null)
        {    if(!startWithRoot)
                extName += seperator;
            parent.getExtendedName(extName,seperator,startWithRoot);
            if(startWithRoot)
                extName += seperator;
        }
        if(startWithRoot)
            extName += getName();
        return extName;
    }



Another problem persits for MgaReference, but I couldnt figure out the 
exact reason. Sometimes, a newly created JBuilderModelReference's 
getReferred() is Null. I help myself a with workaround, calling 
.resolve() before accessing .getReferred() the first time...

------------------------------------
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gme.jar
Type: application/octet-stream
Size: 255758 bytes
Desc: not available
Url : http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20060218/047efe61/gme.obj


More information about the gme-users mailing list