Package de.desy.tine.client

Examples of de.desy.tine.client.TLink


      dtrecs = new TDataType();
    } else {
      dtrecs = new TDataType(actionItems);
    }
    String dname = "/" + context + "/CAS/" + server;
    TLink tl = new TLink(dname,"ACTION.DB",null,dtrecs,TAccess.CA_WRITE);
    int cc = tl.executeAndClose(2000);
    if (cc == TErrorList.connection_timeout || cc == TErrorList.link_timeout)
      throw new IOException(tl.getLastError());
    return cc;
  }
View Full Code Here


    if (context == null) return null;
    if (!isInitialized) initStructs();
    for (CasAlarmSys p : systems) p.clear();
    TDataType dtact = new TDataType(systems);
    String dname = "/" + context + "/CAS";
    TLink tl = new TLink(dname,"ALMSYSTEM.DB",dtact,null,TAccess.CA_READ);
    if (tl.executeAndClose(1000) != 0) throw new IOException(tl.getLastError());
    int len = dtact.getCompletionLength();
    CasAlarmSys[] results = new CasAlarmSys[len];
    for (int i=0; i<len; i++) results[i] = new CasAlarmSys(systems[i]);
    return results;
  }
View Full Code Here

    if (bf != null && bf.fields.size() > 0) return 0;
    NAME16I[] info = new NAME16I[32];
    TDataType dtInfo = new TDataType(info);
    TDataType dtTag = new TDataType(bfName.toCharArray());
  
    TLink tl = new TLink(devName,"BITFIELDFORMAT",dtInfo,dtTag,TAccess.CA_READ);
    cc = tl.execute(200, true);
    tl.close();
   
    if (cc == 0)
    {
      int nflds = dtInfo.getCompletionLength();
      if (nflds > 0)
View Full Code Here

  {
    if (context == null || dbItems == null) return TErrorList.argument_list_error;
    if (!isInitialized) initStructs();
    TDataType dtrecs = new TDataType(dbItems);
    String dname = "/" + context + "/CAS";
    TLink tl = new TLink(dname,"ALMSYSTEM.DB",null,dtrecs,TAccess.CA_WRITE);
    int cc = tl.executeAndClose(2000);
    if (cc == TErrorList.connection_timeout || cc == TErrorList.link_timeout)
      throw new IOException(tl.getLastError());
    return cc;
  }
View Full Code Here

    if (context == null || server == null) return null;
    if (!isInitialized) initStructs();
    int[] results = new int[25];
    TDataType dtcodes = new TDataType(results);
    String dname = "/"+context+"/CAS/"+server;
    TLink tl = new TLink(dname,"AlmSystem4Server",dtcodes,null,TAccess.CA_READ);
    if (tl.executeAndClose(1000) != 0) throw new IOException(tl.getLastError());
    int len = dtcodes.getCompletionLength();
    return Arrays.copyOf(results, len);
  }
View Full Code Here

  {
    if (context == null || server == null || sysCodes == null) return TErrorList.argument_list_error;
    if (!isInitialized) initStructs();
    TDataType dtcodes = new TDataType(sysCodes);
    String dname = "/"+context+"/CAS/"+server;
    TLink tl = new TLink(dname,"AlmSystem4Server",null,dtcodes,TAccess.CA_WRITE);
    int cc = tl.executeAndClose(1000);
    if (cc == TErrorList.connection_timeout || cc == TErrorList.link_timeout)
      throw new IOException(tl.getLastError());
    return cc;
  }
View Full Code Here

  public static int reloadDataBase(String context) throws IOException
  {
    if (context == null) return TErrorList.argument_list_error;
    if (!isInitialized) initStructs();
    String dname = "/" + context + "/CAS";
    TLink tl = new TLink(dname,"RESTART",null,null,TAccess.CA_WRITE);
    int cc = tl.executeAndClose(3000);
    if (cc == TErrorList.connection_timeout || cc == TErrorList.link_timeout)
      throw new IOException(tl.getLastError());
     return cc;
  }
