Menu

#1 IOPObject: getObjectProperty(String, IOPVariable[])

open
nobody
None
5
2006-03-16
2006-03-16
No

Hello,

I've found that there's a method missing in
uk.co.upco.iop.IOPObject. There's no way to fetch an
object property, and passing parameters to this property.

Here is an use case, in pseudo-vbs :

Set theUser = CreateObject("MetaFrameCOM.MetaFrameUser")
WScript.Echo theUser.Applications.Count
Set anApp = theUser.Applications.Item(1)
anApp.LoadData(1)
WScript.Echo anApp.AppName
============================

There is no way to access to
theUser.Applications.Item(1) with comconnect.

To do this in java, we would need something like that :

IOPObject apps = user.getObjectProperty("Applications");
IOPVariable length = apps.getProperty("Count");

params = new IOPVariable[] {new IOPVariable(1)};
IOPObject app = apps.getObjectProperty("Item", params);

params = new IOPVariable[] {new IOPVariable(1)};
app.callMethod("LoadData", params);

IOPVariable appName = app.getProperty("AppName");
System.out.println(appName.getStringValue());

app.dispose();

Here is the code i added in IOPObject.java:

public IOPObject getObjectProperty(String propertyName,
IOPVariable[] arglist)
throws IOPException
{
String args = serialiseArgList(arglist);
String s =
IOPserver.sendAndBlock(CLIENTMESSAGE_GETPROPERTYOBJECT
+ " " + instanceID + " " + propertyName + " " + args);
if(s.startsWith(IOPServer.SERVERMESSAGE_ERROR))
throw new IOPException(s);
else
{
IOPObject jc = new IOPObject(IOPserver);
jc.instanceID = s.substring(s.indexOf(" ") + 1,
s.length());
IOPserver.createdObjects.add(jc);
return jc;
}
}
============================

Hope this helps,
Vincent Fiack.

Discussion