View Javadoc
1   package org.argeo.cms.e4.maintenance;
2   
3   import org.argeo.cms.ui.util.CmsUiUtils;
4   import org.eclipse.swt.SWT;
5   import org.eclipse.swt.layout.GridData;
6   import org.eclipse.swt.widgets.Composite;
7   import org.eclipse.swt.widgets.Label;
8   import org.osgi.framework.ServiceReference;
9   import org.osgi.service.http.HttpService;
10  import org.osgi.service.useradmin.UserAdmin;
11  
12  class ConnectivityDeploymentUi extends AbstractOsgiComposite {
13  	private static final long serialVersionUID = 590221539553514693L;
14  
15  	public ConnectivityDeploymentUi(Composite parent, int style) {
16  		super(parent, style);
17  	}
18  
19  	@Override
20  	protected void initUi(int style) {
21  		StringBuffer text = new StringBuffer();
22  		text.append("<span style='font-variant: small-caps;'>Provided Servers</span><br/>");
23  
24  		ServiceReference<HttpService> userAdminRef = bc.getServiceReference(HttpService.class);
25  		if (userAdminRef != null) {
26  			// FIXME use constants
27  			Object httpPort = userAdminRef.getProperty("http.port");
28  			Object httpsPort = userAdminRef.getProperty("https.port");
29  			if (httpPort != null)
30  				text.append("<b>http</b> ").append(httpPort).append("<br/>");
31  			if (httpsPort != null)
32  				text.append("<b>https</b> ").append(httpsPort).append("<br/>");
33  
34  		}
35  
36  		text.append("<br/>");
37  		text.append("<span style='font-variant: small-caps;'>Referenced Servers</span><br/>");
38  
39  		Label label = new Label(this, SWT.NONE);
40  		label.setData(new GridData(SWT.FILL, SWT.FILL, false, false));
41  		CmsUiUtils.markup(label);
42  		label.setText(text.toString());
43  	}
44  
45  	protected boolean isDeployed() {
46  		return bc.getServiceReference(UserAdmin.class) != null;
47  	}
48  }