/** * Returns the OSInfo for the current operating system. * * @return OSInfo with name, version and vendor of the OS. * @since v2.0 */ public OSInfo GetOSInfo() { // Start logging elapsed time. long tIn = TimerUtil.CurrentTimeMillis(); ILogging logger = AppRegistryBridge.GetInstance().GetLoggingBridge(); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "OSBridge executing getOSInfo..."); } OSInfo result = null; if (this._delegate != null) { result = this._delegate.GetOSInfo(); if (logger != null) { logger.Log(ILoggingLogLevel.Debug, this.apiGroup.ToString(), "OSBridge executed 'getOSInfo' in " + (TimerUtil.CurrentTimeMillis() - tIn) + "ms."); } } else { if (logger != null) { logger.Log(ILoggingLogLevel.Error, this.apiGroup.ToString(), "OSBridge no delegate for 'getOSInfo'."); } } return(result); }
/** * Invokes the given method specified in the API request object. * * @param request APIRequest object containing method name and parameters. * @return APIResponse with status code, message and JSON response or a JSON null string for void functions. Status code 200 is OK, all others are HTTP standard error conditions. */ public new APIResponse Invoke(APIRequest request) { APIResponse response = new APIResponse(); int responseCode = 200; String responseMessage = "OK"; String responseJSON = "null"; switch (request.GetMethodName()) { case "getOSInfo": OSInfo response0 = this.GetOSInfo(); if (response0 != null) { responseJSON = GetJSONProcessor().SerializeObject(response0); } break; default: // 404 - response null. responseCode = 404; responseMessage = "OSBridge does not provide the function '" + request.GetMethodName() + "' Please check your client-side API version; should be API version >= v2.2.15."; break; } response.SetResponse(responseJSON); response.SetStatusCode(responseCode); response.SetStatusMessage(responseMessage); return(response); }