Class DefaultClientProfile
- java.lang.Object
-
- org.astrogrid.samp.client.DefaultClientProfile
-
public class DefaultClientProfile extends java.lang.ObjectFactory which supplies the default ClientProfile for use by SAMP clients. By using this class to obtain ClientProfile instances, applications can be used with non-standard profiles supplied at runtime without requiring any code changes.The profile returned by this class depends on the SAMP_HUB environment variable (
HUBLOC_ENV). If it consists of the prefix "jsamp-class:" (HUBLOC_CLASS_PREFIX) followed by the classname of a class which implementsClientProfileand has a no-arg constructor, then an instance of the named class is used. Otherwise, an instance ofStandardClientProfileorWebClientProfileis returned.- Since:
- 4 Aug 2009
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringHUBLOC_CLASS_PREFIXPrefix for SAMP_HUB env var indicating a supplied ClientProfile implementation ("jsamp-class:").static java.lang.StringHUBLOC_ENVEnvironment variable used for hub location ("SAMP_HUB").
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ClientProfilegetProfile()Returns a ClientProfile instance suitable for general purpose use.static voidsetProfile(ClientProfile profile)Sets the profile object which will be returned bygetProfile().
-
-
-
Field Detail
-
HUBLOC_ENV
public static final java.lang.String HUBLOC_ENV
Environment variable used for hub location ("SAMP_HUB").- See Also:
- Constant Field Values
-
HUBLOC_CLASS_PREFIX
public static final java.lang.String HUBLOC_CLASS_PREFIX
Prefix for SAMP_HUB env var indicating a supplied ClientProfile implementation ("jsamp-class:").- See Also:
- Constant Field Values
-
-
Method Detail
-
getProfile
public static ClientProfile getProfile()
Returns a ClientProfile instance suitable for general purpose use. By default this is currently the Standard Profile (StandardClientProfile.getInstance()), but the instance may be modified programatically or by use of the SAMP_HUB environment variable.If no instance has been set, the SAMP_HUB environment variable is examined. If it consists of the prefix "
jsamp-class:" (HUBLOC_CLASS_PREFIX) followed by the classname of a class which implementsClientProfileand has a no-arg constructor, then an instance of the named class is used. Otherwise, an instance ofStandardClientProfileis returned.The instance is obtained lazily.
- Returns:
- client profile instance
-
setProfile
public static void setProfile(ClientProfile profile)
Sets the profile object which will be returned bygetProfile().- Parameters:
profile- default profile instance
-
-