Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 229504

UserSession null and PropertyProviderAdapter

$
0
0

I've been following the vsphere-wssdk-provider sample provided in the Web Client SDK.  Using the vsphere-client-library I'm trying to retrieve vCenter session information using vise.usersession.UserSession and vise.usersession.UserSessionService.  The sample sets up a PropertyProviderAdapter to pass session data between the client UI and the Java Service by creating a DataServiceExtensionRegistry.

 

   public VmDataProviderImpl(

            UserSessionService userSessionService,

            VimObjectReferenceService vimObjectReferenceService,

            DataServiceExtensionRegistry registry) {

      _userSessionService = userSessionService;

      _vimObjectReferenceService = vimObjectReferenceService;

      registry.registerDataAdapter(this, getProvidedTypeInfos());

   }

 

  I can make this work successfully but my goal is to eliminate the need to use the PropertyProviderAdapter to get session info.  I would like to be able to do something like:

 

private final UserSessionService _userSessionService;

 

   public ServiceImpl(

            UserSessionService userSessionService

            ) {

      _userSessionService = userSessionService;

   }

 

   private ServerInfo getServerInfoObject() {

      UserSession userSession = _userSessionService.getUserSession();

      ServerInfo[] sinfo = userSession.serversInfo;

      return sinfo[0];

   }

 

   private ServiceContent getServiceContent() {

      ServerInfo serverInfoObject = getServerInfoObject();

      String sessionCookie = serverInfoObject.sessionCookie;

      String serviceUrl = serverInfoObject.serviceUrl;

   }

 

The vsphere-wssdk-provider sample uses 'serverGuid' to return ServerInfo but without the using the PropertyProviderAdapter it looks like I won't be able to grab the serverGuid.

 

String serverGuid = _vimObjectReferenceService.getServerGuid(vmRef);  //vmRef is grabbed by the PropertyRequestSpec

 

I need to grab the IP of vCenter and cookie for the current session, which are both properties of a ServerInfo bbject but I would like to know how to achieve this without setting up the PPA.

 

Thanks for any help you can provide.


Viewing all articles
Browse latest Browse all 229504

Trending Articles