return TErrorList.not_exported;
// fill in the targeted property info
PropertyQuery[] pqs = new PropertyQuery[1];
TExportProperty prp = propertyList.getFirstProperty(propertyName);
byte[] tba = new byte[PropertyQuery.sizeInBytes];
pqs[0] = new PropertyQuery();
pqs[0].name = propertyName;
pqs[0].prpDesc = prp.getDescription().getText();
pqs[0].prpAccess = (byte)prp.getAccessMode();
pqs[0].prpFormat = (byte)(prp.getOutputFormat()%512);
pqs[0].prpSize = (short)prp.getOutputSize();
System.arraycopy(pqs[0].toByteArray(), 0, tba, 0, PropertyQuery.sizeInBytes);
return dout.putData(tba, "PQS");
}
else
{ // want the whole list ...
String[] slst = new String[propertyList.countUniqueProperties()];
propertyList.getPropertyNames().toArray(slst);
if (slst.length == 0) break;
PropertyQuery[] pqs = new PropertyQuery[slst.length];
byte[] tba = new byte[slst.length * PropertyQuery.sizeInBytes];
TExportProperty prp;
for (int i=0; i<slst.length; i++)
{
pqs[i] = new PropertyQuery();
pqs[i].name = slst[i];
prp = propertyList.getFirstProperty(slst[i]);
pqs[i].prpDesc = prp.getDescription().getText();
pqs[i].prpAccess = (byte)prp.getAccessMode();
pqs[i].prpFormat = (byte)(prp.getOutputFormat()%512);
pqs[i].prpSize = (short)prp.getOutputSize();
System.arraycopy(pqs[i].toByteArray(), 0, tba, i * PropertyQuery.sizeInBytes,
PropertyQuery.sizeInBytes);
}
return dout.putData(tba, "PQS");
}
}
}
}
/**/
return TErrorList.illegal_format;
}
};
TPropertyHandler metapropertiesStructHandler = new TPropertyHandler()
{
public int call(String devName, TDataType dout, TDataType din, TAccess devAccess)
{
if (dout != null)
{
int filter = getMetaPrpsCallFilter(din);
switch (dout.dFormat)
{ // TODO: tidy this copy-and-past job up !
case TFormat.CF_STRUCT:
LinkedList<TExportProperty> propInstances;
if (dout.getTag().compareTo("PRPQSr4") == 0 || (dout.getArrayLength() % TPropertyQuery.sizeInBytes) == 0)
{
if (din != null && filter != 0x7fffffff)
{ // looking for a specific property ...
String propertyName = din.toString();
propertyName = propertyName.replace('\n', (char) 0).trim();
propInstances = propertyList.getFilledMetaProperties(propertyName,filter);
if ((propInstances == null) || (propInstances.size() == 0))
return TErrorList.not_exported;
// fill in the targeted property info
TPropertyQuery[] prpq = new TPropertyQuery[propInstances.size()];
byte[] tba = new byte[prpq.length * TPropertyQuery.sizeInBytes];
Iterator<TExportProperty> it = propInstances.iterator();
for (int i = 0; (it.hasNext()) && (i < prpq.length); i++)
{
prpq[i] = new TPropertyQuery((TExportProperty) it.next(), propInstances.size() - 1);
System.arraycopy(prpq[i].toByteArray(), 0, tba, i * TPropertyQuery.sizeInBytes,
TPropertyQuery.sizeInBytes);
}
return dout.putData(tba, "PRPQSr4");
}
else
{ // want the whole list ...
String[] slst = new String[propertyList.countUniqueProperties()];
propertyList.getPropertyNames().toArray(slst);
if (slst.length == 0) break;
propInstances = new LinkedList<TExportProperty>();
LinkedList<TExportProperty> theseInstances;
for (int i=0; i<slst.length; i++)
{
theseInstances = propertyList.getFilledMetaProperties(slst[i],filter);
if (theseInstances.size() > 0) propInstances.addAll(theseInstances);
}
int size = propInstances.size();
TExportProperty prp;
TPropertyQuery[] prpq = new TPropertyQuery[size];
byte[] tba = new byte[size * TPropertyQuery.sizeInBytes];
for (int i=0; i<size; i++)
{
prp = propInstances.get(i);
prpq[i] = new TPropertyQuery(prp,1);
System.arraycopy(prpq[i].toByteArray(), 0, tba, i * TPropertyQuery.sizeInBytes,
TPropertyQuery.sizeInBytes);
}
return dout.putData(tba, "PRPQSr4");
}
}
else if (dout.getTag().compareTo("PQS") == 0 || (dout.getArrayLength() % PropertyQuery.sizeInBytes) == 0)
{ // legacy request ...
if (din != null && filter != 0x7fffffff)
{ // looking for a specific property ...
String propertyName = din.toString();
propertyName = propertyName.replace('\n', (char) 0).trim();
propInstances = propertyList.getFilledMetaProperties(propertyName,filter);
if ((propInstances == null) || (propInstances.size() == 0))
return TErrorList.not_exported;
// fill in the targeted property info
PropertyQuery[] pqs = new PropertyQuery[1];
TExportProperty prp = propertyList.getFirstProperty(propertyName);
byte[] tba = new byte[PropertyQuery.sizeInBytes];
pqs[0] = new PropertyQuery();
pqs[0].name = propertyName;
pqs[0].prpDesc = prp.getDescription().getText();
pqs[0].prpAccess = (byte)prp.getAccessMode();
pqs[0].prpFormat = (byte)(prp.getOutputFormat()%512);
pqs[0].prpSize = (short)prp.getOutputSize();
System.arraycopy(pqs[0].toByteArray(), 0, tba, 0, PropertyQuery.sizeInBytes);
return dout.putData(tba, "PQS");
}
else
{ // want the whole list ...
String[] slst = new String[propertyList.countUniqueProperties()];
propertyList.getPropertyNames().toArray(slst);
if (slst.length == 0) break;
propInstances = new LinkedList<TExportProperty>();
LinkedList<TExportProperty> theseInstances;
for (int i=0; i<slst.length; i++)
{
theseInstances = propertyList.getFilledMetaProperties(slst[i],filter);
if (theseInstances.size() > 0) propInstances.addAll(theseInstances);
}
int size = propInstances.size();
PropertyQuery[] pqs = new PropertyQuery[size];
byte[] tba = new byte[size * PropertyQuery.sizeInBytes];
TExportProperty prp;
for (int i=0; i<size; i++)
{
prp = propInstances.get(i);
pqs[i] = new PropertyQuery();
pqs[i].name = prp.getName();
pqs[i].prpDesc = prp.getDescription().getText();
pqs[i].prpAccess = (byte)prp.getAccessMode();
pqs[i].prpFormat = (byte)(prp.getOutputFormat()%512);
pqs[i].prpSize = (short)prp.getOutputSize();