public class EnhancedBrowseConfigManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ContextLocal<java.lang.String[]> |
accountIds
All subject IDs (user ID and group IDs) associated with the current context, including
"default".
|
private static EnhancedBrowseConfigKey |
ALL_BROWSES_KEY
Key referencing ALL browses.
|
private boolean[] |
allBrowses
Convenience array for looping, reflects if a configuration should be applied to a
specific browse or to all browses.
|
private static java.lang.String |
COLUMNS_NODE
Root node for column configurations.
|
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<EnhancedBrowseConfigKey,EnhancedBrowseConfig>>> |
configs
Enhanced configurations keyed by Server ID -> Group/Account ID -> Browse key ->
Configuration.
|
private java.util.concurrent.locks.ReadWriteLock |
configsLock
Lock for reading and modifying configurations.
|
private static java.lang.String |
DEFAULT_NODE
Default server or account node.
|
private boolean |
enhanced
true if enhanced configurations are enabled. |
private static java.lang.String |
ENHANCED_COL_CONFIG_CLASS
In-directory column configuration class.
|
private static java.lang.String |
ENHANCED_CONFIG_CLASS
In-directory browse configuration class.
|
private static java.lang.String |
ENHANCED_CONFIG_NODE
Root node for browse configurations.
|
private ContextLocal<EnhancedBrowseSaveTarget[]> |
enhancedSaveTargets
Context-local save targets available for the user.
|
private boolean |
hyperlinking
true if hyperlinks in browse columns are enabled. |
private static EnhancedBrowseConfigManager |
instance
Manager instance.
|
private static java.util.logging.Logger |
LOG
Logger
|
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> |
maxNodeIds
Maximum existing directory node ID inside each Server ID -> Group/Account ID section.
|
private java.lang.String[] |
serverIds
Array consisting of current server ID and "default" server.
|
Constructor and Description |
---|
EnhancedBrowseConfigManager() |
Modifier and Type | Method and Description |
---|---|
private ColorRgb |
decodeColor(java.lang.String colorString)
Convert string representation of the color into the
ColorRgb object. |
private FontDetails |
decodeFont(java.lang.String fontString)
Convert string representation of the font into the
FontDetails object. |
private java.lang.String |
encodeColor(ColorRgb color)
Convert
ColorRgb object into its string representation. |
private java.lang.String |
encodeFont(FontDetails font)
Convert font into its string representation.
|
private Attribute[] |
getBrowseConfigNodeAttrs(DirectoryService ds,
EnhancedBrowseConfig config)
Get the enhanced browse configuration as an array of directory attributes.
|
private Attribute[] |
getColumnConfigNodeAttrs(DirectoryService ds,
java.lang.String columnKey,
EnhancedColumnConfig columnConfig)
Get the enhanced column configuration as an array of directory attributes.
|
private java.lang.String |
getDirectoryNode(java.lang.String serverId,
java.lang.String accountId)
Get the directory node path which corresponds the location of the "enhanced-browse-configs"
node for the given server and account IDs.
|
EnhancedBrowseSaveTarget[] |
getEnhancedBrowseSaveTargets()
Get save targets for an enhanced browse configuration, which are available for the current
user.
|
EnhancedBrowseConfig |
getEnhancedConfig(EnhancedBrowseConfigKey key)
Get an enhanced configuration from the cache.
|
private EnhancedBrowseConfig |
getEnhancedConfig(java.lang.String serverId,
java.lang.String accountId,
EnhancedBrowseConfigKey configKey)
Get an enhanced configuration from the cache section under the given server and account IDs.
|
static EnhancedBrowseConfigManager |
getInstance()
Get instance of this manager.
|
private int |
getNextDirectoryNodeId(java.lang.String serverId,
java.lang.String accountId)
Get next directory node id for saving a new configuration.
|
private void |
init()
Initialize manager: read enhanced configurations from the directory.
|
boolean |
isEnhanced()
Returns
true if enhanced browses are enabled. |
boolean |
isHyperlinking()
Returns
true if hyperlinks in browse columns are enabled. |
private java.lang.String |
nullify(java.lang.String str)
If the source string is
null or empty, return null . |
private java.util.List<EnhancedBrowseConfig> |
readConfigs(DirectoryService ds,
java.lang.String serverId,
java.lang.String accountId)
Read the enhanced configurations from the directory.
|
boolean |
saveEnhancedConfig(EnhancedBrowseConfig config,
EnhancedBrowseSaveTarget saveTarget)
Save the specified enhanced browse configuration using the specified save target.
|
private static final java.util.logging.Logger LOG
private static final java.lang.String ENHANCED_CONFIG_NODE
private static final java.lang.String ENHANCED_CONFIG_CLASS
private static final java.lang.String ENHANCED_COL_CONFIG_CLASS
private static final java.lang.String COLUMNS_NODE
private static final java.lang.String DEFAULT_NODE
private static final EnhancedBrowseConfigKey ALL_BROWSES_KEY
private static final EnhancedBrowseConfigManager instance
private boolean enhanced
true
if enhanced configurations are enabled.private boolean hyperlinking
true
if hyperlinks in browse columns are enabled.private java.lang.String[] serverIds
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.util.Map<EnhancedBrowseConfigKey,EnhancedBrowseConfig>>> configs
private final java.util.concurrent.locks.ReadWriteLock configsLock
private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Integer>> maxNodeIds
private final ContextLocal<EnhancedBrowseSaveTarget[]> enhancedSaveTargets
private ContextLocal<java.lang.String[]> accountIds
private boolean[] allBrowses
public static EnhancedBrowseConfigManager getInstance()
private void init()
public boolean isEnhanced()
true
if enhanced browses are enabled.public boolean isHyperlinking()
true
if hyperlinks in browse columns are enabled.public EnhancedBrowseSaveTarget[] getEnhancedBrowseSaveTargets()
public EnhancedBrowseConfig getEnhancedConfig(EnhancedBrowseConfigKey key)
key
- Enhanced configuration key.null
if a
configuration wasn't found.public boolean saveEnhancedConfig(EnhancedBrowseConfig config, EnhancedBrowseSaveTarget saveTarget)
config
- Enhanced browse configuration to save.saveTarget
- Save target (target server, target account, applied to all browses or not).true
on success.private int getNextDirectoryNodeId(java.lang.String serverId, java.lang.String accountId)
serverId
- Server ID to which the configuration belongs.accountId
- Account ID to which the configuration belongs.private Attribute[] getBrowseConfigNodeAttrs(DirectoryService ds, EnhancedBrowseConfig config)
ds
- Bound directory service.config
- Browse configuration to be processed.private Attribute[] getColumnConfigNodeAttrs(DirectoryService ds, java.lang.String columnKey, EnhancedColumnConfig columnConfig)
ds
- Bound directory service.columnKey
- Column key (added to the resulting attributes).columnConfig
- Column configuration to be processed.private java.lang.String getDirectoryNode(java.lang.String serverId, java.lang.String accountId)
serverId
- Server ID.accountId
- Account ID.private java.util.List<EnhancedBrowseConfig> readConfigs(DirectoryService ds, java.lang.String serverId, java.lang.String accountId)
ds
- Bound directory service.serverId
- Server ID of the target configurations.accountId
- Account ID of the target configurations.private ColorRgb decodeColor(java.lang.String colorString)
ColorRgb
object.colorString
- String representation of the color in the format "#rrggbb".ColorRgb
object.private java.lang.String encodeColor(ColorRgb color)
ColorRgb
object into its string representation.color
- Color to convert.private java.lang.String encodeFont(FontDetails font)
font
- Font to convert.private FontDetails decodeFont(java.lang.String fontString)
FontDetails
object.fontString
- String representation of the font in the format
"font name,size,bold,italic,underline" (e.g. "dejavu sans,12,false,true,false").FontDetails
object.private java.lang.String nullify(java.lang.String str)
null
or empty, return null
.
Otherwise, the source string is returned.str
- Source string.private EnhancedBrowseConfig getEnhancedConfig(java.lang.String serverId, java.lang.String accountId, EnhancedBrowseConfigKey configKey)
serverId
- Server ID.accountId
- Account ID.configKey
- Enhanced configuration key.null
if a
configuration wasn't found in the given section.