目前我正在尝试创建一个vsphere Web服务。我已经导出了所有必要的后端类以及其他一些解析器。我的想法是,我需要扩展DataProviderAdapter,以便从GUI发送和接收信息。问题来了,我对这项技术没有经验。不幸的是,vmware sdk的文档不是很清楚,我仍然迷失了。这个想法是如何根据GUI发送和接收不同的数据。例如,GUI想要显示有关主机的信息,并将该请求发送给我,我需要做什么以及如何做。这是我到目前为止所做的例子:
公共抽象类DataObject实现DataProviderAdapter {
class ResourceType implements ResourceTypeResolver
{
/**
* A method parses a given URI and return a String containing the type of
* custom object to which the URI pertains. For example,
* for a URI that referred to a given custom DataObject object,
* the getResourceType() method must return the String “samples:DataObject”.
*/
@Override
public String getResourceType(URI uri)
{
return null;
}
/**
* The getServerGuid() method parsed a given URI and returns a String containing
* the server global unique identifier for the URI target object, if any.
*/
@Override
public String getServerGuid(URI uri)
{
return null;
}
public DataObject(DataService dataService, ResourceTypeResolverRegistry typeResolverRegistry)
{
if (null == dataService || null == typeResolverRegistry)
{
throw new NullPointerException("Some of the arguments is null!");
}
this.dataService = dataService;
try
{
}catch(UnsupportedOperationException unsupportedOperation)
{
logger.warning("ModelObjectUriResolver registration failed:" + unsupportedOperation.getMessage());
}
}
如果你们中的某些人有经验并且可以分享这些例子,我将非常感激。干杯!