_schemaCache.put(classId, schema);
}
public void addObject(QmfAgentData object) throws QmfException
{
SchemaClassId classId = object.getSchemaClassId();
SchemaClass schema = _schemaCache.get(classId);
// Try to create an objectName using the set of property names that have been specified as idNames in the schema
StringBuilder buf = new StringBuilder();
if (schema != null && schema instanceof SchemaObjectClass)
{
String[] idNames = ((SchemaObjectClass)schema).getIdNames();
for (String name : idNames)
{
buf.append(object.getStringValue(name));
}
}
String objectName = buf.toString();
// If the schema hasn't given any help we use a UUID
if (objectName.length() == 0) objectName = UUID.randomUUID().toString();
// Finish up the name by incorporating package and class names
objectName = classId.getPackageName() + ":" + classId.getClassName() + ":" + objectName;
// Now we've got a good name for the object we create it's ObjectId and add that to the object
ObjectId addr = new ObjectId("test"/*name*/, objectName, 0/*epoch*/);
object.setObjectId(addr);