* @return A string array containing a list of meta properties
* as obtained from the given device server
*/
public static String[] getMetaProperties(String context,String server,String device,String property)
{
TLink tl;
TDataType dout;
TDataType din;
String tgt;
int cc = 0,n = 0,i,j;
NAME64[] properties;
String[] strprops;
tgt = new String("/" + context + "/" + server + "/" + device);
try
{
TPropertyQuery[] pq = getStockPropertyInformation(context,server,device,"METAPROPS");
if (pq != null) {
n = pq[0].prpSize;
}
}
catch (Exception e)
{
return null;
}
if (n <= 0) return null;
if (n*32 > maxQueryBufferSize) n = maxQueryBufferSize/32;
properties = new NAME64[n];
for (i=0; i<n; i++) properties[i] = new NAME64();
dout = new TDataType(properties);
if (property != null) din = new TDataType(property); else din = null;
properties_have_query_function = false;
tl = new TLink(tgt,"METAPROPS",dout,din,TAccess.CA_READ);
cc = tl.execute(TLink.defaultTimeout,true);
if ((cc & TErrorList.CE_SENDDATA) == TErrorList.CE_SENDDATA)
{
if ((cc & TErrorList.has_query_function) == TErrorList.has_query_function)
{
properties_have_query_function = true;
}
cc = 0;
}
tl.close();
if (cc == 0)
{
for (i=0,n=0; i<properties.length; i++) if (properties[i].name.length() > 0) n++;
strprops = new String[n];
for (i=0,j=0; j<n && i<properties.length; i++)
{
if (properties[i].name.length() == 0) continue;
strprops[j++] = properties[i].name;
}
return strprops;
}
else if (cc != TErrorList.link_not_open)
{
if (lastQueriedContext == context && lastQueriedServer == server &&
lastQueriedDevice == device && lastQueriedServer != null)
{
cc = 0;
}
else
{
hLegacyByteBlob = new byte[n * PropertyQuery.sizeInBytes];
dout = new TDataType(hLegacyByteBlob,"");
tl = new TLink(tgt,"METAPROPS",dout,din,TAccess.CA_READ);
cc = tl.execute(TLink.defaultTimeout,false);
tl.close();
}
if (cc == 0)
{
lastQueriedContext = context;
lastQueriedServer = server;