|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.tranche.configuration.Configuration
public class Configuration
Configuration for a server, kept in memory
| Field Summary | |
|---|---|
static java.lang.String |
DEFAULT_GROUP
|
static int |
SIZE_MAX_HASH_SPANS
|
static int |
VERSION_ONE
Flag for version one. |
static int |
VERSION_TWO
Flag for version two. |
| Constructor Summary | |
|---|---|
Configuration()
|
|
| Method Summary | |
|---|---|
void |
addDataDirectory(DataDirectoryConfiguration dataDirectory)
Adds the given data directory to the set of data directories on this server. |
void |
addHashSpan(HashSpan hashSpan)
Adds the given hash span to this server. |
void |
addServerConfig(ServerConfiguration serverConfig)
Adds the given server configuration to the list of server configurations on this server. |
void |
addStickyProject(BigHash projectHash)
Make the project with the given hash as a sticky to this server. |
void |
addTargetHashSpan(HashSpan targetHashSpan)
Adds the given target hash span to this server. |
void |
addUser(User user)
Adds the given user to the server. |
boolean |
canRead()
Returns whether server mode flags are set to allow clients to read server's data. |
boolean |
canWrite()
Returns whether server mode flags are set to allow clients to write data to server. |
void |
clearDataDirectories()
Removes all the data directories from this server. |
void |
clearHashSpans()
Removes all hash spans from this server. |
void |
clearServerConfigs()
Clears the server configurations from this server. |
void |
clearStickyProjects()
Remove all sticky projects from this server. |
void |
clearTargetHashSpans()
Removes all hash spans from this server. |
void |
clearUsers()
Clears the users from this server. |
Configuration |
clone()
Create a deep copy of the configuration so in-memory copies aren't shared. |
java.util.Set<DataDirectoryConfiguration> |
getDataDirectories()
Gets the data directories on this server. |
int |
getFlags()
Gets the flags on this configuration. |
java.lang.String |
getGroup()
|
java.util.Set<HashSpan> |
getHashSpans()
Gets the hash spans for this server. |
java.lang.String |
getName()
|
User |
getRecognizedUser(java.security.cert.X509Certificate cert)
Get the User that corresponds to the given certificate. |
java.util.Set<ServerConfiguration> |
getServerConfigs()
Gets the server configurations on this server. |
java.util.Set<BigHash> |
getStickyProjects()
Gets the sticky projects for this server. |
java.util.Set<HashSpan> |
getTargetHashSpans()
Gets the target hash spans for this server. |
java.util.Set<User> |
getUsers()
Gets the set of users on the server. |
java.lang.String |
getValue(java.lang.String key)
Retrieves value from configuration attributes. |
java.util.Set<java.lang.String> |
getValueKeys()
Returns set of keys from local and network-wide attributes. |
java.util.Set<java.lang.String> |
getValueKeys(boolean includeNetworkKeys)
Returns set of keys for attributes. |
boolean |
hasKey(java.lang.String key)
Checks whether key is found in local or network-wide configuration attributes. |
boolean |
hasKey(java.lang.String key,
boolean includeNetworkKeys)
Checks whether key is found in network-wide configuration attributes. |
boolean |
isReadOnly()
Deprecated. Use canRead() instead. |
boolean |
isVersionOne()
Returns the flag for whether the configuration is first version. |
static boolean |
isVersionOne(int flagVal)
Checks the supplied flag for whether the configuration is first version. |
boolean |
isVersionTwo()
Returns the flag for whether the configuration is second version. |
static boolean |
isVersionTwo(int flagVal)
Checks the supplied flag for whether the configuration is second version. |
boolean |
isWriteOnly()
Deprecated. Use canWrite() instead. |
int |
numberKeyValuePairs()
Returns total number of attribute pairs, including local and network-wide. |
int |
numberKeyValuePairs(boolean includeNetworkKeys)
Returns total number of attribute pairs. |
void |
removeDataDirectory(DataDirectoryConfiguration dataDirectory)
Removes the given data directory from the set of data directories on this server. |
void |
removeHashSpan(HashSpan hashSpan)
Removes the given hash span from this server. |
boolean |
removeKeyValuePair(java.lang.String key)
Removes a key/value pair from local server configuration attributes. |
void |
removeServerConfig(ServerConfiguration serverConfig)
Removes the given server configuration to the list of server configurations on this server. |
void |
removeStickyProject(BigHash projectHash)
Remove the sticky project with the given hash from this server. |
void |
removeTargetHashSpan(HashSpan targetHashSpan)
Removes the given hash span from this server. |
void |
removeUser(User user)
Removes the given user from the server. |
void |
setDataDirectories(java.util.Set<DataDirectoryConfiguration> dataDirectories)
Sets the data directories for this server. |
void |
setFlags(int flags)
Sets the flags for this configuration. |
void |
setHashSpans(java.util.Set<HashSpan> hashSpans)
Sets the hash spans for this server. |
void |
setServerConfigs(java.util.Set<ServerConfiguration> serverConfigs)
Sets the server configurations on this server. |
void |
setStickyProjects(java.util.Set<BigHash> stickyProjects)
Makes the projects with the given hashes as sticky projects to this servers. |
void |
setTargetHashSpans(java.util.Set<HashSpan> newTargetHashSpans)
Sets the target hash spans for this server. |
void |
setUsers(java.util.Set<User> users)
Sets the given users on the server. |
void |
setValue(java.lang.String key,
java.lang.String value)
Add a key/value pair to local server's configuration. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int VERSION_ONE
Flag for version one.
public static final int VERSION_TWO
Flag for version two. Changes include:
public static final int SIZE_MAX_HASH_SPANS
public static final java.lang.String DEFAULT_GROUP
| Constructor Detail |
|---|
public Configuration()
| Method Detail |
|---|
public java.util.Set<DataDirectoryConfiguration> getDataDirectories()
Gets the data directories on this server.
public void setDataDirectories(java.util.Set<DataDirectoryConfiguration> dataDirectories)
Sets the data directories for this server.
dataDirectories - public void addDataDirectory(DataDirectoryConfiguration dataDirectory)
Adds the given data directory to the set of data directories on this server.
dataDirectory - public void removeDataDirectory(DataDirectoryConfiguration dataDirectory)
Removes the given data directory from the set of data directories on this server.
dataDirectory - public void clearDataDirectories()
Removes all the data directories from this server.
public java.util.Set<User> getUsers()
Gets the set of users on the server.
public void setUsers(java.util.Set<User> users)
Sets the given users on the server.
users - public void addUser(User user)
Adds the given user to the server.
user - public void removeUser(User user)
Removes the given user from the server.
user - public void clearUsers()
Clears the users from this server.
public java.util.Set<ServerConfiguration> getServerConfigs()
Gets the server configurations on this server.
public void setServerConfigs(java.util.Set<ServerConfiguration> serverConfigs)
Sets the server configurations on this server.
serverConfigs - public void addServerConfig(ServerConfiguration serverConfig)
Adds the given server configuration to the list of server configurations on this server.
serverConfig - public void removeServerConfig(ServerConfiguration serverConfig)
Removes the given server configuration to the list of server configurations on this server.
serverConfig - public void clearServerConfigs()
Clears the server configurations from this server.
public int getFlags()
Gets the flags on this configuration.
public void setFlags(int flags)
Sets the flags for this configuration.
flags - public boolean isVersionOne()
Returns the flag for whether the configuration is first version.
public boolean isVersionTwo()
Returns the flag for whether the configuration is second version.
public static boolean isVersionOne(int flagVal)
Checks the supplied flag for whether the configuration is first version.
public static boolean isVersionTwo(int flagVal)
Checks the supplied flag for whether the configuration is second version.
public User getRecognizedUser(java.security.cert.X509Certificate cert)
Get the User that corresponds to the given certificate.
cert -
public java.util.Set<HashSpan> getHashSpans()
Gets the hash spans for this server.
public void setHashSpans(java.util.Set<HashSpan> hashSpans)
throws java.lang.Exception
Sets the hash spans for this server.
hashSpans -
java.lang.Exception
public void addHashSpan(HashSpan hashSpan)
throws java.lang.Exception
Adds the given hash span to this server.
hashSpan -
java.lang.Exceptionpublic void removeHashSpan(HashSpan hashSpan)
Removes the given hash span from this server.
hashSpan - public void clearHashSpans()
Removes all hash spans from this server.
public java.util.Set<HashSpan> getTargetHashSpans()
Gets the target hash spans for this server.
public void setTargetHashSpans(java.util.Set<HashSpan> newTargetHashSpans)
throws java.lang.Exception
Sets the target hash spans for this server.
newTargetHashSpans -
java.lang.Exception
public void addTargetHashSpan(HashSpan targetHashSpan)
throws java.lang.Exception
Adds the given target hash span to this server.
targetHashSpan -
java.lang.Exceptionpublic void removeTargetHashSpan(HashSpan targetHashSpan)
Removes the given hash span from this server.
targetHashSpan - public void clearTargetHashSpans()
Removes all hash spans from this server.
public java.util.Set<BigHash> getStickyProjects()
Gets the sticky projects for this server.
public void setStickyProjects(java.util.Set<BigHash> stickyProjects)
Makes the projects with the given hashes as sticky projects to this servers.
stickyProjects - public void addStickyProject(BigHash projectHash)
Make the project with the given hash as a sticky to this server.
projectHash - public void removeStickyProject(BigHash projectHash)
Remove the sticky project with the given hash from this server.
projectHash - public void clearStickyProjects()
Remove all sticky projects from this server.
public java.lang.String getName()
public java.lang.String getGroup()
public boolean isReadOnly()
Is configuration set to read-only?
canRead(),
canWrite()public boolean isWriteOnly()
Is configuration set to write-only?
canRead(),
canWrite()public boolean canRead()
Returns whether server mode flags are set to allow clients to read server's data.
public boolean canWrite()
Returns whether server mode flags are set to allow clients to write data to server.
public void setValue(java.lang.String key,
java.lang.String value)
Add a key/value pair to local server's configuration.
Has no impact on server-wide configuration attributes. However, if set key is equal to key in server-wide configuration attributes, then local value is selected over network-wide value.
key - value - public java.lang.String getValue(java.lang.String key)
Retrieves value from configuration attributes. Looks for value first in local server attributes, and if not found, checks network-wide attributes.
key -
public java.util.Set<java.lang.String> getValueKeys()
Returns set of keys from local and network-wide attributes.
public java.util.Set<java.lang.String> getValueKeys(boolean includeNetworkKeys)
Returns set of keys for attributes.
includeNetworkKeys - If true, will also include keys from network-wide attributes; otherwise, they will be excluded
public int numberKeyValuePairs()
Returns total number of attribute pairs, including local and network-wide.
If an attribute pair is found in both, it will only be counted once, since only one value will be used (the local value).
public int numberKeyValuePairs(boolean includeNetworkKeys)
Returns total number of attribute pairs.
includeNetworkKeys - If true, will also include keys from network-wide attributes; otherwise, they will be excluded
public boolean hasKey(java.lang.String key)
Checks whether key is found in local or network-wide configuration attributes.
key -
public boolean hasKey(java.lang.String key,
boolean includeNetworkKeys)
Checks whether key is found in network-wide configuration attributes.
key - includeNetworkKeys - If true, will also include keys from network-wide attributes; otherwise, they will be excluded
public boolean removeKeyValuePair(java.lang.String key)
Removes a key/value pair from local server configuration attributes. Has no effect if not present.
This has no impact on server-wide attributes. However, if remove a value that overrides network value, then the network value will be used.
key -
public Configuration clone()
Create a deep copy of the configuration so in-memory copies aren't shared.
Useful if want a separate copy of Configuration to edit without editting the original.
clone in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||