| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectsoc.util.SOCServerFeatures
public class SOCServerFeatures
Set of optional server features that are currently active.
 Sent from server to client during connect via SOCVersion fields.
 Added in v1.1.19 (VERSION_FOR_SERVERFEATURES); earlier clients assume the server is using the
 features defined in 1.1.19. Use the SOCServerFeatures(true) constructor
 when connecting to a server older than 1.1.19. See that constructor's javadoc for the list of features
 always assumed active before 1.1.19.
Feature names are kept simple (lowercase alphanumerics, underscore, dash) for encoding into network message fields.
Locks: Not thread-safe. Caller must guard against potential multi-threaded modifications or access.
| Field Summary | |
|---|---|
| static java.lang.String | FEAT_ACCTSUser accounts defined in a persistent database. | 
| static java.lang.String | FEAT_CHANNELSChat channels. | 
| static java.lang.String | FEAT_OPEN_REGOpen registration. | 
| private  java.lang.String | featureListActive feature list, or null if none. | 
| private static char | SEP_CHARSeparator character ';' between features in featureList. | 
| static int | VERSION_FOR_SERVERFEATURESMinimum version (1.1.19) of client/server which send and recognize server features | 
| Constructor Summary | |
|---|---|
| SOCServerFeatures(boolean withOldDefaults)Create a new empty SOCServerFeatures, with none active or defaults active. | |
| SOCServerFeatures(SOCServerFeatures feats)Create a new SOCServerFeatures by copying another. | |
| SOCServerFeatures(java.lang.String encodedList)Create a new SOCServerFeatures from an encoded list; useful at client. | |
| Method Summary | |
|---|---|
|  void | add(java.lang.String featureName)Add this active feature. | 
|  java.lang.String | getEncodedList()Get the encoded list of all active features, to send to a client for SOCServerFeatures(String). | 
|  boolean | isActive(java.lang.String featureName)Is this feature active? | 
|  java.lang.String | toString()Human-readable representation of active features. | 
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
|---|
public static final int VERSION_FOR_SERVERFEATURES
public static final java.lang.String FEAT_ACCTS
FEAT_OPEN_REG).
 When this feature is active but the db is empty (new install),
 the server will tell clients that FEAT_OPEN_REG is active;
 see that feature's javadoc for details.
 The server can optionally be configured to require accounts,
 see SOCServer.PROP_JSETTLERS_ACCOUNTS_REQUIRED.
public static final java.lang.String FEAT_CHANNELS
public static final java.lang.String FEAT_OPEN_REG
FEAT_ACCTS).
FEAT_ACCTS server install:FEAT_OPEN_REG is active so that SOCAccountClient won't
 ask for a username and password.
private static char SEP_CHAR
featureList.
 Avoid separators defined in SOCMessage.
private java.lang.String featureList
SEP_CHAR for ease of search.
| Constructor Detail | 
|---|
public SOCServerFeatures(boolean withOldDefaults)
add(String) to add active features.
withOldDefaults - If false, nothing is active. If true, include the default features
     which were assumed always active in servers older than v1.1.19 (VERSION_FOR_SERVERFEATURES):
     FEAT_ACCTS, FEAT_CHANNELS, FEAT_OPEN_REG.
public SOCServerFeatures(java.lang.String encodedList)
                  throws java.lang.IllegalArgumentException
encodedList - List from getEncodedList(), or null or "" for none
java.lang.IllegalArgumentException - if encodedList is not empty but
     doesn't start and end with the separator character
public SOCServerFeatures(SOCServerFeatures feats)
                  throws java.lang.NullPointerException
feats - Copy from this to create the new SOCServerFeatures
java.lang.NullPointerException - if feats == null| Method Detail | 
|---|
public boolean isActive(java.lang.String featureName)
                 throws java.lang.IllegalArgumentException
featureName - A defined feature name, such as FEAT_ACCTS
featureName is in the features list
java.lang.IllegalArgumentException - if featureName is null or ""
public void add(java.lang.String featureName)
         throws java.lang.IllegalArgumentException
featureName - A defined feature name, such as FEAT_ACCTS
java.lang.IllegalArgumentException - if featureName is null or ""public java.lang.String getEncodedList()
SOCServerFeatures(String).
public java.lang.String toString()
toString in class java.lang.Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||