PageRenderTime 53ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/modules/etl/mulesoft/src/main/java/com/liferay/mule/internal/connection/config/LiferayProxyConfig.java

http://github.com/liferay/liferay-portal
Java | 72 lines | 43 code | 13 blank | 16 comment | 4 complexity | 84cccdb5d3a00d42e17dbd01f3b9c7c5 MD5 | raw file
Possible License(s): LGPL-2.0
  1. /**
  2. * Copyright (c) 2000-2021 Liferay, Inc. All rights reserved.
  3. *
  4. * This library is free software; you can redistribute it and/or modify it under
  5. * the terms of the GNU Lesser General Public License as published by the Free
  6. * Software Foundation; either version 2.1 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  11. * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  12. * details.
  13. */
  14. package com.liferay.mule.internal.connection.config;
  15. import org.mule.runtime.extension.api.annotation.param.Optional;
  16. import org.mule.runtime.extension.api.annotation.param.Parameter;
  17. import org.mule.runtime.extension.api.annotation.param.display.DisplayName;
  18. import org.mule.runtime.extension.api.annotation.param.display.Password;
  19. import org.mule.runtime.extension.api.annotation.param.display.Placement;
  20. import org.mule.runtime.http.api.client.proxy.ProxyConfig;
  21. import org.mule.runtime.http.api.client.proxy.ProxyConfigBuilder;
  22. /**
  23. * @author Matija Petanjek
  24. */
  25. public class LiferayProxyConfig {
  26. public ProxyConfig getProxyConfig() {
  27. if ((proxyHost != null) && (proxyPort != null)) {
  28. ProxyConfigBuilder proxyConfigBuilder = ProxyConfig.builder();
  29. proxyConfigBuilder.host(proxyHost);
  30. proxyConfigBuilder.password(proxyPassword);
  31. proxyConfigBuilder.port(proxyPort);
  32. proxyConfigBuilder.username(proxyUsername);
  33. return proxyConfigBuilder.build();
  34. }
  35. return null;
  36. }
  37. private static final String PROXY_CONFIG = "Proxy Config";
  38. @DisplayName("Host")
  39. @Optional
  40. @Parameter
  41. @Placement(order = 1, tab = PROXY_CONFIG)
  42. private String proxyHost;
  43. @DisplayName("Password")
  44. @Optional
  45. @Parameter
  46. @Password
  47. @Placement(order = 4, tab = PROXY_CONFIG)
  48. private String proxyPassword;
  49. @DisplayName("Port")
  50. @Optional
  51. @Parameter
  52. @Placement(order = 2, tab = PROXY_CONFIG)
  53. private Integer proxyPort;
  54. @DisplayName("Username")
  55. @Optional
  56. @Parameter
  57. @Placement(order = 3, tab = PROXY_CONFIG)
  58. private String proxyUsername;
  59. }