String ntagsString, tagsString;
tagsString = isCentral ? "TAGS" : "HISTORIES";
ntagsString = "N" + tagsString;
String dname = "/" + context + "/" + server;
TLink tl = new TLink(dname,ntagsString,new TDataType(nprps),dtsubs,TAccess.CA_READ);
int cc = tl.executeAndClose(800);
if (cc != 0)
{ // TODO: throw an exception here
return null;
}
if (nprps[0] > 0)
{ // get OFFICIAL list of archived elements
nlist = new NAME64[nprps[0]];
tl = new TLink(dname,tagsString, new TDataType(nlist),dtsubs,TAccess.CA_READ);
cc = tl.executeAndClose(800);
if (cc != 0)
{ // TODO: throw an exception here
return null;
}
}
if (nlist == null) return null;
String ucnam, nam;
Vector<String> nv = new Vector<String>(nlist.length);
Vector<String> ev = new Vector<String>(25);
Vector<String> sav = new Vector<String>(nlist.length);
Vector<String> dv = new Vector<String>(25);
Hashtable<String,HstPrp> pl = new Hashtable<String,HstPrp>();
for (int i=0; i<nlist.length; i++)
{
nam = nlist[i].getName();
if (nam.trim().length() == 0) continue;
ucnam = nam.toUpperCase();
if (ucnam.endsWith(".NAM"))
{
nv.add(ucnam.substring(0, ucnam.indexOf(".NAM"))); continue;
}
if (ucnam.endsWith(".ENUM"))
{
ev.add(ucnam.substring(0, ucnam.indexOf(".ENUM"))); continue;
}
if (ucnam.endsWith(".SRCADDR"))
{
sav.add(ucnam.substring(0, ucnam.indexOf(".SRCADDR"))); continue;
}
if (ucnam.endsWith(".DESC"))
{
int idx = ucnam.indexOf(".NAM.DESC");
if (idx < 0) idx = ucnam.indexOf(".DESC");
dv.add(ucnam.substring(0, idx)); continue;
}
pl.put(ucnam, new HstPrp(nam));
}
if (pl.isEmpty()) return new HstPrp[0];
if (isCentral)
{ // take care of other contingencies at the Central Archive Server
NAME64[] plist = new NAME64[nlist.length*2];
TDataType tdt = new TDataType(plist);
tl = new TLink(dname,"PROPERTIES",tdt,null,TAccess.CA_READ);
if (tl.executeAndClose(800) == 0)
{
fillinHstPrpVectors(plist,tdt.getCompletionLength(),nv,ev,sav,dv);
}
tl = new TLink(dname,"SRVALIASLIST",tdt,null,TAccess.CA_READ);
if (tl.executeAndClose(800) == 0)
{
fillinHstPrpVectors(plist,tdt.getCompletionLength(),nv,ev,sav,dv);
}
}
HstPrp hp;