Package org.astrogrid.samp.xmlrpc
Class StandardHubProfile
java.lang.Object
org.astrogrid.samp.xmlrpc.StandardHubProfile
- All Implemented Interfaces:
HubProfile,ProfileToken
HubProfile implementation for the SAMP Standard Profile.
- Since:
- 31 Jan 2011
- Author:
- Mark Taylor
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a hub profile with default configuration.StandardHubProfile(SampXmlRpcClientFactory xClientFactory, SampXmlRpcServerFactory xServerFactory, File lockfile, String secret) Constructs a hub profile with given configuration information. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns a string suitable for use as a Standard Profile Secret.Returns the lockfile information associated with this object.Returns a MessageRestriction object which controls what messages may be sent by clients registering under ths profile.Returns the name of this profile.booleanIndicates whether this profile is currently running.Returns an HTTP URL at which the lockfile for this hub can be found.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.
-
Constructor Details
-
StandardHubProfile
public StandardHubProfile(SampXmlRpcClientFactory xClientFactory, SampXmlRpcServerFactory xServerFactory, File lockfile, String secret) Constructs a hub profile with given configuration information. If the suppliedlockfileis null, no lockfile will be written at hub startup.- Parameters:
xClientFactory- XML-RPC client factory implementationxServerFactory- XML-RPC server implementationlockfile- location to use for hub lockfile, or nullsecret- value for samp.secret lockfile key
-
StandardHubProfile
Constructs a hub profile with default configuration.- Throws:
IOException
-
-
Method Details
-
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
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
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:
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
-
getLockInfo
Returns the lockfile information associated with this object. Only present when running.- Returns:
- lock info
-
publishLockfile
Returns an HTTP URL at which the lockfile for this hub can be found. The first call to this method causes the lockfile to be published in this way; subsequent calls return the same value.Use this with care; publishing your lockfile means that other people can connect to your hub and potentially do disruptive things.
- Returns:
- lockfile information URL
- Throws:
IOException
-
createSecret
Returns a string suitable for use as a Standard Profile Secret.- Returns:
- new secret
-