public String getMessage() { return (String) getCurrentProperty("message"); }
/** @since SDK5.1 */ public UserSession loginByToken(String locale) throws InvalidLogin, InvalidLocale, RuntimeFault, RemoteException { return getVimService().loginByToken(getMOR(), locale); }
protected boolean validate(final ServiceInstance serviceInstance) { if (serviceInstance == null || serviceInstance.getSessionManager() == null) { return false; } else { return serviceInstance.getSessionManager().getCurrentSession() != null; } }
ServiceInstance oldsi = getServerConnection().getServiceInstance(); ServerConnection oldsc = oldsi.getServerConnection(); String ticket = oldsi.getSessionManager().acquireCloneTicket(); newsc.setServiceInstance(newsi); UserSession userSession = newsi.getSessionManager().cloneSession(ticket); newsc.setUserSession(userSession); return newsi;
protected boolean validate(final ServiceInstance serviceInstance) { if (serviceInstance == null || serviceInstance.getSessionManager() == null) { return false; } else { return serviceInstance.getSessionManager().getCurrentSession() != null; } }
public static void main(String[] args) throws Exception { String session = "vmware_soap_session=\"5229c547-1342-47d1-e830-223d99a47fba\""; ServiceInstance si = new ServiceInstance(new URL("https://10.17.218.174/sdk"), session , true); UserSession userSession = si.getSessionManager().getCurrentSession(); System.out.println("username=" + userSession.getUserName()); System.out.println("fullname=" + userSession.getFullName()); }
/** * @since SDK5.0 */ public SessionManagerGenericServiceTicket acquireGenericServiceTicket(SessionManagerServiceRequestSpec spec) throws RuntimeFault, RemoteException { return getVimService().acquireGenericServiceTicket(getMOR(), spec); }
public String[] getSupportedLocaleList() { return (String[]) getCurrentProperty("supportedLocaleList"); }
public static void main(String[] args) throws Exception { String session = "vmware_soap_session=\"5229c547-1342-47d1-e830-223d99a47fba\""; ServiceInstance si = new ServiceInstance(new URL("https://10.17.218.174/sdk"), session , true); UserSession userSession = si.getSessionManager().getCurrentSession(); System.out.println("username=" + userSession.getUserName()); System.out.println("fullname=" + userSession.getFullName()); }
/** @since SDK4.0 * You don't need to use this method. Instead, look at the other cloneSession method. * */ public UserSession cloneSession(String cloneTicket) throws InvalidLogin, RuntimeFault, RemoteException { return getVimService().cloneSession(getMOR(), cloneTicket); }
public String getDefaultLocale() { return (String) getCurrentProperty("defaultLocale"); }
public boolean isRefreshRequired(RefreshingServiceInstance si) { try { si.currentTime(); Calendar cal = si.getSessionManager().getCurrentSession().getLoginTime(); long loginTime = cal.getTimeInMillis(); long age = System.currentTimeMillis() - loginTime; if (age > TimeUnit.MINUTES.toMillis(15)) { return true; } } catch (Exception e) { // if the currentTime() call is rejected our session token is likely // expired return true; } return false; }
/** @since SDK4.0 */ public UserSession loginExtensionBySubjectName(String extensionKey, String locale) throws InvalidLogin, InvalidLocale, NotFound, NoClientCertificate, NoSubjectName, RuntimeFault, RemoteException { return getVimService().loginExtensionBySubjectName(getMOR(), extensionKey, locale); }
public String[] getMessageLocaleList() { return (String[]) getCurrentProperty("messageLocaleList"); }
/** @since SDK4.0 * This method is called in the cloneSession method. If you happen to use this method, * please double check if it's really needed. * */ public String acquireCloneTicket() throws RuntimeFault, RemoteException { return getVimService().acquireCloneTicket(getMOR()); }
public UserSession[] getSessionList() { return (UserSession[]) getCurrentProperty("sessionList"); }
/** @since SDK4.0 */ public UserSession loginExtensionByCertificate(String extensionKey, String locale) throws InvalidLogin, InvalidLocale, NoClientCertificate, RuntimeFault, RemoteException { return getVimService().loginExtensionByCertificate(getMOR(), extensionKey, locale); }
public UserSession getCurrentSession() { return (UserSession) getCurrentProperty("currentSession"); }
public UserSession loginBySSPI(String base64Token, String locale) throws InvalidLogin, InvalidLocale, SSPIChallenge, RuntimeFault, RemoteException { return getVimService().loginBySSPI(getMOR(), base64Token, locale); }
public ServiceInstance(URL url, String sessionStr, boolean ignoreCert, String namespace) throws RemoteException, MalformedURLException { if(url == null || sessionStr ==null) { throw new NullPointerException("None of url, session string can be null."); } setMOR(SERVICE_INSTANCE_MOR); VimPortType vimService = new VimPortType(url.toString(), ignoreCert); WSClient wsc = vimService.getWsc(); wsc.setCookie(sessionStr); wsc.setVimNameSpace(namespace); serviceContent = vimService.retrieveServiceContent(SERVICE_INSTANCE_MOR); wsc.setSoapActionOnApiVersion(serviceContent.getAbout().getApiVersion()); setServerConnection(new ServerConnection(url, vimService, this)); serviceContent = vimService.retrieveServiceContent(SERVICE_INSTANCE_MOR); //with new SOAP_ACTION UserSession userSession = (UserSession) getSessionManager().getCurrentProperty("currentSession"); getServerConnection().setUserSession(userSession); }