agave-systems/systems-core/src/main/java/org/iplantc/service/systems/model/ProxyServer.java
/**
	 * Deserializes a json object into a ProxyServer. If the provided ProxyServer is
	 * not null, it is updated with the values from the json object. The resulting object is
	 * validated before sending back.
	 * 
	 * @param jsonSystem
	 * @param proxyServer
	 * @return ProxyServer
	 * @throws SystemException
	 */
Deserializes a json object into a ProxyServer. If the provided ProxyServer is
not null, it is updated with the values from the json object. The resulting object is
validated before sending back.

@param jsonSystem
@param proxyServer
@return ProxyServer
@throws SystemException
Deserializes a json object into a ProxyServer . If the provided ProxyServer is not null it is updated with the values from the json object . The resulting object is validated before sending back . @param jsonSystem @param proxyServer @return ProxyServer @throws SystemException
public static ProxyServer fromJSON(JSONObject jsonSystem, ProxyServer proxyServer) throws SystemException
	{
		if (proxyServer == null) {
			proxyServer = new ProxyServer();
		}
		try {
			if (ServiceUtils.isNonEmptyString(jsonSystem, "name")) {
				proxyServer.setName(jsonSystem.getString("name"));
			} else {
				throw new SystemArgumentException("Please specify a valid string value for the 'storage.proxy.name' field.");
			}
			if (ServiceUtils.isNonEmptyString(jsonSystem, "host")) {
				proxyServer.setHost(jsonSystem.getString("host"));
			} else {
				throw new SystemArgumentException("Please specify a valid string value for the 'storage.proxy.host' field.");
			}
			if (jsonSystem.has("port") && !jsonSystem.isNull("port"))
			{
				try 
				{
					int portNumber = jsonSystem.getInt("port");
					if (portNumber > 0) {
						proxyServer.setPort(portNumber);
					} else {
						throw new SystemArgumentException("Invalid 'storage.proxy.port' value. " +
								"If provided, please specify a positive integer value for the port number.");
					}
				}
				catch (Exception e) {
					throw new SystemArgumentException("Invalid 'storage.proxy.port' value " + jsonSystem.get("port") + ". " +
							"If provided, please specify a positive integer value for the port number.");
				}
			}
		}
		catch (JSONException e) {
			throw new SystemException("Failed to parse proxy server description.", e);
		}
		catch (SystemArgumentException e) {
			throw new SystemException("Failed to parse proxy server description. " + e.getMessage(), e);
		}
		catch (Exception e) {
			throw new SystemException("Failed to parse proxy server description. " + e.getMessage(), e);
		}
		return proxyServer;
	}
public static ProxyServer fromJSON ( JSONObject jsonSystem , ProxyServer proxyServer ) throws SystemException { if ( proxyServer == null ) { proxyServer = new ProxyServer ( ) ; } try { if ( ServiceUtils . isNonEmptyString ( jsonSystem , "name" ) ) { proxyServer . setName ( jsonSystem . getString ( "name" ) ) ; } else { throw new SystemArgumentException ( "Please specify a valid string value for the 'storage.proxy.name' field." ) ; } if ( ServiceUtils . isNonEmptyString ( jsonSystem , "host" ) ) { proxyServer . setHost ( jsonSystem . getString ( "host" ) ) ; } else { throw new SystemArgumentException ( "Please specify a valid string value for the 'storage.proxy.host' field." ) ; } if ( jsonSystem . has ( "port" ) && ! jsonSystem . isNull ( "port" ) ) { try { int portNumber = jsonSystem . getInt ( "port" ) ; if ( portNumber > 0 ) { proxyServer . setPort ( portNumber ) ; } else { throw new SystemArgumentException ( "Invalid 'storage.proxy.port' value. " + "If provided, please specify a positive integer value for the port number." ) ; } } catch ( Exception e ) { throw new SystemArgumentException ( "Invalid 'storage.proxy.port' value " + jsonSystem . get ( "port" ) + ". " + "If provided, please specify a positive integer value for the port number." ) ; } } } catch ( JSONException e ) { throw new SystemException ( "Failed to parse proxy server description." , e ) ; } catch ( SystemArgumentException e ) { throw new SystemException ( "Failed to parse proxy server description. " + e . getMessage ( ) , e ) ; } catch ( Exception e ) { throw new SystemException ( "Failed to parse proxy server description. " + e . getMessage ( ) , e ) ; } return proxyServer ; }
Deserializes a json object into a ProxyServer.
Deserializes a json object into a ProxyServer .