Package org.astrogrid.samp.web
Class WebHubProfile
java.lang.Object
org.astrogrid.samp.web.WebHubProfile
- All Implemented Interfaces:
ConfigHubProfile
,HubProfile
,ProfileToken
HubProfile implementation for Web Profile.
- Since:
- 2 Feb 2011
- Author:
- Mark Taylor, Laurent Bourges
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Creates and configures the HTTP server on which the Web Profile resides. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a profile with default configuration.WebHubProfile
(WebHubProfile.ServerFactory serverFactory, ClientAuthorizer auth, MessageRestriction mrestrict, KeyGenerator keyGen, boolean controlUrls) Constructs a profile with configuration options. -
Method Summary
Modifier and TypeMethodDescriptionstatic KeyGenerator
Convenience method to return a new key generator suitable for use with a WebHubProfile.Returns some toggle button models for hub profile configuration.Returns a MessageRestriction object which controls what messages may be sent by clients registering under ths profile.Returns the name of this profile.boolean
Indicates whether this profile is currently running.void
start
(ClientProfile profile) Starts this profile's activity allowing access to a given supplier of hub connections.void
stop()
Ends this profile's activity on behalf of the hub.
-
Constructor Details
-
WebHubProfile
public WebHubProfile(WebHubProfile.ServerFactory serverFactory, ClientAuthorizer auth, MessageRestriction mrestrict, KeyGenerator keyGen, boolean controlUrls) Constructs a profile with configuration options.- Parameters:
serverFactory
- factory for server providing HTTP and XML-RPC implementationauth
- client authorizer implementationmrestrict
- restriction for permitted outward MTypeskeyGen
- key generator for private keyscontrolUrls
- true iff access to local URLs is to be restricted
-
WebHubProfile
Constructs a profile with default configuration.- Throws:
IOException
-
-
Method Details
-
getProfileName
Description copied from interface:HubProfile
Returns the name of this profile.- Specified by:
getProfileName
in interfaceHubProfile
- Specified by:
getProfileName
in interfaceProfileToken
- Returns:
- profile name, usually one word
-
getMessageRestriction
Description copied from interface:ProfileToken
Returns a MessageRestriction object which controls what messages may be sent by clients registering under ths profile. If null is returned, any messages may be sent.- Specified by:
getMessageRestriction
in interfaceProfileToken
- Returns:
- message restriction, or null
-
start
Description copied from interface:HubProfile
Starts this profile's activity allowing access to a given supplier of hub connections.- Specified by:
start
in interfaceHubProfile
- Parameters:
profile
- object which can provide hub connections- Throws:
IOException
-
isRunning
public boolean isRunning()Description copied from interface:HubProfile
Indicates whether this profile is currently running.- Specified by:
isRunning
in interfaceHubProfile
- Returns:
- true iff profile is running
-
stop
public void stop()Description copied from interface:HubProfile
Ends this profile's activity on behalf of the hub. Any resources associated with the profile should be released. This does not include messaging registered clients about profile termination; that should be taken care of by the user of this profile.- Specified by:
stop
in interfaceHubProfile
-
getConfigModels
Description copied from interface:ConfigHubProfile
Returns some toggle button models for hub profile configuration.- Specified by:
getConfigModels
in interfaceConfigHubProfile
- Returns:
- toggle button model array
-
createKeyGenerator
Convenience method to return a new key generator suitable for use with a WebHubProfile.- Returns:
- new key generator for web hub private keys
-