Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
themeEclipse
private static void configureHttpClient2Proxy(HttpClient httpClient, HttpMethod method) {
	String proxyHost = System.getProperty("http.proxyHost");
	if (proxyHost == null || "".equals(proxyHost)) {
		return;
	}
	try {
		org.apache.commons.httpclient.URI apacheUri = method.getURI();
		java.net.URI javaUri = null;
		if (apacheUri.isAbsoluteURI()==false) {
			javaUri = new 
			java.net.URI(httpClient.getHostConfiguration().getHostURL());
	} else {
		javaUri = new java.net.URI(apacheUri.toString());
	}
	// ProxySelector
	List<Proxy> selectedProxy = 
	ProxySelector.getDefault().select(javaUri);
	if (selectedProxy.size()==0 || 
	selectedProxy.get(0).type()==Proxy.Type.DIRECT) {
		// No proxy needed.
		return;
	}
	HostConfiguration hc = httpClient.getHostConfiguration();
	hc.setHost(javaUri.getHost(), javaUri.getPort(), 
	Protocol.getProtocol(javaUri.getScheme()));
	Proxy proxy = selectedProxy.get(0);
	InetSocketAddress proxyAddress = (InetSocketAddress) proxy.address();
	hc.setProxy(proxyAddress.getHostName(),proxyAddress.getPort());
	if (System.getProperty("http.proxyUserName") != null) {
		httpClient.getState().setProxyCredentials(null, null,
			new UsernamePasswordCredentials(System.getProperty("http.proxyUserName"), System.getProperty("http.proxyPassword")));
		httpClient.getState().setAuthenticationPreemptive(true);
	}


  } catch (URISyntaxException ex) {
		LOG.log(Level.WARNING, null, ex);
  } catch (URIException ex) {
		lOG.log(Level.WARNING, null, ex);
  }
}


Back to Top

...



...

The XperienCentral Performance Dashboard provides detailed information about how the parts of XperienCentral's infrastructure are functioning. The Performance Dashboard measures the speed and response time of page requests and internal queries as well as other settings that affect how XperienCentral is performing and rates the results according to the optimal expected results. The Performance Dashboard plugin is extensible, which allows you to create plugins that add custom performance indicators. Any custom indicators you create appear on a special tab named “Custom System Performance Indicators”.

Use the methods in the following classes to implement your custom performance indicators:

  • SystemHealthIndicator
  • SystemHealthIndicator.ValueStatus
Note
  • The indicators are called “System health” indicators instead of “Performance indicators”. The reason for this is that although the current focus is on implementing performance indicators, XperienCentral intends to support more generic system health indicators in the future.
  • For complete information on the methods in these classes, see the XperienCentral API Javadoc. For complete information about plugin extensibility, see Extensibility.

The following sample adds a category named “My Category” containing an indicator named “test custom PI” to the “Custom System Performance Indicators” tab.

Code Block
themeEclipse
public class CustomServiceImpl extends SimpleServiceComponent implements SystemHealthIndicatorExtensionPoint {
	// Private logger for this class
	private static final Logger LOG = Logger.getLogger(CustomServiceImpl.class.getName());
	public SystemHealthIndicator[] getPerformanceIndicators() {
	return new SystemHealthIndicator[] {new CustomPI()};
	}

	class CustomPI implements SystemHealthIndicator{
		public String getId() {return "testPI";};
		public String getCategory() {return "my category";}
		public String getType() {return TYPE_CUSTOM;};
		public String getName(Language language) {return "test custom PI";}
		public Object getValue() {return myCache.getCacheRatio;}
		public ValueStatus getValueState() {return myValueStatus;}
		public String getMessage(Language language) {return "test custom PI";}
		public void reset() {}
	}
}

Back to Top

Creating an Extension for the User Profiles Component

...