Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
JBoss Software server plugin - deprecate http proxy settings and default
Browse files Browse the repository at this point in the history
them to system HTTP Proxy Server settings
  • Loading branch information
Libor Zoubek committed Jun 30, 2014
1 parent dec8bae commit cd995a8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
Expand Up @@ -21,8 +21,6 @@
import java.io.InputStream;
import java.net.URI;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;

import churchillobjects.rss4j.RssDocument;
Expand All @@ -38,6 +36,9 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.common.composite.SystemSetting;
import org.rhq.core.domain.common.composite.SystemSettings;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.enterprise.server.plugin.pc.content.ContentProvider;
Expand All @@ -49,6 +50,8 @@
import org.rhq.enterprise.server.plugin.pc.content.RepoSource;
import org.rhq.enterprise.server.plugin.pc.content.SyncException;
import org.rhq.enterprise.server.plugin.pc.content.SyncProgressWeight;
import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.util.LookupUtil;

/**
* Hook into the server to field requests on JBoss software related packages.
Expand Down Expand Up @@ -83,6 +86,9 @@ public class JBossSoftwareContentSourceAdapter implements ContentProvider, Packa
private final Log log = LogFactory.getLog(this.getClass());

public void initialize(Configuration configuration) throws Exception {
SystemManagerLocal systemManager = LookupUtil.getSystemManager();
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
SystemSettings settings = systemManager.getSystemSettings(overlord);
url = safeGetConfigurationProperty("url", configuration);

if (url == null) {
Expand All @@ -103,6 +109,23 @@ public void initialize(Configuration configuration) throws Exception {
if (sProxyPort != null) {
proxyPort = Integer.parseInt(sProxyPort);
}

// default to global HTTP Proxy settings
if (proxyUrl == null) {
proxyUrl = settings.get(SystemSetting.HTTP_PROXY_SERVER_HOST);
}
if (proxyUsername == null) {
proxyUsername = settings.get(SystemSetting.HTTP_PROXY_SERVER_USERNAME);
}
if (proxyPassword == null) {
proxyPassword = settings.get(SystemSetting.HTTP_PROXY_SERVER_PASSWORD);
}
if (sProxyPort == null) {
sProxyPort = settings.get(SystemSetting.HTTP_PROXY_SERVER_PORT);
if (sProxyPort != null) {
proxyPort = Integer.parseInt(sProxyPort);
}
}
}

public void shutdown() {
Expand Down
Expand Up @@ -32,13 +32,13 @@

<c:group name="proxy" displayName="Proxy Settings" hiddenByDefault="true">
<c:simple-property name="proxyUrl" displayName="Proxy Host" type="string" required="false"
description="Optional. Hostname or IP address of the HTTP proxy server to use for this connection."/>
description="Optional. Hostname or IP address of the HTTP proxy server to use for this connection. This setting is deprecated and if not set, it defaults to appropriate setting in System Settings - Server HTTP Proxy Settings"/>
<c:simple-property name="proxyPort" displayName="Proxy Port" type="string" required="false"
description="Optional. TCP port of the HTTP proxy server to use for this connection."/>
description="Optional. TCP port of the HTTP proxy server to use for this connection. This setting is deprecated and if not set, it defaults to appropriate setting in System Settings - Server HTTP Proxy Settings"/>
<c:simple-property name="proxyUsername" displayName="Proxy Username" type="string" required="false"
description="Optional. If the proxy server requires authentication, this is the user to log in as."/>
description="Optional. If the proxy server requires authentication, this is the user to log in as. This setting is deprecated and if not set, it defaults to appropriate setting in System Settings - Server HTTP Proxy Settings"/>
<c:simple-property name="proxyPassword" displayName="Proxy Password" type="password" required="false"
description="Optional. If the proxy server requires authentication, this is the password for the user."/>
description="Optional. If the proxy server requires authentication, this is the password for the user. This setting is deprecated and if not set, it defaults to appropriate setting in System Settings - Server HTTP Proxy Settings"/>
</c:group>

</configuration>
Expand Down

0 comments on commit cd995a8

Please sign in to comment.