I want to send the _contextObject of a vsphere object (HostSystem) in DataProvider Adapter as an parameter in the dispatch request for which I'm doing the following:
Flex layer:
addPropertyParameter | () | method |
public function addPropertyParameter(property:String, parameter:Object):void
Adds a parameter to be passed to Data Service when retrieving a certain property.
Parameters
property:String — The property name in form of relationship.relationship.property. | |
parameter:Object — The parameter value to pass; a single parameter can be passed for a particular property. |
You don't need to pass your HostSystem object as parameter in that case, it's already part of the query since it is the object from which you want to retrieve some properties (if you are using a DataProviderAdapter you can find a reference to it in the QuerySpec.constraint which will be an ObjectIdendityConstraint and the object in question is the "target" field. If you are using a PropertyProviderAdapter the object is in the PropertyRequestSpec.objects array)
When you do need to pass 1 or more parameters you can retrieve them in the propertySpec.parameters array on the java side.
Looking at the chassis-ui & chassis-service example
in validateConstraint method being called by validateQuerySpec->
Isn't the source of custom type ? which would not provide me information on which Host System I'm using it on. So in my current use case
I have a data provider Adapter which needs to get network information for a a specific host. Without using the relationship constraint I want to pass in the HostSystem(_contextObject or it _contextObject.uid ) as one of the parameters
For which I used
var requestInfo:DataRequestInfo =
new DataRequestInfo(DataUpdateSpec.newImplicitInstance());
var testDBMR:DataByModelRequest = DataByModelRequest.newInstance(_contextObject,NetworkConfigInfo,requestInfo);
var ctxObj:Object=Object(_contextObject);
testDBMR.addPropertyParameter("ContextUID",ctxObj);
// Dispatch an event to fetch _contextObject data from the server
// along the specified model.
dispatchEvent(testDBMR);
I don't see the addition paramter passed in the service layer . Is there something that I'm doing incorectly?
Service Layer:
But the ParameterSpec in the QueryRequest show up as zero and the property itself is null .
2012-12-20 13:52:11.548] INFO [INFO ] http-bio-9443-exec-8 System.out
[2012-12-20 13:52:11.548] DEBUG [DEBUG] http-bio-9443-exec-8 com.vmware.vise.data.query.impl.DataServiceImpl QuerySpecs to execute:
Query[0]:
QuerySpec
QueryName: dam-auto-generated: ListViewMediator:dr-39
ResourceSpec
Constraint: Constraint
TargetType: samples:Chassis
PropertySpec[1]
ProviderType: samples:Chassis
Relationship: null
Properties[2]
PropertyName: name
PropertyName: serverType
ResultSpec:
Offset: 0
MaxResultCount: 70
OrderingCriteria: null
[2012-12-20 13:52:11.549] INFO [INFO ] http-bio-9443-exec-8 System.out DEBUG-pSpec0
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-12-20 13:52:11.549] INFO [INFO ] http-bio-9443-exec-8 System.out DEBUG params length is zero
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-
I based my earlier reply on the code you provided:
var testDBMR:DataByModelRequest =
DataByModelRequest.newInstance(_contextObject,ChassisSummaryDetails,requestInfo);
This request doesn't need the context object to be added as parameter, it will be in the "target" of the ObjectIdentityConstraint in your DPA.
But now I am confused... are you trying to get the ChassisSummaryDetails when a HostSystem is selected?
_contextObject here represents whatever object is selected in the inventory for that view.
The query you show later is for the samples:Chassis object, so it's normal that the parameter added for a host query doesn't show up.
Sorry for the confusion, I wanted to pass in the HostSystem - contextObject information to the DAP for my custom object , for which I have posed this question . My plugin in is an extended point of vsphere.core.host.manage.storageViews.
The DAP which needs to get network information for a a specific host. Without using the relationship constraint I want to pass in the HostSystem(_contextObject or it _contextObject.uid ) as one of the parameters in the request .
To verify/experiment if the above functionality works I built a modified example similar to the Chassis-ui example and with the following additions.
So my question still remains is the addPropertyParameter in DataByModelRequest class work ? Is this the right way to pass down additional parameters ?
Here is a modified version of the Chassis-ui Example :with the emphasis on testDBMR.addPropertyParameter("ContextUID",ctxObject);
var requestInfo:DataRequestInfo = new DataRequestInfo(DataUpdateSpec.newImplicitInstance());
var testDBMR:DataByModelRequest = DataByModelRequest.newInstance(_contextObject,ChassisSummaryDetails,requestInfo);
var ctxObj:Object=Object(_contextObject);
testDBMR.addPropertyParameter("ContextUID",ctxObj);
// Dispatch an event to fetch _contextObject data from the server
// along the specified model.
dispatchEvent(testDBMR);
However the response doesn't show up the Parameter Spec :
Modified version of code in service layer
Service Layer:
But the ParameterSpec in the QueryRequest show up as zero and the property itself is null .
2012-12-20 13:52:11.548] INFO [INFO ] http-bio-9443-exec-8 System.out
[2012-12-20 13:52:11.548] DEBUG [DEBUG] http-bio-9443-exec-8 com.vmware.vise.data.query.impl.DataServiceImpl QuerySpecs to execute:
Query[0]:
QuerySpec
QueryName: dam-auto-generated: ListViewMediator:dr-39
ResourceSpec
Constraint: Constraint
TargetType: samples:Chassis
PropertySpec[1]
ProviderType: samples:Chassis
Relationship: null
Properties[2]
PropertyName: name
PropertyName: serverType
ResultSpec:
Offset: 0
MaxResultCount: 70
OrderingCriteria: null
[2012-12-20 13:52:11.549] INFO [INFO ] http-bio-9443-exec-8 System.out DEBUG-pSpec0
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-12-20 13:52:11.549] INFO [INFO ] http-bio-9443-exec-8 System.out DEBUG params length is zero
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-12-20 13:52:11.549] DEBUG [DEBUG] data-service-pool-173 com.vmware.vise.util.session.SessionUtil Client id is - c80c761d-4c4b-46b5-a711-f9fcd3cb6222, associated with http session id 9F09C4A58CE6CCF0CB4E1C8C38F550EE with context path /vsphere-client-endpoints
[2012-
OK, I looked more closely at the code and the property name used in addPropertyParameter must be an existing property in your model, i.e. you are only adding parameters for properties you defined elsewhere. I agree that the doc is confusing. If you are using the ChassisSummaryDetails you can try adding a parameter for the "serverType" property and see that it works.
Thanks for pointing me to the right direction . I have modified the Chassis -ui code in Flex layer as follows :
ChassisSummaryDetails has property :
[Model(property="serverType")]
/**
* Chassis location.
*/
public var serverType:String;
Hello Laurentsd,
Could you please confirm if this a bug in VMware API ?
If this is a bug , do you think this would be resolved in vSphere Web Client 6.0 .As a VMware Partner we just got Early access to the beta drop. Please let us know .
Thanks
I don't see any bug on my end because I have the sample working the way I described it earlier.
Hello Laurent,
So I tried the following , but have no luck passing a parameter for a propertyName in ParameterSpec. Coud you please confirm that this is correct mechansim for sending down a parameter to a propertyName or a bug in the API.
I have NetworkSummaryDetails -Data model define in the flex layer