在 vSphere Web 客户端插件中,我想获取数据存储的远程主机和远程路径
我在中介类中创建了一个 DataByModelRequest 并从中介调用一个模型
[Event(name="{com.vmware.data.query.events.DataByModelRequest.REQUEST_ID}",
type="com.vmware.data.query.events.DataByModelRequest")]
private function requestData():void {
var requestInfo:DataRequestInfo = new DataRequestInfo(DataUpdateSpec.newImplicitInstance());
var dsdatarequest:DataByModelRequest = DataByModelRequest.newInstance(
_contextObject, DatastoreDataItem, requestInfo);
dispatchEvent(vmdatarequest);
}
[ResponseHandler(name=
"{com.vmware.data.query.events.DataByModelRequest.RESPONSE_ID}")]
public function onDataRetrieved(request:DataByModelRequest,
result:DatastoreDataItem, error:Error):void {
if (error != null) {
Alert.show("ERROR");
_logger.debug("onDataRetrieved error: " + error.message);
return;
}
else
Alert.show(ObjectUtil.toString(_contextObject));
Alert.show("RETRIVED");
// Assigning the result to variables to update the view.
_view.dsprop = result;
Alert.show(ObjectUtil.toString(result));
}
DatastoreDataItem 是我的模型类
[Bindable]
[Model(type="Datastore")]
public class DatastoreDataItem extends DataObject {
[Model(relation="info.nas", property="type")]
public var type:String;
[Model(relation="info.nas", property="remoteHost")]
public var remotehost:String;
[Model(relation="info.nas", property="remotePath")]
public var remotepath:String;
[Model(property="url")]
public var url:String;
}
我正在为所有字段获取空值,但名称工作正常,我也尝试了 [Model(type="NasDatastoreInfo")]