Package org.astrogrid.samp.web
Class WebHubProfile
- java.lang.Object
-
- org.astrogrid.samp.web.WebHubProfile
-
- All Implemented Interfaces:
ConfigHubProfile,HubProfile,ProfileToken
public class WebHubProfile extends java.lang.Object implements HubProfile, ConfigHubProfile
HubProfile implementation for Web Profile.- Since:
- 2 Feb 2011
- Author:
- Mark Taylor, Laurent Bourges
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classWebHubProfile.ConfigEnablerRunnable to be called on the Event Dispatch Thread which sets the enabledness of the user controls for configuration of this profile.private static classWebHubProfile.ConfigModelHelper class to generate toggle button models for hub configuration.static classWebHubProfile.ServerFactoryCreates and configures the HTTP server on which the Web Profile resides.
-
Field Summary
Fields Modifier and Type Field Description private ClientAuthorizerauth_private WebHubProfile.ConfigEnablerconfigDisabler_private WebHubProfile.ConfigEnablerconfigEnabler_private javax.swing.JToggleButton.ToggleButtonModel[]configModels_private booleancontrolUrls_private KeyGeneratorkeyGen_private static java.util.logging.Loggerlogger_private MessageRestrictionmrestrict_private WebHubProfile.ServerFactoryserverFactory_private InternalServerxServer_
-
Constructor Summary
Constructors Constructor Description WebHubProfile()Constructs 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private javax.swing.JToggleButton.ToggleButtonModel[]createConfigModels()Creates and returns some toggle models for configuration.static KeyGeneratorcreateKeyGenerator()Convenience method to return a new key generator suitable for use with a WebHubProfile.javax.swing.JToggleButton.ToggleButtonModel[]getConfigModels()Returns some toggle button models for hub profile configuration.MessageRestrictiongetMessageRestriction()Returns a MessageRestriction object which controls what messages may be sent by clients registering under ths profile.java.lang.StringgetProfileName()Returns the name of this profile.booleanisRunning()Indicates whether this profile is currently running.voidstart(ClientProfile profile)Starts this profile's activity allowing access to a given supplier of hub connections.voidstop()Ends this profile's activity on behalf of the hub.
-
-
-
Field Detail
-
serverFactory_
private final WebHubProfile.ServerFactory serverFactory_
-
auth_
private final ClientAuthorizer auth_
-
keyGen_
private final KeyGenerator keyGen_
-
configEnabler_
private final WebHubProfile.ConfigEnabler configEnabler_
-
configDisabler_
private final WebHubProfile.ConfigEnabler configDisabler_
-
mrestrict_
private MessageRestriction mrestrict_
-
controlUrls_
private boolean controlUrls_
-
xServer_
private InternalServer xServer_
-
configModels_
private javax.swing.JToggleButton.ToggleButtonModel[] configModels_
-
logger_
private static final java.util.logging.Logger logger_
-
-
Constructor Detail
-
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
public WebHubProfile() throws java.io.IOExceptionConstructs a profile with default configuration.- Throws:
java.io.IOException
-
-
Method Detail
-
getProfileName
public java.lang.String getProfileName()
Description copied from interface:HubProfileReturns the name of this profile.- Specified by:
getProfileNamein interfaceHubProfile- Specified by:
getProfileNamein interfaceProfileToken- Returns:
- profile name, usually one word
-
getMessageRestriction
public MessageRestriction getMessageRestriction()
Description copied from interface:ProfileTokenReturns 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:
getMessageRestrictionin interfaceProfileToken- Returns:
- message restriction, or null
-
start
public void start(ClientProfile profile) throws java.io.IOException
Description copied from interface:HubProfileStarts this profile's activity allowing access to a given supplier of hub connections.- Specified by:
startin interfaceHubProfile- Parameters:
profile- object which can provide hub connections- Throws:
java.io.IOException
-
isRunning
public boolean isRunning()
Description copied from interface:HubProfileIndicates whether this profile is currently running.- Specified by:
isRunningin interfaceHubProfile- Returns:
- true iff profile is running
-
stop
public void stop()
Description copied from interface:HubProfileEnds 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:
stopin interfaceHubProfile
-
getConfigModels
public javax.swing.JToggleButton.ToggleButtonModel[] getConfigModels()
Description copied from interface:ConfigHubProfileReturns some toggle button models for hub profile configuration.- Specified by:
getConfigModelsin interfaceConfigHubProfile- Returns:
- toggle button model array
-
createConfigModels
private javax.swing.JToggleButton.ToggleButtonModel[] createConfigModels()
Creates and returns some toggle models for configuration. They are only enabled when the profile is not running.
-
createKeyGenerator
public static KeyGenerator createKeyGenerator()
Convenience method to return a new key generator suitable for use with a WebHubProfile.- Returns:
- new key generator for web hub private keys
-
-