View Full Code Here

    SrvAddr srv = new SrvAddr();
    TDataType d_null = new TDataType();
    TDataType d_srv = new TDataType(srv.toByteArray(),"");
    synchronized(getLinkFactory().ensMutex )
    {
      TLink ma = getLinkFactory().simpleLink(tagName,dname,d_srv,d_null,(short)1);
      if (ma == null)
      {
        if (TLinkFactory.debugLevel > 1) DbgLog.log("getAddress","cannot create link to ENS");
        return null;         
      }
      ma.cannotNotifyFromWatchdogThread = true;
      for (int i=0; i<2 && cc == TErrorList.connection_timeout; i++)
      { // watchdog thread won't handle the retries, so do it here
        cc = ma.execute(TLink.defaultTimeout,true);
      }
      ma.close();
    }
    if (cc == TErrorList.link_blacklisted) cc = TErrorList.host_not_resolved;
    lastENScc = cc;
    if (cc == 0)
    {
View Full Code Here

    n16in[2] = new NAME16(exportName);
   
    TDataType dout = new TDataType(n16out);
    TDataType din = new TDataType(n16in);

    TLink tl = new TLink(SRVEXP_NAME,"SRVADDR",dout,din,TAccess.CA_READ);
    cc = tl.execute(TLink.defaultTimeout, true);
    if (cc == 0)
    {
      if (fec != null)
      {
        p = Integer.valueOf(n16out[0].getName());
View Full Code Here

  private static String[] getTagList(String context,String tagtype,String subsys,int timeout)
  {
    int cc,n,i;
    TDataType dout;
    TDataType din;
    TLink tl;
    StringBuffer host = new StringBuffer(32);
    StringBuffer query = new StringBuffer(32);
    short[] numout = new short[1];
    TDataType numoutData = new TDataType(numout);
    NAME16[] taglist16;
    NAME32[] taglist32;
    String[] strlist;

    if (subsys == null || subsys.compareTo("ALL") == 0)
    {
      din = new TDataType();
    }
    else
    {
      din = new TDataType(subsys);
    }
   
    host.delete(0,31); query.delete(0,31);
    if (context != null && context.length() != 0)
    {
      host.insert(0,"ENS/" + context);
    }
    else
    {
      host.insert(0,"ENS");
    }
    query.insert(0,"N" + tagtype);
    try
    {
      tl = new TLink(host.toString(),query.toString(),numoutData,din,TAccess.CA_READ);
      cc = tl.execute(timeout,true);
      srvAddr = tl.srvAddr;
      tl.close();
    }
    catch (Exception e)
    { // if the host name cannot be resolved -> runtime exception
      MsgLog.log("getTagList", e.getMessage(),TErrorList.non_existent_elem,e,0);
      cc = TErrorList.non_existent_elem;
    }
    if (cc != 0) return null;
    if (numout[0] == 0 && subsys != null && subsys.length() > 0) numout[0] = 100;   
    query.delete(0,31);
    query.insert(0,tagtype);
    n = numout[0];

    taglist32 = new NAME32[n];
    for (i=0; i<n; i++) taglist32[i] = new NAME32();
    if (taglist32.length == 0) return null;
    if (numout[0] > taglist32.length) numout[0] = (short)taglist32.length; 
    dout = new TDataType(taglist32);
    tl = new TLink(host.toString(),query.toString(),dout,din,TAccess.CA_READ);
    cc = tl.execute(TLink.defaultTimeout,true);
    if (dout.getCompletionLength() < n) n = dout.getCompletionLength();
    tl.close();
    if (cc == 0)
    { // this worked, so we're finished
      strlist = new String[n];
      for (i=0; i<n; i++) strlist[i] = taglist32[i].name;     
      return strlist;
    }
    if (cc == TErrorList.illegal_format)
    { // old ENS ? -> try with reduced lengths ...
      taglist16 = new NAME16[n];
      for (i=0; i<n; i++) taglist16[i] = new NAME16();
      if (taglist16.length == 0) return null;
      if (numout[0] > taglist16.length) numout[0] = (short)taglist16.length; 
      dout = new TDataType(taglist16);
      tl = new TLink(host.toString(),query.toString(),dout,din,TAccess.CA_READ);
      cc = tl.execute(TLink.defaultTimeout,true);
      tl.close();
      if (cc != 0) return null;
      strlist = new String[n];
      for (i=0; i<n; i++) strlist[i] = taglist16[i].name;
      return strlist;     
    }
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.