Example usage for java.util Collections unmodifiableMap

List of usage examples for java.util Collections unmodifiableMap

Introduction

In this page you can find the example usage for java.util Collections unmodifiableMap.

Prototype

public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Returns an unmodifiable view of the specified map.

Usage

From source file:net.sf.eclipsecs.core.config.CheckConfiguration.java

/**
 * Creates a check configuration instance.
 * /*from www. ja v  a  2  s  .  com*/
 * @param name
 *            the name of the check configuration
 * @param location
 *            the location of the check configuration
 * @param description
 *            the description of the check configuration
 * @param type
 *            the check configuration type
 * @param global
 *            determines if the check configuration is a global
 *            configuration
 * @param properties
 *            the list of properties configured for this check configuration
 * @param additionalData
 *            a map of additional data for this configuration
 */
public CheckConfiguration(final String name, final String location, final String description,
        final IConfigurationType type, final boolean global, final List<ResolvableProperty> properties,
        final Map<String, String> additionalData) {
    mName = name;
    mLocation = location;
    mDescription = description;
    mConfigType = type;
    mIsGlobal = global;

    if (additionalData != null) {
        mAdditionalData = Collections.unmodifiableMap(additionalData);
    } else {
        mAdditionalData = Collections.unmodifiableMap(new HashMap<String, String>());
    }

    mProperties = properties != null ? Collections.unmodifiableList(properties)
            : Collections.unmodifiableList(new ArrayList<ResolvableProperty>());
}

From source file:com.github.cherimojava.data.mongo.entity.ParameterProperty.java

ParameterProperty(Builder builder) {
    checkNotNull(builder.type, "type cannot be null");
    checkNotNull(builder.validator);/*from w ww.  j a  v  a  2  s .  c  o m*/
    checkArgument(StringUtils.isNotEmpty(builder.pojoName), "pojo name cannot be null or empty string");
    checkArgument(StringUtils.isNotEmpty(builder.mongoName), "mongo name cannot be null or empty string");

    typeReturnMap = Collections.unmodifiableMap(builder.typeReturnMap);
    type = Primitives.wrap(builder.type);
    isPrimitiveType = builder.type.isPrimitive();
    genericType = builder.genericType;
    pojoName = builder.pojoName;
    mongoName = builder.mongoName;
    constraints = builder.constraints;
    validator = builder.validator;
    declaringClass = builder.declaringClass;
    tranzient = builder.tranzient;
    finl = builder.finl;
    computer = builder.computer;
    referenceLoadingTime = builder.referenceLoadingTime;
    referenceType = builder.referenceType;
}

From source file:com.graphhopper.jsprit.core.util.UnassignedJobReasonTracker.java

/**
 * Returns an unmodifiable map of codes and reason pairs.
 *
 * @return//from   w  w w  . j a v  a  2s.  co  m
 */
public Map<Integer, String> getCodesToReason() {
    return Collections.unmodifiableMap(codesToReason);
}

From source file:com.bluexml.side.framework.facetmap.multimap.FacetMapCacheManager.java

/**
 * @return the availableFacetMap
 */
public Map<String, SimpleFacetMapX> getAvailableFacetMap() {
    return Collections.unmodifiableMap(availableFacetMap);
}

From source file:com.nesscomputing.httpclient.HttpClientRequest.java

private HttpClientRequest(final HttpClientFactory httpClientFactory, final HttpClientMethod httpMethod,
        final URI url, final HttpClientResponseHandler<T> httpHandler,
        @Nonnull final List<HttpClientHeader> headers, @Nonnull final List<Cookie> cookies,
        @Nonnull final Map<String, Object> parameters, final String virtualHost, final int virtualPort,
        @Nonnull final List<HttpClientAuthProvider> authProviders, final Object content,
        final String contentType, final String contentEncoding, final Boolean followRedirects) {
    Preconditions.checkArgument(headers != null, "headers must not be null!");
    Preconditions.checkArgument(cookies != null, "cookies must not be null!");
    Preconditions.checkArgument(parameters != null, "parameters must not be null!");
    Preconditions.checkArgument(authProviders != null, "authProviders must not be null!");

    this.httpClientFactory = httpClientFactory;

    this.httpMethod = httpMethod;
    this.url = url;
    this.httpHandler = httpHandler;
    this.headers = Collections.unmodifiableList(headers);
    this.cookies = Collections.unmodifiableList(cookies);
    this.parameters = Collections.unmodifiableMap(parameters);

    this.virtualHost = virtualHost;
    this.virtualPort = virtualPort;

    this.authProviders = Collections.unmodifiableList(authProviders);

    this.content = content;
    this.contentType = contentType;
    this.contentEncoding = contentEncoding;

    this.followRedirects = followRedirects;

    if (content != null) {
        httpBodySource = httpClientFactory.getHttpBodySourceFor(content);
    }//  w w  w  . ja va 2  s  . c om
    if (httpBodySource != null) {

        if (contentType != null) {
            httpBodySource.setContentType(contentType);
        }

        if (contentEncoding != null) {
            httpBodySource.setContentEncoding(contentEncoding);
        }
    }
}

