Package org.astrogrid.samp.web
Class WebClientProfile
java.lang.Object
org.astrogrid.samp.web.WebClientProfile
- All Implemented Interfaces:
ClientProfile
ClientProfile implementation for Web Profile.
- Since:
- 3 Feb 2011
- Author:
- Mark Taylor
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
RegInfo map key for URL translation service base URL ("samp.url-translator").static final String
Prefix in SAMP_HUB value indicating web profile application name ("web-appname:").static final String
Prefix to client interface opeation names for XML-RPC method names ("").static final String
Prefix to hub interface operation names for XML-RPC method names ("samp.webhub.").static final String
Path on WEBSAMP_PORT web server at which XML-RPC server lives ("/").static final int
Web Profile hub port number (21012). -
Constructor Summary
ConstructorsConstructorDescriptionConstructor with no arguments.WebClientProfile
(String appName) Constructor with declared client name.WebClientProfile
(Map securityMap, SampXmlRpcClientFactory xClientFactory, URL hubEndpoint) Constructor with configuration options. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns the default application name used by this profile if none is supplied explicitly.static URL
Returns the hub XML-RPC endpoint defined by the Web Profile.Returns the hub XML-RPC endpoint used by this profile.static WebClientProfile
Returns a default instance of this profile.boolean
Indicates whether a hub contactable by this profile appears to be running.register()
Attempts to register with a SAMP hub and return a corresponding connection object.
-
Field Details
-
WEBSAMP_PORT
public static final int WEBSAMP_PORTWeb Profile hub port number (21012).- See Also:
-
WEBSAMP_PATH
Path on WEBSAMP_PORT web server at which XML-RPC server lives ("/").- See Also:
-
WEBSAMP_HUB_PREFIX
Prefix to hub interface operation names for XML-RPC method names ("samp.webhub.").- See Also:
-
WEBSAMP_CLIENT_PREFIX
Prefix to client interface opeation names for XML-RPC method names ("").- See Also:
-
URLTRANS_KEY
RegInfo map key for URL translation service base URL ("samp.url-translator").- See Also:
-
WEBPROFILE_HUB_PREFIX
Prefix in SAMP_HUB value indicating web profile application name ("web-appname:").- See Also:
-
-
Constructor Details
-
WebClientProfile
Constructor with configuration options.- Parameters:
securityMap
- map containing security information for registrationxClientFactory
- XML-RPC client factoryhubEndpoint
- XML-RPC endpoint for hub server
-
WebClientProfile
Constructor with declared client name.- Parameters:
appName
- client's declared application name (samp.name entry in security-info map)
-
WebClientProfile
public WebClientProfile()Constructor with no arguments. The client's declared application name will be as given bygetDefaultAppName()
.
-
-
Method Details
-
isHubRunning
public boolean isHubRunning()Description copied from interface:ClientProfile
Indicates whether a hub contactable by this profile appears to be running. This is intended to execute reasonably quickly. It should not go as far as registering.- Specified by:
isHubRunning
in interfaceClientProfile
- Returns:
- true iff it looks like a hub is running
-
register
Description copied from interface:ClientProfile
Attempts to register with a SAMP hub and return a corresponding connection object. Some profile-specific hub discovery mechanism is used to locate the hub. If no hub is running, null will normally be returned.- Specified by:
register
in interfaceClientProfile
- Returns:
- hub connection representing a new registration, or null
- Throws:
SampException
- in case of some unexpected error
-
getHubEndpoint
Returns the hub XML-RPC endpoint used by this profile.- Returns:
- hub endpoint URL
-
getDefaultHubEndpoint
Returns the hub XML-RPC endpoint defined by the Web Profile.- Returns:
- Web Profile hub endpoint URL
-
getInstance
Returns a default instance of this profile.- Returns:
- default web client profile instance
-
getDefaultAppName
Returns the default application name used by this profile if none is supplied explicitly. If the SAMP_HUB environment variable has the form "web-appname:<appname>" it is taken from there; otherwise it's something like "Unknown".- Returns:
- default declared client name
-