[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.technology.cosmos] Re: parsing query results from multiple MDRs
|
Thanks for the quick response, Dave.
I'm afraid to create defects or enhancements until I understand COSMOS a
bit better. I don't want to spam defects that have already been
addressed or that really work as designed. If we establish that I have
in fact uncovered either a defect or a feature that needs to be
addressed, I'll submit a bug report/feature request.
I thought of using a serializer aggregate but I couldn't figure out what
it would key off of. The problem is that the metadata you'd need to
know which serializer to use (e.g., a schema name or an MDR identifier)
isn't available at the point that the serializer is called.
Yes, a serializer registry could work.
The idea for the last sentence came from the javadoc for
IRecord.setValueFromString:
* Set the value for this record from a string.
* This API is needed because the value coming in
* from XML will be raw text. Implementers are
* responsible for converting this raw text to
* their format of choice.
So, if I created my own implementation of IRecord, I could have it parse
the XML appropriately, using its own serializer instead of the one
registered with CMDBfServicesUtil. But how do I get
QueryOutputStreamHandler to use my IRecord implementation? Here is line
108 of QueryOutputStreamHandler.java:
currentRecord =
CommonArtifactFactory.getInstance().createRecord(currentResultEntity, null);
Why isn't it this?
currentRecord = getArtifactFactory().createRecord(currentResultEntity,
null);
If it were, then I could create different artifact factories for
different MDRs, although that might not be the easiest method.
Dave
David Whiteman wrote:
Hi David,
Is it possible to create a serializer aggregate that keys off something
in the query response, perhaps a namespace, to delgate to model-specific
serializers for the actual work? That might not be an elegant solution
but might work for you in the near term. We would also like to hear
your ideas on what sort of API you would like to see, maybe some sort of
serializer/datatype mapping registry?
It sounds like the last sentence of your post is regarding a separate
problem. When you say it ignores it for most object types, can you give
an example of one for which it does, or a place you think it is doing this?
In general, I would encourage you to create defects and/or enhancements
in our Bugzilla system where appopriate, including specific details and
recreation scenarios, as this will make it more likely that we can get
the work scheduled, and offer more timely solutions. Plus, being the
creator of the defect, you will get notified as the status changes.
Thanks,
David
David Loewenstern wrote:
I apologize if this question has been answered before, but I have not
seen it in the archives.
Say I have an application that queries two _different_ MDRs with
_different_ underlying object models. The application can be
configured so it knows which model goes with which MDR. To make this
concrete, say we have one MDR that handles personnel and a different
MDR that handles IT assets, and we need to construct queries across
both (e.g., "list all assets that are assigned to managers with pay
grade above 10").
I realize it isn't Cosmos's or CMDBf's job to tear apart the query and
route the subqueries to the appropriate MDR, and I'm not worried about
that. The problem I have is specific, and has to do with handling the
query responses.
Both MDRs will send back query responses containing records. For one,
the records will be personnel, for the other, IT assets. As far as I
can tell, the CMDBf will handle both by way of the
QueryOutputStreamHandler, ultimately calling
CMDBfServicesUtil.getRecordSerializer(). There can be only one record
serializer -- it's a class variable, so even if I have two separate
instances of QueryOutputStreamHandler, they will both use the same
record serializer. But I need two serializers, one for the personnel
data model, one for the IT data model. How do I accomplish this?
It seems that there is a problem in that QueryOutputStreamHandler
accepts a user-defined ArtifactFactory but ignores it in favor of
CommonArtifactFactory when creating most object types.
David Loewenstern
davidloe@xxxxxxxxxx