Examples of TDataType


Examples of de.desy.tine.dataUtils.TDataType

    return getNumberOf("PROPERTIES", "/"+context+"/"+server, timeout);
  }
  private static synchronized TPropertyQuery[] getPropertyInformation(String stockprop,String context,String server,String device,String property,int timeout) throws IOException
  {
    TLink tl = null;
    TDataType dout, din;
    int cc = 0, i;
    String tgt, dev;
    TPropertyQuery[] tpq = null;
    TPropertyQuery tpq0 = new TPropertyQuery();
    boolean hasTarget = true;
    byte[] blob = hByteBlob;

    if (server == null || server.length() == 0)
    {
      MsgLog.log("getPropertyInformation", "argument list error",TErrorList.argument_list_error,null,0);
      return null;
    }
    if (device == null || device.length() == 0)
      dev = new String("#0");
    else
      dev = device;
    if (context == null || context.length() == 0)
      tgt = new String("/DEFAULT/" + server + "/" + dev);
    else
      tgt = new String("/" + context + "/" + server + "/" + dev);
    if (property == null || property.compareTo("*") == 0)
    {
      hasTarget = false;
      din = new TDataType();
      //String target = "/" + context + "/" + server;
      int np = nicePropertyQuerySize;
      try
      {
        np = getNumberOf("PROPERTIES", tgt, timeout);
      }
      catch (Exception e)
      {
        MsgLog.log("getPropertyInformation",e.toString(),TErrorList.connection_timeout,e,0);
        throw new IOException("Could not acquire property information for " + server + " (" + e.toString() + ")");
      }
      blob = new byte[2 * np * TPropertyQuery.sizeInBytes]; // allow room for overloads
    }
    else
    {
      if (TQuery.isStockProperty(property))
      {
        stockprop = "STOCKPROPS";
      }
      din = new TDataType(property);
    }
    dout = new TDataType(blob,"PRPQSr4");
    try
    {
      tl = new TLink(tgt,stockprop,dout,din,TAccess.CA_READ);
      cc = tl.execute(timeout,true);
      srvAddr = tl.srvAddr;
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    return getDevicePropertyInformationX("STOCKPROPS", context,server,device,property,TLink.defaultTimeout);
  }
  private static ServerQuery[] getXTagList(String context,String tagtype,String subsys,String importance,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[] inplist = new NAME16[2];
    USTRING[] taglist;
    ServerQuery[] strlist;
    boolean isFecRequest = tagtype.compareToIgnoreCase("FECS") == 0;

    if (subsys == null || subsys.length() == 0)
    {
      inplist[0] = new NAME16("ALL");
    }
    else
    {
      inplist[0] = new NAME16(subsys);
    }
    if (importance == null || importance.length() == 0)
    {
      inplist[1] = new NAME16("ALL");   
    }
    else
    {
      inplist[1] = new NAME16(importance);
    }
    din = new TDataType(inplist);
   
    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)
    {
      MsgLog.log("getXTagList", 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;
    // Get Tags from name server (synchronous call)
    query.delete(0,31);
    query.insert(0,tagtype);
    n = numout[0];
    taglist = new USTRING[n];
    for (i=0; i<n; i++) taglist[i] = new USTRING();
    if (taglist.length == 0) return null;
    if (numout[0] > taglist.length) numout[0] = (short)taglist.length; 
    dout = new TDataType(taglist);
    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 ServerQuery[n];
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  private static int tryAccessLock(String context, String server, AccessLockType lockType)
  {
    short[] lvals = new short[2];
    lvals[0] = (short)lockType.ordinal();
    lvals[1] = (short)1;
    TDataType din = new TDataType(lvals);
    TLink lnk = new TLink("/"+context+"/"+server,"ACCESSLOCK",null,din,TAccess.CA_WRITE|TAccess.CA_RETRY);
    int rc = lnk.execute(TLink.defaultTimeout,true);
    lnk.close();
    return rc;
  }
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

   * @include eg_GetAccessLock.java
   */
  public static String[] getAccessLockInformation(String context, String server)
  {
    NAME32[] n32 = new NAME32[3];
    TDataType dout = new TDataType(n32);
    TLink lnk = new TLink("/"+context+"/"+server,"ACCESSLOCK",dout,null,TAccess.CA_READ);
    int rc = lnk.execute(TLink.defaultTimeout);
    lnk.close();
    if (rc != 0) return null;
    String[] rs = new String[3];
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

  }
  public static synchronized int getThresholds(String context,String server, String property,float[] tmax,float[] tmin)
  {
    if (tmax == null || tmin == null) return TErrorList.invalid_parameter;
    if (tmax.length == 0 || tmin.length == 0) return TErrorList.dimension_error;
    TDataType dt = new TDataType(tmax);
    TLink tl = new TLink("/"+context+"/"+server+"/#0",property+".TMAX",dt,null,TAccess.CA_READ);
    int cc = tl.execute();
    tl.close();
    int dlen = dt.getCompletionLength();
    boolean pifDone = false;
    TPropertyQuery[] tpq = null;
    switch (cc)
    {
      default:
        return cc;
      case TErrorList.link_blacklisted:
      case TErrorList.illegal_property:
        tpq = getPropertyInformation(context,server,"#0",property);
        if (tpq == null) return TErrorList.io_error;
        tmax[0] = tpq[0].prpMaxValue;
        tmin[0] = tpq[0].prpMinValue;
        cc = 0; dlen = 1;
        pifDone = true;
      case TErrorList.success:
        break;
    }
    if (dlen == 1)
    { // one threshold applies to all elements
      for (int i=1; i<tmax.length; i++)
      { // so fill them in ...
        tmax[i] = tmax[0];
      }
    }
    dt = new TDataType(tmin);
    tl = new TLink("/"+context+"/"+server+"/#0",property+".TMIN",dt,null,TAccess.CA_READ);
    cc = tl.execute();
    tl.close();
    dlen = dt.getCompletionLength();
    switch (cc)
    {
      default:
      case TErrorList.illegal_property:
        if (!pifDone)
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    }
  }
  public static SelfTestItem[] getServerSelfTest(String context, String server)
  {
    char[] stChars = new char[32000];
    TDataType dout = new TDataType(stChars);
    TLink lnk = new TLink("/"+context+"/"+server,"SRVSELFTEST",dout,null,TAccess.CA_READ);
    int rc = lnk.executeAndClose(TLink.defaultTimeout);
    if (rc != 0) return null;
    int p = dout.getCompletionLength();
    String stString = new String(stChars,0,p);
   
    csvColumn[] stCols = new csvColumn[26];
    stRowHndlr stRows = new TQuery().new stRowHndlr();
    stCols[0] = new csvColumn("PROPERTY","",new TQuery().new prpHndlr(stRows));
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

          //tagOut = "";
        }
        tct.contract = con;
        tct.contractID = freeContractID;
        tct.din = din;
        tct.dout = new TDataType(sizeOut, con.dataFormatOut);
        tct.dout.setTag(tagOut);
        tct.dout.setMtu(srvPacketMtu);
        tct.drb = new TDataType(sizeOut, con.dataFormatOut);
        tct.drb.setTag(tagOut);
        tct.drb.setMtu(srvPacketMtu);
        tct.eqm = LocateEquipmentModule(con);
        if (debugLevel > 2) DbgLog.log("LocateContractInList","added contract to list (ID = " + tct.contractID + ")");
        conTableAdd.add(tct);
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    if (deviceString == null) return false;
    return deviceString.indexOf('*') != -1;
  }
  private int doContractWithWildcardDevice(TContractTable tct)
  {
    TDataType drdb;
    int start = 0, len = 0, mask = 0;
    boolean isCont = false, chkMask = false, chkOffline = false;
    int cc = TErrorList.not_allowed, i, k;
    TAccess acc = new TAccess(tct.contract.dataAccess);
    int devlistsize = 0;  
    String[] devlist = null;
    int atype;
    NAME16FI[] nfi;
    NAME16II[] nii;
    TDevice dev;

    TEquipmentModule eqm = tct.eqm;
    TDeviceList dlst = eqm.getDeviceList();
    String devprp = tct.contract.eqmProperty;
    String devnam = tct.contract.eqmDeviceName;
    TExportProperty prp = eqm.propertyList.getFirstProperty(devprp);
    if ((atype=prp.getDescription().getArrayType()) == TArrayType.AT_SPECTRUM)
      return TErrorList.not_allowed;
    if (tct.dout == null || tct.dout.dArrayLength < 1) return TErrorList.not_allowed;
    if (!eqm.isDeviceSetLocal(devnam,devprp)) return TErrorList.data_not_local;

    if (prp.getDeviceList() != null)
    {
      devlistsize = prp.getDeviceList().size();
      devlist = new String[devlistsize];
      prp.getDeviceList().toArray(devlist);
    }
    if (devlistsize == 0)
    { // normal state of affairs: use the registered device list
      devlist = dlst.getDeviceNameList();
      devlistsize = devlist.length;
      chkOffline = true;
      if (tct.din != null && tct.din.dArrayLength == 1 && tct.din.dFormat == TFormat.CF_INT32)
      { // appears to be an input device mask
        int[] msk = new int[1];
        tct.din.getData(msk);
        mask = msk[0];
        if (mask != 0) chkMask = true;
      }
    }
    if ((atype & TArrayType.AT_CHANNEL) == TArrayType.AT_CHANNEL)
    {
      len = devlistsize;
      int endpoints[] = StringToName.getContiguousEndpoints(devlist,devnam);
      if (endpoints != null)
      {
        isCont = true;
        start = endpoints[0];
        len = endpoints[1] - endpoints[0] + 1;
      }
    }
    WildcardMatch wc = new WildcardMatch(devnam);

    switch (tct.dout.dFormat)
    {
      case TFormat.CF_NAME16DBLDBL:
      case TFormat.CF_NAME32DBLDBL:
      case TFormat.CF_NAME64DBLDBL:
      case TFormat.CF_USTRING:
      case TFormat.CF_NAME16FI:
        if (isCont)
        {
          int dsiz = tct.contract.dataSizeOut > len ? len : tct.contract.dataSizeOut;
          nfi = new NAME16FI[dsiz];
          float[] frb = new float[dsiz];
          drdb = new TDataType(frb);
          cc = tct.eqm.callProperty(devprp, devlist[start], drdb, tct.din, acc);
          if (cc != 0) return cc;
          for (i=0, k=0; i<drdb.dArrayLength; i++)
          {
            dev = dlst.getDevice(i);
            if (chkMask) if (dev == null || !dev.isMaskSet(mask)) continue;
            if (chkOffline) if (dev == null || dev.isOffline()) continue;
            nfi[k] = new NAME16FI(devlist[start+i],0,frb[i]);
            k++;
          }
          tct.drb.dArrayLength = k;
        }
        else
        {
          int dsiz = tct.contract.dataSizeOut;
          nfi = new NAME16FI[dsiz];
          float[] frb = new float[1];
          drdb = new TDataType(frb);
          for (i=0, k=0; i<devlistsize && k<tct.dout.dArrayLength; i++)
          {
            if (!wc.matches(devlist[i])) continue;
            dev = dlst.getDevice(i);
            if (chkMask) if (dev == null || !dev.isMaskSet(mask)) continue;
            if (chkOffline) if (dev == null || dev.isOffline()) continue;
            cc = tct.eqm.callProperty(devprp, devlist[i], drdb, tct.din, acc);
            if (cc == TErrorList.server_redirection) return TErrorList.data_not_local;
            nfi[k] = new NAME16FI(devlist[i],cc,frb[0]);
            k++;
          }
          tct.drb.dArrayLength = k;
        }
        tct.drb.putData(nfi);
        return 0;
      case TFormat.CF_NAME16II:
        if (isCont)
        {
          int dsiz = tct.contract.dataSizeOut > len ? len : tct.contract.dataSizeOut;
          nii = new NAME16II[dsiz];
          int[] irb = new int[dsiz];
          drdb = new TDataType(irb);
          cc = tct.eqm.callProperty(devprp, devlist[start], drdb, tct.din, acc);
          if (cc != 0) return cc;
          for (i=0,k=0; i<drdb.dArrayLength; i++)
          {
            dev = dlst.getDevice(i);
            if (chkMask) if (dev == null || !dev.isMaskSet(mask)) continue;
            if (chkOffline) if (dev == null || dev.isOffline()) continue;
            nii[k] = new NAME16II(devlist[start+i],0,irb[i]);
            k++;
          }
          tct.drb.dArrayLength = k;
        }
        else
        {
          int dsiz = tct.contract.dataSizeOut;
          nii = new NAME16II[dsiz];
          int[] irb = new int[1];
          drdb = new TDataType(irb);
          for (i=0, k=0; i<devlistsize && k<tct.dout.dArrayLength; i++)
          {
            if (!wc.matches(devlist[i])) continue;
            cc = tct.eqm.callProperty(devprp, devlist[i], drdb, tct.din, acc);
            if (cc == TErrorList.server_redirection) return TErrorList.data_not_local;
            nii[k] = new NAME16II(devlist[i],irb[0],cc);
            k++;
          }
          tct.drb.dArrayLength = k;
        }
        tct.drb.putData(nii);
        return 0;
      default:
        if (tct.dout.dFormat <= TFormat.CF_NAME32 && devnam.compareTo("*") == 0)
        { /* primitive format allowed in this case */
          if (isCont)
          {
            if (tct.dout.dArrayLength > len) tct.dout.dArrayLength = len;
            return tct.eqm.callProperty(devprp, devlist[0], tct.dout, tct.din, acc);
          }
          drdb = new TDataType(1,tct.dout.dFormat);
          for (i=0; i<devlistsize && i<tct.dout.dArrayLength; i++)
          {
            cc = tct.eqm.callProperty(devprp, devlist[i], drdb, tct.din, acc);
            if (cc != 0) break;
          }
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

    return cc;
  }
  private int doContractWithWildcardProperty(TContractTable tct)
  {
    LinkedList<String> lst = null;
    TDataType drdb;
    int cc = TErrorList.not_allowed, i, k, devnr;
    TAccess acc = new TAccess(tct.contract.dataAccess);
    int prplistsize = 0;  
    String[] prplist = null;
    NAME32DBLDBL[] ndd;
  
    TEquipmentModule eqm = tct.eqm;
    String devprp = tct.contract.eqmProperty;
    String devnam = tct.contract.eqmDeviceName;
    TExportProperty prp;
    if (tct.dout == null || tct.dout.dArrayLength < 1) return TErrorList.not_allowed;
    if ((devnr=eqm.getDeviceList().getDeviceNumber(tct.contract.eqmDeviceName)) < 0)
      return TErrorList.illegal_equipment_number;

    lst = eqm.getDeviceList().getDevice(devnr).getPropertyList();
    if (lst != null)
    {
      prplistsize = lst.size();
      prplist = new String[prplistsize];
      lst.toArray(prplist);
    }
    else
    {
      if (eqm.gPropertyNameList == null)
      { // just do this once
        if ((lst = eqm.getPropertyNames()) == null) return TErrorList.code_failure;
        prplistsize = lst.size();
        prplist = new String[prplistsize];
        lst.toArray(prplist);
        eqm.gPropertyNameList = prplist;
      }
      prplistsize = eqm.gPropertyNameList.length;
      prplist = eqm.gPropertyNameList;
    }
   
    WildcardMatch wc = new WildcardMatch(devprp);

    switch (tct.dout.dFormat)
    {
      case TFormat.CF_NAME16DBLDBL:
      case TFormat.CF_NAME32DBLDBL:
      case TFormat.CF_NAME64DBLDBL:
      case TFormat.CF_USTRING:
      case TFormat.CF_NAME16FI:
      case TFormat.CF_NAME16II:
        int dsiz = tct.contract.dataSizeOut;
        ndd = new NAME32DBLDBL[dsiz];
        double[] drb = new double[1];
        drdb = new TDataType(drb);
        for (i=0, k=0; i<prplistsize && k<tct.dout.dArrayLength; i++)
        {
          if (!wc.matches(prplist[i])) continue;
          prp = eqm.propertyList.getFirstProperty(prplist[i]);
          if (prp.getDescription().getArrayType() == TArrayType.AT_SPECTRUM) continue;
View Full Code Here

Examples of de.desy.tine.dataUtils.TDataType

      if (acc.isWrite() && TErrorList.isLinkSuccess(cc) && isSaveRestore)
      {
        int devnr = tct.eqm.getDeviceNumber(devnam, devprp);
        if (devnr >= 0 && rp != null)
        {
          TDataType srdt = rp.getSaveRestoreData();
          if (srdt != null && devnr < srdt.getArrayLength())
          {
            int limit = 1;
            if (srdt.isArrayOfPrimitives())
            { // make some adjustments ...
              try
              { // if we're here, then the property duly exists and should not throw any exceptions
                limit = tct.eqm.getPropertyList().getFirstWriteProperty(devprp).getInputSize();
              }
              catch (Exception e)
              {
                MsgLog.log("doContract", "save/restore array property",TErrorList.code_failure,e,0);
              };
              devnr = limit * devnr;
            }
            tct.din.getData(srdt.getDataObject(),limit,devnr);
            tct.eqm.savePropertyValues(devprp, devnam, srdt);
          }
        }
      }
      if (gate > 0)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.