From source file:org.agiso.tempel.core.provider.CoreTemplateProvider.java

@Override
public void initialize(Map<String, Object> properties) throws IOException {
    for (int index = elements.size() - 1; index >= 0; index--) {
        ITemplateProviderElement provider = elements.get(index);
        if (coreLogger.isTraceEnabled())
            coreLogger.trace(Logs.LOG_02, ansiString(GREEN, provider.getClass().getSimpleName()),
                    ansiString(GREEN, provider.getOrder()));
        Map<String, String> providerProperties = provider.initialize();
        if (providerProperties != null) {
            properties.putAll(providerProperties);
            properties.put(provider.getScope(), Collections.unmodifiableMap(providerProperties));
        }//from  w w w.ja  v  a 2 s .  c  o m
    }
}

From source file:com.lunabeat.pooper.commands.AppCommand.java

private static Map<String, CommandInfo> initCommands() {
    Map<String, CommandInfo> tmpMap = new HashMap<String, CommandInfo>();
    tmpMap.put("list-clusters", new CommandInfo(0, null, "List all ec2-hadoop cluster names."));
    tmpMap.put("delete-cluster",
            new CommandInfo(1, new String[] { "name:string" }, "Delete groups for ec2-cluster."));
    tmpMap.put("launch-cluster", new CommandInfo(2,
            new String[] { "name:string", "size:instanceSize", "nodes:int" }, "Launch a new Hadoop cluster."));
    tmpMap.put("launch-master", new CommandInfo(3, new String[] { "name:string", "size:instanceSize" },
            "Launch a new Hadoop master."));
    tmpMap.put("launch-slaves",
            new CommandInfo(4, new String[] { "name:string", "size:instanceSize", "nodes:int" },
                    "Launch slaves for existing cluster."));
    tmpMap.put("terminate-cluster", new CommandInfo(5, new String[] { "name:string" },
            "Terminate all instances in a  Hadoop cluster."));
    tmpMap.put("terminate-slaves",
            new CommandInfo(6, new String[] { "name:string", "nodes:int" }, "Terminate slaves in a cluster."));
    tmpMap.put("describe-cluster",
            new CommandInfo(7, new String[] { "name:string" }, "Get instance info for a cluster."));
    tmpMap.put("push-file", new CommandInfo(8,
            new String[] { "clusterName:string", "instances:instances", "srcPath:string", "destPath:string" },
            "Copy file to cluster machines."));
    tmpMap.put("create-groups",
            new CommandInfo(9, new String[] { "clusterName:string" }, "Create security groups for cluster"));
    tmpMap.put("get-login-command", new CommandInfo(10, new String[] { "target:string" },
            "Get remote login command for master or specified instance id. This command is for external scripts."));
    tmpMap.put("login", new CommandInfo(11, new String[] { "target:string" },
            "Launch remote login for master or specific instance."));
    tmpMap.put("command",
            new CommandInfo(12, new String[] { "clusterName:string", "instances:instances", "command:string" },
                    "Run command on cluster machines."));

    return Collections.unmodifiableMap(tmpMap);
}

From source file:com.norconex.importer.handler.tagger.impl.ForceSingleValueTagger.java

public Map<String, String> getSingleValueFields() {
    return Collections.unmodifiableMap(singleFields);
}

From source file:gaffer.data.elementdefinition.view.ViewElementDefinition.java

/**
 * @return the transient property map. {@link LinkedHashMap} of transient property name to class name.
 *///from w w w .ja va  2 s .  c o m
@JsonIgnore
public Map<String, Class<?>> getTransientPropertyMap() {
    return Collections.unmodifiableMap(transientProperties);
}

From source file:com.mirth.connect.plugins.httpauth.RequestInfo.java

public Map<String, List<String>> getQueryParameters() {
    Map<String, List<String>> queryParameters = new CaseInsensitiveMap<String, List<String>>();
    for (Entry<String, List<String>> entry : this.queryParameters.entrySet()) {
        queryParameters.put(entry.getKey(), Collections.unmodifiableList(entry.getValue()));
    }//from w  ww  . jav  a 2 s. c o m
    return Collections.unmodifiableMap(queryParameters);
}