FileDocCategorySizeDatePackage
OptionsMap.javaAPI DocGlassfish v2 API8091Fri May 04 22:25:22 BST 2007com.sun.enterprise.cli.framework

OptionsMap

public final class OptionsMap extends Object
OptionMap Class
version
$Revision: 1.2 $

Fields Summary
private Map
optionsMap
Constructors Summary
public OptionsMap()


     
    
        optionsMap = new HashMap<String, Value>();
    
Methods Summary
public voidaddCLValue(java.lang.String name, java.lang.String value)
add CL option to optionsMap. If option name already exists, it will be replaced.

param
name option name
param
value option value param ovf option value from

        optionsMap.put(name, new Value(value, OptionValueFrom.CommandLine));
    
public voidaddDefaultValue(java.lang.String name, java.lang.String value)
add Default option to optionsMap. If option name already exists, it will be replaced.

param
name option name
param
value option value param ovf option value from

        optionsMap.put(name, new Value(value, OptionValueFrom.Default));
    
public voidaddEnvValue(java.lang.String name, java.lang.String value)
add Environment option to optionsMap. If option name already exists, it will be replaced.

param
name option name
param
value option value param ovf option value from

        optionsMap.put(name, new Value(value, OptionValueFrom.Environment));
    
public voidaddOptionValue(java.lang.String name, java.lang.String value)
add option to optionsMap. If option name already exists, it will be replaced.

param
name option name
param
value option value

        optionsMap.put(name, new Value(value, OptionValueFrom.Other));
    
public voidaddOptionValue(java.lang.String name, java.lang.String value, com.sun.enterprise.cli.framework.OptionsMap$OptionValueFrom ovf)
add option to optionsMap. If option name already exists, it will be replaced.

param
name option name
param
value option value
param
ovf option value from

        optionsMap.put(name, new Value(value, ovf));
    
public voidaddPrefValue(java.lang.String name, java.lang.String value)

        optionsMap.put(name, new Value(value, OptionValueFrom.PrefFile));
    
public booleancontainsName(java.lang.String name)

        return optionsMap.containsKey(name);
    
public java.util.MapgetCLOptions()
return all the command line options

        return getOptions(OptionValueFrom.CommandLine);
    
public java.util.MapgetDefaultOptions()
return all the options with the default values

        return getOptions(OptionValueFrom.Default);
    
public java.util.MapgetEnvOptions()
return all the environment options

        return getOptions(OptionValueFrom.Environment);
    
public java.lang.StringgetOption(java.lang.String name)
return option value

        if (!optionsMap.containsKey(name)) return null;
        return optionsMap.get(name).getValue();
    
public java.util.MapgetOptions()
return all options

        Map<String, String> tempOptions = new HashMap<String, String>();
        final Iterator<String> optionNames = optionsMap.keySet().iterator();
        while (optionNames.hasNext())
        {
            final String optionKey = (String) optionNames.next();
            tempOptions.put(optionKey, optionsMap.get(optionKey).getValue());
        }
        return tempOptions;
    
private java.util.MapgetOptions(com.sun.enterprise.cli.framework.OptionsMap$OptionValueFrom ovf)

        Map<String, String> tempOptions = new HashMap<String, String>();
        final Iterator<String> optionNames = optionsMap.keySet().iterator();
        while (optionNames.hasNext())
        {
            final String optionKey = (String) optionNames.next();
            if (optionsMap.get(optionKey).getOptionValueFrom() == ovf)
            {
                tempOptions.put(optionKey, optionsMap.get(optionKey).getValue());
            }
        }
        return tempOptions;
    
public java.util.MapgetOtherOptions()
return all the options that are set by thecommand module

        return getOptions(OptionValueFrom.Other);
    
public java.util.SetnameSet()

        return optionsMap.keySet();
    
public voidremove(java.lang.String name)
remove the entry from optionsMay

        optionsMap.remove(name);
    
public java.lang.StringtoString()

        final Iterator optionNames = optionsMap.keySet().iterator();
        StringBuffer strbuf = new StringBuffer();
        
        while (optionNames.hasNext())
        {
            final String optionKey = (String) optionNames.next();
            strbuf.append("<"+optionKey+","+optionsMap.get(optionKey).getValue()+">");
            strbuf.append("\n");
        }
        return strbuf.toString();