Class DefaultClientProfile
- java.lang.Object
-
- org.astrogrid.samp.client.DefaultClientProfile
-
public class DefaultClientProfile extends java.lang.Object
Factory 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 implementsClientProfile
and has a no-arg constructor, then an instance of the named class is used. Otherwise, an instance ofStandardClientProfile
orWebClientProfile
is returned.- Since:
- 4 Aug 2009
- Author:
- Mark Taylor
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
HUBLOC_CLASS_PREFIX
Prefix for SAMP_HUB env var indicating a supplied ClientProfile implementation ("jsamp-class:").static java.lang.String
HUBLOC_ENV
Environment variable used for hub location ("SAMP_HUB").private static java.util.logging.Logger
logger_
private static ClientProfile
profile_
-
Constructor Summary
Constructors Modifier Constructor Description private
DefaultClientProfile()
No-arg constructor prevents instantiation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ClientProfile
getProfile()
Returns a ClientProfile instance suitable for general purpose use.static void
setProfile(ClientProfile profile)
Sets the profile object which will be returned bygetProfile()
.
-
-
-
Field Detail
-
profile_
private static ClientProfile profile_
-
logger_
private static final java.util.logging.Logger logger_
-
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 implementsClientProfile
and has a no-arg constructor, then an instance of the named class is used. Otherwise, an instance ofStandardClientProfile
is 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
-
-