Exemple #1
0
static CMPICount
getPropertyCount(CMPIConstClass * cc, CMPIStatus *rc)
{
  ClClass        *cls = (ClClass *) cc->hdl;
  if (rc)
    CMSetStatus(rc, CMPI_RC_OK);
  return (CMPICount) ClClassGetPropertyCount(cls);
}
Exemple #2
0
static int
cpyClass(ClClass * cl, CMPIConstClass * cc)
{
  ClClass        *ccl = (ClClass *) cc->hdl;
  CMPIData        d;
  CMPIParameter   p;
  CMPIType        t;
  char           *name;
  char           *refName = NULL;
  int             i,
                  m,
                  iq,
                  mq,
                  ip,
                  mp,
                  propId,
                  methId,
                  parmId;
  unsigned long   quals;
  ClProperty     *prop;
  ClMethod       *meth;
  ClParameter    *parm;

  cl->quals |= ccl->quals;
  for (i = 0, m = ClClassGetQualifierCount(ccl); i < m; i++) {
    ClClassGetQualifierAt(ccl, i, &d, &name);
    ClClassAddQualifierSpecial(&cl->hdr, &cl->qualifiers, name, d,
                               &ccl->hdr);
  }

  for (i = 0, m = ClClassGetPropertyCount(ccl); i < m; i++) {
    ClClassGetPropertyAt(ccl, i, &d, &name, &quals, &refName);
    propId = ClClassAddProperty(cl, name, d, refName);
    if (refName) {
      free(refName);
    }
    prop =
        ((ClProperty *) ClObjectGetClSection(&cl->hdr, &cl->properties)) +
        propId - 1;

    for (iq = 0, mq = ClClassGetPropQualifierCount(ccl, i); iq < mq; iq++) {
      ClClassGetPropQualifierAt(ccl, i, iq, &d, &name);
      ClClassAddPropertyQualifierSpecial(&cl->hdr, prop, name, d,
                                         &ccl->hdr);
    }
  }

  for (i = 0, m = ClClassGetMethodCount(ccl); i < m; i++) {
    ClClassGetMethodAt(ccl, i, &t, &name, &quals);
    methId = ClClassAddMethod(cl, name, t);
    meth =
        ((ClMethod *) ClObjectGetClSection(&cl->hdr, &cl->methods)) +
        methId - 1;

    for (iq = 0, mq = ClClassGetMethQualifierCount(ccl, methId - 1);
         iq < mq; iq++) {
      ClClassGetMethQualifierAt(ccl, meth, iq, &d, &name);
      ClClassAddMethodQualifier(&cl->hdr, meth, name, d);
    }

    for (ip = 0, mp = ClClassGetMethParameterCount(ccl, methId - 1);
         ip < mp; ip++) {
      ClClassGetMethParameterAt(ccl, meth, ip, &p, &name);
      parmId = ClClassAddMethParameter(&cl->hdr, meth, name, p);
      parm = ((ClParameter *)
              ClObjectGetClSection(&cl->hdr,
                                   &meth->parameters)) + parmId - 1;

      for (iq = 0, mq = ClClassGetMethParamQualifierCount(parm);
           iq < mq; iq++) {
        ClClassGetMethParamQualifierAt(ccl, parm, iq, &d, &name);
        ClClassAddMethParamQualifier(&cl->hdr, parm, name, d);
      }
    }
  }
  return 0;
}
Exemple #3
0
static int
cpyClass(ClClass * cl, CMPIConstClass * cc, unsigned char originId)
{
  ClClass        *ccl = (ClClass *) cc->hdl;
  CMPIData        d;
  // CMPIParameter p;
  // CMPIType t;
  char           *name;
  char           *refName = NULL;
  int             i,
                  m,
                  iq,
                  mq,
                  propId;
  // int parmId, methId, mp, ip;
  unsigned long   quals;
  ClProperty     *prop;
  // ClMethod *meth;
  // ClParameter *parm;

  cl->quals |= ccl->quals;
  for (i = 0, m = ClClassGetQualifierCount(ccl); i < m; i++) {
    ClClassGetQualifierAt(ccl, i, &d, &name);
    ClClassAddQualifierSpecial(&cl->hdr, &cl->qualifiers, name, d,
                               &ccl->hdr);
    if (!(d.type & CMPI_ARRAY))
      sfcb_native_release_CMPIValue(d.type, &d.value);
    // free(name);
  }

  for (i = 0, m = ClClassGetPropertyCount(ccl); i < m; i++) {
    char           *pname;
    ClClassGetPropertyAt(ccl, i, &d, &pname, &quals, &refName);

    propId = ClClassAddProperty(cl, pname, d, refName);
    prop =
        ((ClProperty *) ClObjectGetClSection(&cl->hdr, &cl->properties)) +
        propId - 1;
    if (refName) {
      // CJB free(refName);
    }

    for (iq = 0, mq = ClClassGetPropQualifierCount(ccl, i); iq < mq; iq++) {
      char           *qname;
      ClClassGetPropQualifierAt(ccl, i, iq, &d, &qname);
      ClClassAddPropertyQualifierSpecial(&cl->hdr, prop, qname, d,
                                         &ccl->hdr);
      if (!(d.type & CMPI_ARRAY))
        sfcb_native_release_CMPIValue(d.type, &d.value);
      // CJB free(qname);
    }
    // CJB free(pname);
  }

  /*
   * CJB for (i=0,m=ClClassGetMethodCount(ccl); i<m; i++) {
   * ClClassGetMethodAt(ccl,i,&t,&name,&quals);
   * methId=ClClassAddMethod(cl, name, t);
   * meth=((ClMethod*)ClObjectGetClSection(&cl->hdr,&cl->methods))+methId-1;
   * 
   * // CJB // for (iq=0,mq=ClClassGetMethQualifierCount(ccl,methId-1);
   * iq<mq; iq++) { // ClClassGetMethQualifierAt(ccl, meth, iq, &d,
   * &name); // ClClassAddMethodQualifier(&cl->hdr, meth, name, d); // }
   * 
   * 
   * for (ip=0,mp=ClClassGetMethParameterCount(ccl,methId-1); ip<mp; ip++) 
   * { ClClassGetMethParameterAt(ccl, meth, ip, &p, &name);
   * parmId=ClClassAddMethParameter(&cl->hdr, meth, name, p);
   * parm=((ClParameter*)ClObjectGetClSection(&cl->hdr,&meth->parameters))+parmId-1;
   * 
   * for (iq=0,mq=ClClassGetMethParamQualifierCount(ccl,parm); iq<mq;
   * iq++) { ClClassGetMethParamQualifierAt(ccl, parm, iq, &d, &name);
   * ClClassAddMethParamQualifier(&cl->hdr, parm, name, d); } } } 
   */
  return 0;
}
Exemple #4
0
int
cls2xml(CMPIConstClass * cls, UtilStringBuffer * sb, unsigned int flags)
{
  ClClass        *cl = (ClClass *) cls->hdl;
  int             i,
                  m,
                  q,
                  qm,
                  p,
                  pm;
  char           *type,
                 *superCls;
  CMPIString     *name,
                 *qname,
                 *refName;
  CMPIData        data,
                  qdata;
  CMPIType        mtype;
  unsigned long   quals;
  UtilStringBuffer *qsb = UtilFactory->newStrinBuffer(1024);

  _SFCB_ENTER(TRACE_CIMXMLPROC, "cls2xml");

  SFCB_APPENDCHARS_BLOCK(sb, "<CLASS NAME=\"");
  sb->ft->appendChars(sb, cls->ft->getCharClassName(cls));
  superCls = (char *) cls->ft->getCharSuperClassName(cls);
  if (superCls) {
    SFCB_APPENDCHARS_BLOCK(sb, "\" SUPERCLASS=\"");
    sb->ft->appendChars(sb, superCls);
  }
  SFCB_APPENDCHARS_BLOCK(sb, "\">\n");
  if (flags & FL_includeQualifiers)
    quals2xml(cl->quals, sb);

  if (flags & FL_includeQualifiers)
    for (i = 0, m = ClClassGetQualifierCount(cl); i < m; i++) {
      data = cls->ft->getQualifierAt(cls, i, &name, NULL);
      DATA2XML(&data, cls, name, NULL, "<QUALIFIER NAME=\"",
               "</QUALIFIER>\n", sb, NULL, 0, 0);
    }

  for (i = 0, m = ClClassGetPropertyCount(cl); i < m; i++) {
    qsb->ft->reset(qsb);
    data = getPropertyQualsAt(cls, i, &name, &quals, &refName, NULL);
    if (flags & FL_includeQualifiers)
      quals2xml(quals << 8, qsb);
    if (flags & FL_includeQualifiers)
      for (q = 0, qm = ClClassGetPropQualifierCount(cl, i); q < qm; q++) {
        qdata = internalGetPropQualAt(cls, i, q, &qname, NULL);
        DATA2XML(&qdata, cls, qname, NULL, "<QUALIFIER NAME=\"",
                 "</QUALIFIER>\n", qsb, NULL, 0, 0);
        CMRelease(qname);
        sfcb_native_release_CMPIValue(qdata.type, &qdata.value);
      }
    if (data.type & CMPI_ARRAY)
      DATA2XML(&data, cls, name, NULL, "<PROPERTY.ARRAY NAME=\"",
               "</PROPERTY.ARRAY>\n", sb, qsb, 0, 0);
    else {
      type = dataType(data.type);
      if (*type == '*') {
        DATA2XML(&data, cls, name, refName, "<PROPERTY.REFERENCE NAME=\"",
                 "</PROPERTY.REFERENCE>\n", sb, qsb, 0, 0);
      } else
        DATA2XML(&data, cls, name, NULL, "<PROPERTY NAME=\"",
                 "</PROPERTY>\n", sb, qsb, 0, 0);
    }
    CMRelease(name);
  }

  for (i = 0, m = ClClassGetMethodCount(cl); i < m; i++) {
    ClMethod       *meth;
    ClParameter    *parm;
    char           *sname,
                   *smname;
    CMPIString     *name,
                   *mname;

    qsb->ft->reset(qsb);
    ClClassGetMethodAt(cl, i, &mtype, &smname, &quals);
    mname = sfcb_native_new_CMPIString(smname, NULL, 2);
    meth = ((ClMethod *) ClObjectGetClSection(&cl->hdr, &cl->methods)) + i;

    if (flags & FL_includeQualifiers) {
      for (q = 0, qm = ClClassGetMethQualifierCount(cl, i); q < qm; q++) {
        ClClassGetMethQualifierAt(cl, meth, q, &qdata, &sname);
        name = sfcb_native_new_CMPIString(sname, NULL, 2);
        DATA2XML(&qdata, cls, name, NULL, "<QUALIFIER NAME=\"",
                 "</QUALIFIER>\n", qsb, NULL, 0, 0);
      }
    }

    for (p = 0, pm = ClClassGetMethParameterCount(cl, i); p < pm; p++) {
      CMPIParameter   pdata;
      ClClassGetMethParameterAt(cl, meth, p, &pdata, &sname);
      name = sfcb_native_new_CMPIString(sname, NULL, 2);
      parm = ((ClParameter *)
              ClObjectGetClSection(&cl->hdr, &meth->parameters)) + p;
      param2xml(&pdata, cls, parm, name, qsb, flags);
    }

    method2xml(mtype, mname, "<METHOD NAME=\"", "</METHOD>\n", sb, qsb);
  }

  SFCB_APPENDCHARS_BLOCK(sb, "</CLASS>\n");

  qsb->ft->release(qsb);

  _SFCB_RETURN(0);
}