[gme-users]

hernandf at cis.uab.edu hernandf at cis.uab.edu
Thu May 6 14:51:33 CDT 2004


hi, i've been having a couple of problems with the Java Version of the
libraries,
both are related of using connections:

1) When calling getOutConnections the method returns an empty vector or a
   null velctor, i think that the error is in the comparison list!=null in
   getOutConnections from JBuilderObject.java, the comparison should be
   if(list==null), getInConnections does that.

	public Vector getOutConnections(String name)
	{	Vector list = findOutConnections(name);
		if(list!=null)
			list = new Vector();	
		return list;
	}
	

2) always get the connections twice. For example if i have an atom connected
   to another atom in my paradigm, i should get just one connection but when
   running this two examples i get it printed twice: (the same thing happens
   with inconnections)

	a)	
	Vector[] t = new Vector[1];
			
	if (gmeCredential.getOutConnectedObjects("cSignOn",t))
	{
		for (Enumeration l = t[0].elements(); l.hasMoreElements();
)					Support.MessageBox("GridFactory::listOfCredentials " +
			((JBuilderAtom)l.nextElement()).getName());
	}


	b)	
	Vector listOfCon = gmeCredential.getOutConnections("cSignOn");
	Support.MessageBox("GridFactory::listOfCredentials No. Of Connections: " +
 			    Integer.toString(listOfCon.size()));

   I looked at the code for JBuilderModel and if I add a line before calling
   child.resolve(), the program behaves correctly. I do not know if this
make
   things fail in some other place though???

	public  void resolve()
	{	int chCount = children.size();
		for(int i=0;i<chCount;i++)
		{	JBuilderObject child = (JBuilderObject)children.elementAt(i);

			/* this line was added */
			if(child.getObjType()!=MgaObject.OBJTYPE_CONNECTION)

				child.resolve();
		}
	...

Finally the following class helps me to debug my Interpreter
inside Eclipse. It opens a gme project and allows to debug
the interpreter that uses bon. so if anyone wants to use it.
just make jure that JAUT.dll is on your path, or else this
won't work.

import org.isis.gme.bon.JBuilder;
import org.isis.gme.mga.MgaObject;
import org.isis.gme.mga.MgaProject;
import org.isis.jaut.Apartment;
import bioflow.globus.GlobusInterpreter;

public class TestConnections {
	
	private void testy()
	{
		try {
			Apartment.enter(true);
			MgaProject project = MgaProject.createInstance();

			/* replace PATH with the path to your mga file */
			project.open( "MGA=C:\\PATH\\test.mga" );
			project.beginTransaction( null );
			MgaObject root = new MgaObject( project.getRootFolder() );
			
			GlobusInterpreter interpreter = new GlobusInterpreter();
			JBuilder b = new JBuilder(project,interpreter);
			interpreter.invokeEx(b,null,null,0);
			
			project.abortTransaction();
			project.close();
			Apartment.leave();
			System.out.println("done");
		} catch(Exception e){
			e.printStackTrace();
		}
	}
	public static void main(String[] args) {
		TestConnections t = new TestConnections();
		t.testy();
	}
}


thanks,

Francisco

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .




More information about the gme-users mailing list