void SpeciesReferenceGlyph::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes) { GraphicalObject::readAttributes(attributes,expectedAttributes); const unsigned int sbmlLevel = getLevel (); const unsigned int sbmlVersion = getVersion(); bool assigned = attributes.readInto("speciesReference", mSpeciesReference); if (assigned && mSpeciesReference.empty()) { logEmptyString(mSpeciesReference, sbmlLevel, sbmlVersion, "<" + getElementName() + ">"); } if (!SyntaxChecker::isValidInternalSId(mSpeciesReference)) logError(InvalidIdSyntax); assigned = attributes.readInto("speciesGlyph", mSpeciesGlyph); if (assigned && mSpeciesGlyph.empty()) { logEmptyString(mSpeciesGlyph, sbmlLevel, sbmlVersion, "<" + getElementName() + ">"); } if (!SyntaxChecker::isValidInternalSId(mSpeciesGlyph)) logError(InvalidIdSyntax); std::string role; if(attributes.readInto("role", role)) { this->setRole(role); } else { this->setRole(SPECIES_ROLE_UNDEFINED); } }
/* * Writes (serializes) this SBML object by writing it to XMLOutputStream. */ void Text::write (XMLOutputStream& stream) const { stream.startElement( getElementName() ); writeAttributes( stream ); // in addition to attributes we need to write the characters stream << this->getText(); stream.endElement( getElementName() ); }
void XMLSchemaWriter::writeAbstractClassifier (UMLClassifier *c, QTextStream &XMLschema) { // preparations UMLClassifierList subclasses = c->findSubClassConcepts(); // list of what inherits from us UMLClassifierList superclasses = c->findSuperClassConcepts(); // list of what we inherit from // write the main declaration writeConcreteClassifier (c, XMLschema); writeGroupClassifierDecl (c, subclasses, XMLschema); markAsWritten(c); // now go back and make sure all sub-classing nodes are declared if(subclasses.count() > 0) { QString elementName = getElementName(c); UMLAttributeList attribs = findAttributes(c); QStringList attribGroups = findAttributeGroups(c); writeAttributeGroupDecl(elementName, attribs, XMLschema); // now write out inheriting classes, as needed for(UMLClassifier * classifier = subclasses.first(); classifier; classifier = subclasses.next()) writeClassifier(classifier, XMLschema); } // write out any superclasses as needed for(UMLClassifier *classifier = superclasses.first(); classifier; classifier = superclasses.next()) writeClassifier(classifier, XMLschema); }
InlineTag::InlineElement InlineTag::getElementType(const QByteArray& tag) { int i=InlineTag::InlineElementCount; while(--i>0) if (getElementName(InlineElement(i))==tag) break; return InlineElement(i); }
JointControllerItem::JointControllerItem (BaseRobotItem* parent, const JointController::JointControllerPointer& jointController) : BaseRobotItem("JointController",parent), m_jointController(jointController) { LOG_DEBUG(getElementName().toStdString()); setNumberOfProperties(5); }
GQuestExecuteElement* GQuestExecuteElement::makeElement(XMLTree* pTree) { GQuestExecuteElement* pRet = new GQuestExecuteElement(getElementName()); DWORD index; if (pTree->GetAttribute("index", index)) pRet->m_Index = index; return pRet; }
daeSmartRef<daeElement> daeElement::clone(daeString idSuffix, daeString nameSuffix) { //use the meta object system to create a new instance of this element daeElementRef ret = _meta->create(); ret->setElementName( getElementName() ); //use meta system to copy attributes daeMetaAttributeRefArray &attrs = _meta->getMetaAttributes(); for ( unsigned int i = 0; i < attrs.getCount(); i++ ) { //memcpy( attrs[i]->getWritableMemory( ret ), attrs[i]->getWritableMemory( this ), attrs[i]->getSize() ); attrs[i]->copy( ret, this ); } if ( _meta->getValueAttribute() != NULL ) { daeMetaAttribute *val = _meta->getValueAttribute(); //memcpy( val->getWritableMemory( ret ), val->getWritableMemory( this ), val->getSize() ); val->copy( ret, this ); } //use meta system to child elements if ( _meta->getContents() != NULL ) { daeMetaElementArrayAttribute *contents = _meta->getContents(); for ( int i = 0; i < contents->getCount( this ); i++ ) { ret->placeElement( (*(daeElementRef*)contents->get( this, i ))->clone(idSuffix, nameSuffix) ); } } else { daeMetaElementAttributeArray &meas = _meta->getMetaElements(); for(unsigned int i = 0; i < meas.getCount(); i++) { for ( int c = 0; c < meas[i]->getCount( this ); c++ ) { ret->placeElement( (*(daeElementRef*)meas[i]->get( this, c ))->clone(idSuffix, nameSuffix) ); } } } //ret->ref(); //called because the cast to daeElement* releases a reference causing premature deletion //mangle the id daeMetaAttribute *id = _meta->getIDAttribute(); if ( idSuffix != NULL && id != NULL ) { daeChar str[2048]; id->getType()->memoryToString( id->getWritableMemory( ret ), str, 2048 ); if ( strcmp( str, "" ) ) { strcat( str, idSuffix ); } id->getType()->stringToMemory( str, id->getWritableMemory( ret ) ); } //mangle the name daeMetaAttribute *nm = _meta->getMetaAttribute("name"); if ( nameSuffix != NULL && nm != NULL ) { daeChar str[2048]; nm->getType()->memoryToString( nm->getWritableMemory( ret ), str, 2048 ); if ( strcmp( str, "" ) ) { strcat( str, nameSuffix ); } nm->getType()->stringToMemory( str, nm->getWritableMemory( ret ) ); } //ret->_intObject = _intObject; return ret; }
void ElemElement::namespacesPostConstruction( StylesheetConstructionContext& constructionContext, const NamespacesHandler& theParentHandler, NamespacesHandler& theHandler) { theHandler.postConstruction( constructionContext, false, getElementName(), &theParentHandler); }
// Create a normal entity, but set its name to the value of the node number jobject Snapshot::createRootEntity(JNIEnv *env, jobject entity, sqlm_header_info* pHeader, bool* pbParseChildren) { // Pointer to the data which appears immediately after the header char* pData = (char*)pHeader + sizeof(sqlm_header_info); char* pElementName = getElementName(pHeader->element); // Remember this System entity systemEntity = addEntityToEntity(env, entity, pElementName); // Return the same parent=> all the children of the System entity will surface *pbParseChildren = true; return entity; }
// An group timestamp has two components (seconds + microseconds). Don't // create an entity out of it; rather create one counter in milliseconds. jobject Snapshot::createTimestampEntity(JNIEnv *env, jobject entity, sqlm_header_info* pHeader, bool* pbParseChildren) { char* pElementName = getElementName(pHeader->element); int seconds = getElementValueInt(pHeader, SQLM_ELM_SECONDS); int microseconds = getElementValueInt(pHeader, SQLM_ELM_MICROSEC); uint64 milliseconds = seconds * 1000 + microseconds / 1000; jobject counterValue = makeCounterValueDouble(env, (double)milliseconds); addCounterToEntity(env, entity, pElementName, counterValue); *pbParseChildren = false; return entity; }
status_t XMLNode::assignResourceIds(const sp<AaptAssets>& assets, const ResourceTable* table) { bool hasErrors = false; if (getType() == TYPE_ELEMENT) { String16 attr("attr"); const char* errorMsg; const size_t N = mAttributes.size(); for (size_t i=0; i<N; i++) { const attribute_entry& e = mAttributes.itemAt(i); if (e.ns.size() <= 0) continue; bool nsIsPublic; String16 pkg(getNamespaceResourcePackage(e.ns, &nsIsPublic)); NOISY(printf("Elem %s %s=\"%s\": namespace(%s) %s ===> %s\n", String8(getElementName()).string(), String8(e.name).string(), String8(e.string).string(), String8(e.ns).string(), (nsIsPublic) ? "public" : "private", String8(pkg).string())); if (pkg.size() <= 0) continue; uint32_t res = table != NULL ? table->getResId(e.name, &attr, &pkg, &errorMsg, nsIsPublic) : assets->getIncludedResources(). identifierForName(e.name.string(), e.name.size(), attr.string(), attr.size(), pkg.string(), pkg.size()); if (res != 0) { NOISY(printf("XML attribute name %s: resid=0x%08x\n", String8(e.name).string(), res)); setAttributeResID(i, res); } else { SourcePos(mFilename, getStartLineNumber()).error( "No resource identifier found for attribute '%s' in package '%s'\n", String8(e.name).string(), String8(pkg).string()); hasErrors = true; } } } const size_t N = mChildren.size(); for (size_t i=0; i<N; i++) { status_t err = mChildren.itemAt(i)->assignResourceIds(assets, table); if (err < NO_ERROR) { hasErrors = true; } } return hasErrors ? UNKNOWN_ERROR : NO_ERROR; }
void SpeciesGlyph::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes) { GraphicalObject::readAttributes(attributes,expectedAttributes); const unsigned int sbmlLevel = getLevel (); const unsigned int sbmlVersion = getVersion(); bool assigned = attributes.readInto("species", mSpecies, getErrorLog(), false, getLine(), getColumn()); if (assigned && mSpecies.empty()) { logEmptyString(mSpecies, sbmlLevel, sbmlVersion, "<" + getElementName() + ">"); } if (!SyntaxChecker::isValidInternalSId(mSpecies)) logError(InvalidIdSyntax); }
void ElemLiteralResult::namespacesPostConstruction( StylesheetConstructionContext& constructionContext, const NamespacesHandler& theParentHandler, NamespacesHandler& theHandler) { const AVTPrefixChecker theChecker(m_avts, m_avtsCount); theHandler.postConstruction( constructionContext, true, getElementName(), &theParentHandler, &theChecker); }
void TextGlyph::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes) { GraphicalObject::readAttributes(attributes,expectedAttributes); const unsigned int sbmlLevel = getLevel (); const unsigned int sbmlVersion = getVersion(); bool assigned = attributes.readInto("graphicalObject", mGraphicalObject, getErrorLog(), false, getLine(), getColumn()); if (assigned && mGraphicalObject.empty()) { logEmptyString(mGraphicalObject, sbmlLevel, sbmlVersion, "<" + getElementName() + ">"); } if (!SyntaxChecker::isValidInternalSId(mGraphicalObject)) logError(InvalidIdSyntax); assigned = attributes.readInto("originOfText", mOriginOfText, getErrorLog(), false, getLine(), getColumn()); if (assigned && mOriginOfText.empty()) { logEmptyString(mOriginOfText, sbmlLevel, sbmlVersion, "<" + getElementName() + ">"); } if (!SyntaxChecker::isValidInternalSId(mOriginOfText)) logError(InvalidIdSyntax); attributes.readInto("text", mText, getErrorLog(), false, getLine(), getColumn()); }
void ReactionGlyph::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes) { GraphicalObject::readAttributes(attributes,expectedAttributes); const unsigned int sbmlLevel = getLevel (); const unsigned int sbmlVersion = getVersion(); bool assigned = attributes.readInto("reaction", mReaction); if (assigned && mReaction.empty()) { logEmptyString(mReaction, sbmlLevel, sbmlVersion, "<" + getElementName() + ">"); } if (!SyntaxChecker::isValidInternalSId(mReaction)) logError(InvalidIdSyntax); }
void XMLNode::setAttributeResID(size_t attrIdx, uint32_t resId) { attribute_entry& e = mAttributes.editItemAt(attrIdx); if (e.nameResId) { mAttributeOrder.removeItem(e.nameResId); } else { mAttributeOrder.removeItem(e.index); } NOISY(printf("Elem %s %s=\"%s\": set res id = 0x%08x\n", String8(getElementName()).string(), String8(mAttributes.itemAt(attrIdx).name).string(), String8(mAttributes.itemAt(attrIdx).string).string(), resId)); mAttributes.editItemAt(attrIdx).nameResId = resId; mAttributeOrder.add(resId, attrIdx); }
daeSmartRef<daeElement> daeElement::clone(daeString idSuffix, daeString nameSuffix) { //use the meta object system to create a new instance of this element daeElementRef ret = _meta->create(); ret->setElementName( getElementName() ); //use meta system to copy attributes daeMetaAttributeRefArray &attrs = _meta->getMetaAttributes(); for ( unsigned int i = 0; i < attrs.getCount(); i++ ) { //memcpy( attrs[i]->getWritableMemory( ret ), attrs[i]->getWritableMemory( this ), attrs[i]->getSize() ); attrs[i]->copy( ret, this ); ret->_validAttributeArray[i] = _validAttributeArray[i]; } if ( _meta->getValueAttribute() != NULL ) { daeMetaAttribute *val = _meta->getValueAttribute(); //memcpy( val->getWritableMemory( ret ), val->getWritableMemory( this ), val->getSize() ); val->copy( ret, this ); } daeElementRefArray children; _meta->getChildren( this, children ); for ( size_t x = 0; x < children.getCount(); x++ ) { ret->placeElement( children.get(x)->clone( idSuffix, nameSuffix ) ); } //mangle the id daeMetaAttribute *id = _meta->getIDAttribute(); if ( idSuffix != NULL && id != NULL ) { daeChar str[2048]; id->getType()->memoryToString( id->getWritableMemory( ret ), str, 2048 ); if ( strcmp( str, "" ) ) { strcat( str, idSuffix ); } //id->getType()->stringToMemory( str, id->getWritableMemory( ret ) ); id->set( ret, str ); } //mangle the name daeMetaAttribute *nm = _meta->getMetaAttribute("name"); if ( nameSuffix != NULL && nm != NULL ) { daeChar str[2048]; nm->getType()->memoryToString( nm->getWritableMemory( ret ), str, 2048 ); if ( strcmp( str, "" ) ) { strcat( str, nameSuffix ); } //nm->getType()->stringToMemory( str, nm->getWritableMemory( ret ) ); nm->set( ret, str ); } //ret->_intObject = _intObject; return ret; }
String HtmlScraper::getElementContents() { jassert(isAtElement()); // Locate start of content int startpos = _html.indexOfChar(_position + 1, '>'); if(startpos < 0) return String::empty; startpos++; // Skip left bracket // Locate end tag position String name = getElementName(); int endpos = _html.indexOfIgnoreCase(startpos, "</" + name + ">"); if(endpos < 0) return String::empty; return _html.substring(startpos, endpos); }
// these exist for abstract classes only (which become xs:group nodes) QStringList XMLSchemaWriter::findAttributeGroups (UMLClassifier *c) { // we need to look for any class we inherit from. IF these // have attributes, then we need to notice QStringList list; UMLClassifierList superclasses = c->findSuperClassConcepts(); // list of what inherits from us for(UMLClassifier *classifier = superclasses.first(); classifier; classifier = superclasses.next()) { if(classifier->getAbstract()) { // only classes have attributes.. if (!classifier->isInterface()) { UMLAttributeList attribs = c->getAttributeList(); if (attribs.count() > 0) list.append(getElementName(classifier)+"AttribGroupType"); } } } return list; }
ElementFile::ElementFile(ElementTypeId type, escript::JMPI mpiInfo) : MPIInfo(mpiInfo), numElements(0), Id(NULL), Tag(NULL), Owner(NULL), Nodes(NULL), Color(NULL), minColor(0), maxColor(-1), etype(type) { jacobians = new ElementFile_Jacobians(); jacobians_reducedQ = new ElementFile_Jacobians(); numDim = Dims[type]; numNodes = numDim + 1; numLocalDim = localDims[type]; numShapes = numLocalDim + 1; ename = getElementName(type); }
/** @cond doxygenLibsbmlInternal */ void ReferenceGlyph::readAttributes (const XMLAttributes& attributes, const ExpectedAttributes& expectedAttributes) { const unsigned int sbmlLevel = getLevel (); const unsigned int sbmlVersion = getVersion(); unsigned int numErrs; /* look to see whether an unknown attribute error was logged * during the read of the listOfReferenceGlyphs - which will have * happened immediately prior to this read */ bool loSubGlyphs = false; if (getParentSBMLObject() != NULL && getParentSBMLObject()->getElementName() == "listOfSubGlyphs") { loSubGlyphs = true; } if (getErrorLog() != NULL && static_cast<ListOfReferenceGlyphs*>(getParentSBMLObject())->size() < 2) { numErrs = getErrorLog()->getNumErrors(); for (int n = (int)numErrs-1; n >= 0; n--) { if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute) { const std::string details = getErrorLog()->getError((unsigned int)n)->getMessage(); getErrorLog()->remove(UnknownPackageAttribute); if (loSubGlyphs == true) { getErrorLog()->logPackageError("layout", LayoutLOSubGlyphAllowedAttribs, getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn()); } else { getErrorLog()->logPackageError("layout", LayoutLOReferenceGlyphAllowedAttribs, getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn()); } } else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute) { const std::string details = getErrorLog()->getError((unsigned int)n)->getMessage(); getErrorLog()->remove(UnknownCoreAttribute); if (loSubGlyphs == true) { getErrorLog()->logPackageError("layout", LayoutLOSubGlyphAllowedAttribs, getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn()); } else { getErrorLog()->logPackageError("layout", LayoutLOReferenceGlyphAllowedAttribs, getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn()); } } } } GraphicalObject::readAttributes(attributes, expectedAttributes); // look to see whether an unknown attribute error was logged if (getErrorLog() != NULL) { numErrs = getErrorLog()->getNumErrors(); for (int n = (int)numErrs-1; n >= 0; n--) { if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownPackageAttribute) { const std::string details = getErrorLog()->getError((unsigned int)n)->getMessage(); getErrorLog()->remove(UnknownPackageAttribute); getErrorLog()->logPackageError("layout", LayoutREFGAllowedAttributes, getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn()); } else if (getErrorLog()->getError((unsigned int)n)->getErrorId() == UnknownCoreAttribute) { const std::string details = getErrorLog()->getError((unsigned int)n)->getMessage(); getErrorLog()->remove(UnknownCoreAttribute); getErrorLog()->logPackageError("layout", LayoutREFGAllowedCoreAttributes, getPackageVersion(), sbmlLevel, sbmlVersion, details, getLine(), getColumn()); } } } bool assigned = false; // // glyph SIdRef ( use = "required" ) // assigned = attributes.readInto("glyph", mGlyph); if (getErrorLog() != NULL) { if (assigned == true) { // check string is not empty and correct syntax if (mGlyph.empty() == true) { logEmptyString(mGlyph, getLevel(), getVersion(), "<ReferenceGlyph>"); } else if (SyntaxChecker::isValidSBMLSId(mGlyph) == false) { getErrorLog()->logPackageError("layout", LayoutREFGGlyphSyntax, getPackageVersion(), sbmlLevel, sbmlVersion, "The glyph on the <" + getElementName() + "> is '" + mGlyph + "', which does not conform to the syntax.", getLine(), getColumn()); } } else { std::string message = "Layout attribute 'glyph' is missing."; getErrorLog()->logPackageError("layout", LayoutREFGAllowedAttributes, getPackageVersion(), sbmlLevel, sbmlVersion, message, getLine(), getColumn()); } } // // reference SIdRef ( use = "optional" ) // assigned = attributes.readInto("reference", mReference); if (assigned == true && getErrorLog() != NULL) { // check string is not empty and correct syntax if (mReference.empty() == true) { logEmptyString(mReference, getLevel(), getVersion(), "<ReferenceGlyph>"); } else if (SyntaxChecker::isValidSBMLSId(mReference) == false) { getErrorLog()->logPackageError("layout", LayoutREFGReferenceSyntax, getPackageVersion(), sbmlLevel, sbmlVersion, "The reference on the <" + getElementName() + "> is '" + mReference + "', which does not conform to the syntax.", getLine(), getColumn()); } } // // role string ( use = "optional" ) // std::string role; assigned = attributes.readInto("role", role); if (assigned == true) { // check string is not empty if (role.empty() == true && getErrorLog() != NULL) { logEmptyString(role, getLevel(), getVersion(), "<ReferenceGlyph>"); } this->setRole(role); } }
void ElemLiteralResult::execute(StylesheetExecutionContext& executionContext) const { const XalanDOMString& theElementName = getElementName(); executionContext.startElement(c_wstr(theElementName)); ElemUse::execute(executionContext); const NamespacesHandler& theNamespacesHandler = getNamespacesHandler(); theNamespacesHandler.outputResultNamespaces(executionContext); if (hasPrefix() == false) { // OK, let's check to make sure we don't have to change the default namespace... const XalanDOMString* const theCurrentDefaultNamespace = executionContext.getResultNamespaceForPrefix(s_emptyString); if (theCurrentDefaultNamespace != 0) { const XalanDOMString* const theElementDefaultNamespace = theNamespacesHandler.getNamespace(s_emptyString); if (theElementDefaultNamespace == 0) { // There was no default namespace, so we have to turn the // current one off. executionContext.addResultAttribute(DOMServices::s_XMLNamespace, s_emptyString); } else if (equals(*theCurrentDefaultNamespace, *theElementDefaultNamespace) == false) { executionContext.addResultAttribute(DOMServices::s_XMLNamespace, *theElementDefaultNamespace); } } } if(m_avtsCount > 0) { StylesheetExecutionContext::GetAndReleaseCachedString theGuard(executionContext); XalanDOMString& theStringedValue = theGuard.get(); for(unsigned int i = 0; i < m_avtsCount; ++i) { const AVT* const avt = m_avts[i]; const XalanDOMString& theName = avt->getName(); avt->evaluate(theStringedValue, *this, executionContext); executionContext.addResultAttribute(theName, theStringedValue); theStringedValue.clear(); } } executeChildren(executionContext); executionContext.endElement(c_wstr(theElementName)); }
QualifiedName ParserVocabulary::resolveElementName(const QualifiedNameOrIndex &nameOrIndex) const { unsigned int surrogateIndex = nameOrIndex._nameSurrogateIndex; return (surrogateIndex == INDEX_NOT_SET) ? resolveQualifiedName(nameOrIndex) : getElementName(surrogateIndex); }
void Snapshot::createCounter(JNIEnv *env, jobject entity, sqlm_header_info* pHeader) { // Pointer to the data which appears immediately after the header char* pData = (char*)pHeader + sizeof(sqlm_header_info); char* pElementName = getElementName(pHeader->element); // Ignore unknown counters if (pElementName == NULL) return; jobject counterValue = NULL; if (pHeader->type == SQLM_TYPE_U32BIT) { unsigned int i = *(unsigned int*)pData; counterValue = makeCounterValueDouble(env, i); } else if (pHeader->type == SQLM_TYPE_32BIT) { signed int i = *(signed int*)pData; counterValue = makeCounterValueDouble(env, i); } else if (pHeader->type == SQLM_TYPE_STRING) { counterValue = makeCounterValueString(env, pData, pHeader->size); } else if (pHeader->type == SQLM_TYPE_U16BIT) { unsigned int i = *(unsigned short*)pData; counterValue = makeCounterValueDouble(env, i); } else if (pHeader->type == SQLM_TYPE_16BIT) { signed int i = *(signed short*)pData; counterValue = makeCounterValueDouble(env, i); } else if (pHeader->type == SQLM_TYPE_8BIT) { signed char i = *(signed char*)pData; counterValue = makeCounterValueDouble(env, i); } else if (pHeader->type == SQLM_TYPE_U8BIT) { unsigned int i = *(unsigned char*)pData; counterValue = makeCounterValueDouble(env, i); } else if (pHeader->type == SQLM_TYPE_64BIT) { int64 i = *(int64*)pData; counterValue = makeCounterValueDouble(env, (double)i); } else if (pHeader->type == SQLM_TYPE_U64BIT) { uint64 i = *(uint64*)pData; counterValue = makeCounterValueDouble(env, (double)i); } else // unknown (binary?) counter { counterValue = makeCounterValueString(env, "????", 4); } addCounterToEntity(env, entity, pElementName, counterValue); }
jobject Snapshot::createEntity(JNIEnv *env, jobject entity, sqlm_header_info* pHeader, bool* pbParseChildren) { // Deal with timestamps: don't create entities if (pHeader->element >= SQLM_MIN_TIME_STAMP && pHeader->element <= SQLM_MAX_TIME_STAMP || pHeader->element == SQLM_ELM_STMT_USR_CPU_TIME || pHeader->element == SQLM_ELM_STMT_SYS_CPU_TIME || pHeader->element == SQLM_ELM_TOTAL_SYS_CPU_TIME || pHeader->element == SQLM_ELM_TOTAL_USR_CPU_TIME || pHeader->element == SQLM_ELM_STMT_ELAPSED_TIME || pHeader->element == SQLM_ELM_UOW_ELAPSED_TIME) { return createTimestampEntity(env, entity, pHeader, pbParseChildren); } // deal with databases else if (pHeader->element == SQLM_ELM_DBASE) { return createDatabaseEntity(env, entity, pHeader, pbParseChildren); } // deal with sql queries else if (pHeader->element == SQLM_ELM_DYNSQL) { return createSQLQueryEntity(env, entity, pHeader, pbParseChildren); } // deal with tablespace names else if (pHeader->element == SQLM_ELM_TABLESPACE) { return createTablespaceEntity(env, entity, pHeader, pbParseChildren); } // deal with tablespace containers else if (pHeader->element == SQLM_ELM_TABLESPACE_CONTAINER) { return createTablespaceContainerEntity(env, entity, pHeader, pbParseChildren); } // deal with memory pools else if (pHeader->element == SQLM_ELM_MEMORY_POOL) { return createMemoryPoolEntity(env, entity, pHeader, pbParseChildren); } // deal with applications else if (pHeader->element == SQLM_ELM_APPL) { return createApplicationEntity(env, entity, pHeader, pbParseChildren); } // deal with tables else if (pHeader->element == SQLM_ELM_TABLE) { return createTableEntity(env, entity, pHeader, pbParseChildren); } // deal with bufferpools else if (pHeader->element == SQLM_ELM_BUFFERPOOL) { return createBufferpoolEntity(env, entity, pHeader, pbParseChildren); } // deal with bufferpool nodes else if (pHeader->element == SQLM_ELM_BUFFERPOOL_NODEINFO) { return createBufferpoolNodeEntity(env, entity, pHeader, pbParseChildren); } // deal with application locks else if (pHeader->element == SQLM_ELM_APPL_LOCK_LIST) { return createApplLockEntity(env, entity, pHeader, pbParseChildren); } // deal with switches nodes: skip them else if (pHeader->element == SQLM_ELM_SWITCH_LIST) { *pbParseChildren = false; return entity; } else if (pHeader->element == SQLM_ELM_COLLECTED) { return createRootEntity(env, entity, pHeader, pbParseChildren); } else if (pHeader->element == SQLM_ELM_AGENT) { return createAgentEntity(env, entity, pHeader, pbParseChildren); } else // create a normal entity { // Pointer to the data which appears immediately after the header char* pData = (char*)pHeader + sizeof(sqlm_header_info); char* pElementName = getElementName(pHeader->element); if (pElementName != NULL) { std::string strElementName = std::string(pElementName); // If there is a DB_NAME child element move this under the database std::string strDatabaseName = getElementValueString(pHeader, SQLM_ELM_DB_NAME); std::string strName = strElementName; if (rootEntity == entity && strDatabaseName.size() > 0) strName = strDatabaseName + SEP + strElementName; *pbParseChildren = true; return addEntityToEntity(env, entity, strName.c_str()); } else return entity; } }
/* * Retrieve a specific instance given an object path */ wbem::framework::Instance* wbem::software::ManagementSoftwareIdentityFactory::getInstance( framework::ObjectPath &path, framework::attribute_names_t &attributes) throw (wbem::framework::Exception) { LogEnterExit logging(__FUNCTION__, __FILE__, __LINE__); // create the instance, initialize with attributes from the path framework::Instance *pInstance = new framework::Instance(path); try { m_hostName = m_systemService.getHostName(); checkAttributes(attributes); // make sure the instance ID passed in matches this host framework::Attribute instanceID = path.getKeyValue(INSTANCEID_KEY); if (instanceID.stringValue() == getInstanceId()) { core::Result<core::system::SoftwareInfo> swInfo = m_systemService.getSoftwareInfo(); // ElementName - mgmt sw name + host name if (containsAttribute(ELEMENTNAME_KEY, attributes)) { framework::Attribute a(getElementName(), false); pInstance->setAttribute(ELEMENTNAME_KEY, a, attributes); } // MajorVersion - Mgmt sw major version number if (containsAttribute(MAJORVERSION_KEY, attributes)) { framework::Attribute a(swInfo.getValue().getMgmtSoftwareMajorVersion(), false); pInstance->setAttribute(MAJORVERSION_KEY, a, attributes); } // MinorVersion - Mgmt sw minor version number if (containsAttribute(MINORVERSION_KEY, attributes)) { framework::Attribute a(swInfo.getValue().getMgmtSoftwareMinorVersion(), false); pInstance->setAttribute(MINORVERSION_KEY, a, attributes); } // RevisionNumber - Mgmt sw hotfix number if (containsAttribute(REVISIONNUMBER_KEY, attributes)) { framework::Attribute a(swInfo.getValue().getMgmtSoftwareHotfixVersion(), false); pInstance->setAttribute(REVISIONNUMBER_KEY, a, attributes); } // BuildNumber - Mgmt sw build number if (containsAttribute(BUILDNUMBER_KEY, attributes)) { framework::Attribute a(swInfo.getValue().getMgmtSoftwareBuildVersion(), false); pInstance->setAttribute(BUILDNUMBER_KEY, a, attributes); } // VersionString - Mgmt sw version as a string if (containsAttribute(VERSIONSTRING_KEY, attributes)) { framework::Attribute a(swInfo.getValue().getMgmtSoftwareVersion(), false); pInstance->setAttribute(VERSIONSTRING_KEY, a, attributes); } // Manufacturer - Intel if (containsAttribute(MANUFACTURER_KEY, attributes)) { framework::Attribute a("Intel", false); pInstance->setAttribute(MANUFACTURER_KEY, a, attributes); } // Classifications - 3, "Configuration Software" if (containsAttribute(CLASSIFICATIONS_KEY, attributes)) { framework::UINT16_LIST classifications; classifications.push_back(MANAGEMENTSWIDENTITY_CLASSIFICATIONS_CONFIGSW); framework::Attribute a(classifications, false); pInstance->setAttribute(CLASSIFICATIONS_KEY, a, attributes); } // IsEntity = true if (containsAttribute(ISENTITY_KEY, attributes)) { framework::Attribute a(true, false); pInstance->setAttribute(ISENTITY_KEY, a, attributes); } } else { throw framework::ExceptionBadParameter(INSTANCEID_KEY.c_str()); } } catch (framework::Exception &) // clean up and re-throw { delete pInstance; throw; } catch (core::LibraryException &e) { delete pInstance; throw exception::NvmExceptionLibError(e.getErrorCode()); } return pInstance; }
Boolean UNIX_ComputerSystem::getElementName(CIMProperty &p) const { p = CIMProperty(PROPERTY_ELEMENT_NAME, getElementName()); return true; }
Boolean UNIX_AllocationSchedulingElement::getElementName(CIMProperty &p) const { p = CIMProperty(PROPERTY_ELEMENT_NAME, getElementName()); return true; }
CIMInstance ComputerSystem::buildInstance(const CIMName& className) { CIMInstance instance(className); CIMProperty p; //-- fill in properties for CIM_ComputerSystem if (getCaption(p)) instance.addProperty(p); if (getDescription(p)) instance.addProperty(p); if (getInstallDate(p)) instance.addProperty(p); if (getStatus(p)) instance.addProperty(p); if (getOperationalStatus(p)) instance.addProperty(p); if (getStatusDescriptions(p)) instance.addProperty(p); if (getElementName(p)) instance.addProperty(p); if (getCreationClassName(p)) instance.addProperty(p); if (getName(p)) instance.addProperty(p); if (getNameFormat(p)) instance.addProperty(p); if (getPrimaryOwnerName(p)) instance.addProperty(p); if (getPrimaryOwnerContact(p)) instance.addProperty(p); if (getRoles(p)) instance.addProperty(p); if (getOtherIdentifyingInfo(p)) instance.addProperty(p); if (getIdentifyingDescriptions(p)) instance.addProperty(p); if (getDedicated(p)) instance.addProperty(p); if (getResetCapability(p)) instance.addProperty(p); if (getPowerManagementCapabilities(p)) instance.addProperty(p); // Done if we are servicing CIM_ComputerSystem if (className.equal (CLASS_CIM_COMPUTER_SYSTEM)) return instance; // Fill in properties for CIM_UnitaryComputerSystem if (getInitialLoadInfo(p)) instance.addProperty(p); if (getLastLoadInfo(p)) instance.addProperty(p); if (getPowerManagementSupported(p)) instance.addProperty(p); if (getPowerState(p)) instance.addProperty(p); if (getWakeUpType(p)) instance.addProperty(p); // Done if we are servicing CIM_UnitaryComputerSystem if (className.equal (CLASS_CIM_UNITARY_COMPUTER_SYSTEM)) return instance; // Fill in properties for <Extended>_ComputerSystem if (className.equal (CLASS_EXTENDED_COMPUTER_SYSTEM)) { if(getPrimaryOwnerPager(p)) instance.addProperty(p); if(getSecondaryOwnerName(p)) instance.addProperty(p); if(getSecondaryOwnerContact(p)) instance.addProperty(p); if(getSecondaryOwnerPager(p)) instance.addProperty(p); if(getSerialNumber(p)) instance.addProperty(p); if(getIdentificationNumber(p)) instance.addProperty(p); } return instance; }
Boolean UNIX_ClusteringService::getElementName(CIMProperty &p) const { p = CIMProperty(PROPERTY_ELEMENT_NAME, getElementName()); return true; }