public static WSManEndpoint fromMap(Map<String, String> attributes) throws MalformedURLException { WSManEndpoint.Builder builder = new WSManEndpoint.Builder(attributes.get(URL)); builder.withServerVersion(WSManVersion.valueOf(attributes.get(SERVER_VERSION))); if (Boolean.parseBoolean(attributes.get(GSS_AUTH))) { builder.withGSSAuth(); } builder.withStrictSSL(Boolean.parseBoolean(attributes.get(STRICT_SSL))); if (attributes.containsKey(USERNAME)) { builder.withBasicAuth(attributes.get(USERNAME), attributes.get(PASSWORD)); } if (attributes.containsKey(CONNECTION_TIMEOUT)) { builder.withConnectionTimeout(Integer.parseInt(attributes.get(CONNECTION_TIMEOUT))); } if (attributes.containsKey(MAX_ELEMENTS)) { builder.withMaxElements(Integer.parseInt(attributes.get(MAX_ELEMENTS))); } if (attributes.containsKey(MAX_ENVELOPE_SIZE)) { builder.withMaxEnvelopeSize(Integer.parseInt(attributes.get(MAX_ENVELOPE_SIZE))); } if (attributes.containsKey(RECEIVE_TIMEOUT)) { builder.withReceiveTimeout(Integer.parseInt(attributes.get(RECEIVE_TIMEOUT))); } return builder.build(); }
public static Map<String, String> toMap(WSManEndpoint endpoint) { Map<String, String> attributes = new HashMap<>(); attributes.put(URL, endpoint.getUrl().toString()); attributes.put(SERVER_VERSION, endpoint.getServerVersion().toString()); attributes.put(GSS_AUTH, Boolean.toString(endpoint.isGSSAuth())); attributes.put(STRICT_SSL, Boolean.toString(endpoint.isStrictSSL())); if (endpoint.isBasicAuth()) { attributes.put(USERNAME, endpoint.getUsername()); attributes.put(PASSWORD, endpoint.getPassword()); } if (endpoint.getConnectionTimeout() != null) { attributes.put(CONNECTION_TIMEOUT, endpoint.getConnectionTimeout().toString()); } if (endpoint.getMaxElements() != null) { attributes.put(MAX_ELEMENTS, endpoint.getMaxElements().toString()); } if (endpoint.getMaxEnvelopeSize() != null) { attributes.put(MAX_ENVELOPE_SIZE, endpoint.getMaxEnvelopeSize().toString()); } if (endpoint.getReceiveTimeout() != null) { attributes.put(RECEIVE_TIMEOUT, endpoint.getReceiveTimeout().toString()); } return attributes; }
public static Map<String, String> toMap(WSManEndpoint endpoint) { Map<String, String> attributes = new HashMap<>(); attributes.put(URL, endpoint.getUrl().toString()); attributes.put(SERVER_VERSION, endpoint.getServerVersion().toString()); attributes.put(GSS_AUTH, Boolean.toString(endpoint.isGSSAuth())); attributes.put(STRICT_SSL, Boolean.toString(endpoint.isStrictSSL())); if (endpoint.isBasicAuth()) { attributes.put(USERNAME, endpoint.getUsername()); attributes.put(PASSWORD, endpoint.getPassword()); } if (endpoint.getConnectionTimeout() != null) { attributes.put(CONNECTION_TIMEOUT, endpoint.getConnectionTimeout().toString()); } if (endpoint.getMaxElements() != null) { attributes.put(MAX_ELEMENTS, endpoint.getMaxElements().toString()); } if (endpoint.getMaxEnvelopeSize() != null) { attributes.put(MAX_ENVELOPE_SIZE, endpoint.getMaxEnvelopeSize().toString()); } if (endpoint.getReceiveTimeout() != null) { attributes.put(RECEIVE_TIMEOUT, endpoint.getReceiveTimeout().toString()); } return attributes; }
public static WSManEndpoint fromMap(Map<String, String> attributes) throws MalformedURLException { WSManEndpoint.Builder builder = new WSManEndpoint.Builder(attributes.get(URL)); builder.withServerVersion(WSManVersion.valueOf(attributes.get(SERVER_VERSION))); if (Boolean.parseBoolean(attributes.get(GSS_AUTH))) { builder.withGSSAuth(); } builder.withStrictSSL(Boolean.parseBoolean(attributes.get(STRICT_SSL))); if (attributes.containsKey(USERNAME)) { builder.withBasicAuth(attributes.get(USERNAME), attributes.get(PASSWORD)); } if (attributes.containsKey(CONNECTION_TIMEOUT)) { builder.withConnectionTimeout(Integer.parseInt(attributes.get(CONNECTION_TIMEOUT))); } if (attributes.containsKey(MAX_ELEMENTS)) { builder.withMaxElements(Integer.parseInt(attributes.get(MAX_ELEMENTS))); } if (attributes.containsKey(MAX_ENVELOPE_SIZE)) { builder.withMaxEnvelopeSize(Integer.parseInt(attributes.get(MAX_ENVELOPE_SIZE))); } if (attributes.containsKey(RECEIVE_TIMEOUT)) { builder.withReceiveTimeout(Integer.parseInt(attributes.get(RECEIVE_TIMEOUT))); } return builder.build(); }