Package de.desy.tine.client

Examples of de.desy.tine.client.TLink


    else
    {
      isActive = null;
      dout = new TDataType(data);
    }
    TLink tl = new TLink(dname,"RECORD.CMTS",dout,din,TAccess.CA_READ);
    int cc = tl.executeAndClose(timeout);
    if (cc != 0) return -cc;
    int n = dout.getCompletionLength();
    if (isActive != null)
    {
      for (int i=0; i<n; i++)
View Full Code Here


    char[] cmt = new char[1024];
    dout = new TDataType(cmt);

    String dname = new String("/"+context+"/HISTORY/"+property+"@"+(int)target);

    TLink tl = new TLink(dname,"RECORD.CMT",dout,null,TAccess.CA_READ);
    int cc = tl.executeAndClose(timeout);
    if (cc != 0) return cc;
    int len = dout.getCompletionLength();
    data[0] = new String(cmt,0,len);
    return 0;
  }
View Full Code Here

      din = new TDataType(text.toCharArray());
    }
    String keepString = keepAlive ? "[KEEPALIVE]" : "";
    String dname = new String("/"+context+"/HISTORY/"+property+"@"+(int)targetTime+keepString);

    TLink tl = new TLink(dname,"RECORD.CMT",null,din,TAccess.CA_WRITE);
    return tl.executeAndClose(timeout);
  }
View Full Code Here

    { // not a call to a central archive server
      tryAlternateProperty = true;
      if (!isArchiveQueryProperty(property))
        pname = pname + ".HIST"; // meta extension not given, try this ...
    }
    TLink tl = new TLink(dname,pname,dout,din,TAccess.CA_READ);
    cc = tl.executeAndClose(timeout);
    if (cc == TErrorList.un_allocated && tryAlternateProperty)
    {
      String[] hists = getArchivedProperties(context,server);
      if (hists != null)
      { // there are histories available ....
        if (isScheduledProperty(rname))
        { // look for unscheduled alternative
          for (String h : hists)
          {
            if (rname.startsWith(h))
            {
              pname = h+".HIST";
              tl = new TLink(dname,pname,dout,din,TAccess.CA_READ);
              cc = tl.executeAndClose(timeout);
              break;
            }
          }
        }
        else
        { // look for scheduled alternative
          for (String h : hists)
          {
            if (isScheduledProperty(h))
            {
              if (h.startsWith(rname))
              {
                pname = h+".HIST";
                tl = new TLink(dname,pname,dout,din,TAccess.CA_READ);
                cc = tl.executeAndClose(timeout);
                break;            
              }
            }
          }       
        }
      }
    }
    if (cc != 0 && isCentralArchiver(server))
    { // special 2nd chance !
      if (isArchiveQueryProperty(property))
      {
        pname = rname + ".ARCH";
      }
      else
      {
        pname = new String(property) + ".ARCH";
      }
      tl = new TLink(dname,pname,dout,din,TAccess.CA_READ);
      cc = tl.executeAndClose(timeout);
    }
    return cc == 0 ? dout.getCompletionLength() : -cc;
 
View Full Code Here

        ntries = 2;
      }
    }
    for (int i=0; i<ntries; i++)
    {
      TLink tl = new TLink(dname,pname[i],dout,din,TAccess.CA_READ);
      cc = tl.execute(2000, true);
      targetTime[0] = tl.getLastDataTimeStamp();
      tl.close();
      if (cc == 0 && dout.getCompletionLength() > 0) break;
    }
    return cc;
 
View Full Code Here

        ntries = 2;
      }
    }
    for (int i=0; i<ntries; i++)
    {
      TLink tl = new TLink(dname,pname[i],dout,din,TAccess.CA_READ);
      cc = tl.execute(2000, true);
      targetTime[0] = tl.getLastDataTimeStamp();
      tl.close();
      if (cc == 0 && dout.getCompletionLength() > 0) break;
    }
    return cc;
 
View Full Code Here

  {
    THistoryRecordStruct[] hrs = new THistoryRecordStruct[1];
    THistorySpecification hsp = new THistorySpecification(pollInterval, archInterval, depthShort, depthLong, heartBeat, pTolerance, aTolerance, null);
    hrs[0] = new THistoryRecordStruct(device, property, datasiz, datafmt, hsp);
    String dev = "/"+context+"/"+server;
    TLink lnk = new TLink(dev,"ADDHISTORY",null,new TDataType(hrs),TAccess.CA_WRITE);
    return lnk.executeAndClose();
  }
View Full Code Here

  }
  public static String[] getLocalHistoryProperties(String context,String server,String device)
  {
    int[] n = new int[1];
    String dev = "/"+context+"/"+server;
    TLink lnk = new TLink(dev,"NHISTORIES",new TDataType(n),null,TAccess.CA_READ);
    if (lnk.executeAndClose() != 0) return null;
    if (n[0] == 0)
    { // could be a doocs server
      String eqm = TSrvEntry.getSrvEntryEqmName(context, server);
      if (eqm == null || eqm.compareTo(TSrvEntry.DOOCSEQM) != 0) return null;
      String[] prps = TQuery.getDeviceProperties(context, server, device);
      if (prps == null) return null;
      ArrayList<String>al = new ArrayList<String>();
      for (String p : prps)
      {
        if (p.endsWith(".HIST")) al.add(p.substring(0, p.lastIndexOf('.')))
      }
      if (al.isEmpty()) return null;
      return al.toArray(new String[0]);
    }
    NAME64[] nlst = new NAME64[n[0]];
    lnk = new TLink(dev,"HISTORIES",new TDataType(nlst),null,TAccess.CA_READ);
    if (lnk.executeAndClose() != 0) return null;
    return NameToString.nameArrayToString(nlst);
  }
View Full Code Here

    THistoryRecordStruct[] hrs = new THistoryRecordStruct[1];
    hrs[0] = new THistoryRecordStruct();
    String dev = "/"+context+"/"+server;
    TDataType dout = new TDataType(hrs);
    TDataType din = new TDataType(property.toCharArray());
    TLink lnk = new TLink(dev,"HISTORIES",dout,din,TAccess.CA_READ);
    int cc = lnk.executeAndClose();
    if (cc != 0) return null;
    if (dout.getCompletionLength() < 1) return null;
    return hrs[0];
  }
View Full Code Here

    TDataType dtprps;
    tagsString = isCentral ? "TAGS" : "HISTORIES";
    ntagsString = "N" + tagsString;
   
    String dname = "/" + context + "/" + server;
    TLink tl = new TLink(dname,ntagsString,dtnprps,dtsubs,TAccess.CA_READ);
    int cc = tl.execute(800, true);
    tl.close();
    if (cc != 0)
    { // TODO: throw an exception here
      return null;
    }
    if (nprps[0] > 0)
    {
      nlist = new NAME32[nprps[0]];
      dtprps = new TDataType(nlist);
      tl = new TLink(dname,tagsString,dtprps,dtsubs,TAccess.CA_READ);
      cc = tl.execute(800, true);
      tl.close();
      if (cc != 0)
      { // TODO: throw an exception here
        return null;
      }
    }
View Full Code Here

TOP

Related Classes of de.desy.tine.client.TLink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.