public class WebClientProfile extends java.lang.Object implements ClientProfile
Modifier and Type | Field and Description |
---|---|
private java.net.URL |
hubEndpoint_ |
private java.util.Map |
securityMap_ |
static java.lang.String |
URLTRANS_KEY
RegInfo map key for URL translation service base URL
("samp.url-translator").
|
static java.lang.String |
WEBPROFILE_HUB_PREFIX
Prefix in SAMP_HUB value indicating web profile application name
("web-appname:").
|
static java.lang.String |
WEBSAMP_CLIENT_PREFIX
Prefix to client interface opeation names for XML-RPC method names
("").
|
static java.lang.String |
WEBSAMP_HUB_PREFIX
Prefix to hub interface operation names for XML-RPC method names
("samp.webhub.").
|
static java.lang.String |
WEBSAMP_PATH
Path on WEBSAMP_PORT web server at which XML-RPC server lives
("/").
|
static int |
WEBSAMP_PORT
Web Profile hub port number (21012).
|
private SampXmlRpcClientFactory |
xClientFactory_ |
Constructor and Description |
---|
WebClientProfile()
Constructor with no arguments.
|
WebClientProfile(java.util.Map securityMap,
SampXmlRpcClientFactory xClientFactory,
java.net.URL hubEndpoint)
Constructor with configuration options.
|
WebClientProfile(java.lang.String appName)
Constructor with declared client name.
|
Modifier and Type | Method and Description |
---|---|
private static java.util.Map |
createSecurityMap(java.lang.String appName)
Constructs a security-info map suitable for presentation at
registration time, containing the mandatory samp.name entry.
|
static java.lang.String |
getDefaultAppName()
Returns the default application name used by this profile if none
is supplied explicitly.
|
static java.net.URL |
getDefaultHubEndpoint()
Returns the hub XML-RPC endpoint defined by the Web Profile.
|
java.net.URL |
getHubEndpoint()
Returns the hub XML-RPC endpoint used by this profile.
|
static WebClientProfile |
getInstance()
Returns a default instance of this profile.
|
boolean |
isHubRunning()
Indicates whether a hub contactable by this profile appears to be
running.
|
HubConnection |
register()
Attempts to register with a SAMP hub and return a corresponding
connection object.
|
private final SampXmlRpcClientFactory xClientFactory_
private final java.util.Map securityMap_
private final java.net.URL hubEndpoint_
public static final int WEBSAMP_PORT
public static final java.lang.String WEBSAMP_PATH
public static final java.lang.String WEBSAMP_HUB_PREFIX
public static final java.lang.String WEBSAMP_CLIENT_PREFIX
public static final java.lang.String URLTRANS_KEY
public static final java.lang.String WEBPROFILE_HUB_PREFIX
public WebClientProfile(java.util.Map securityMap, SampXmlRpcClientFactory xClientFactory, java.net.URL hubEndpoint)
securityMap
- map containing security information for registrationxClientFactory
- XML-RPC client factoryhubEndpoint
- XML-RPC endpoint for hub serverpublic WebClientProfile(java.lang.String appName)
appName
- client's declared application name
(samp.name entry in security-info map)public WebClientProfile()
getDefaultAppName()
.public boolean isHubRunning()
ClientProfile
isHubRunning
in interface ClientProfile
public HubConnection register() throws SampException
ClientProfile
register
in interface ClientProfile
SampException
- in case of some unexpected errorpublic java.net.URL getHubEndpoint()
public static java.net.URL getDefaultHubEndpoint()
public static WebClientProfile getInstance()
public static java.lang.String getDefaultAppName()
private static java.util.Map createSecurityMap(java.lang.String appName)
appName
- samp.name entry