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:de.xirp.profile.Plugin.java

/**
 * Returns the {@link de.xirp.profile.Option options}
 * of this plugin as map (option name to option value) for
 * convenience./*from www.  ja va2 s  .co m*/
 * 
 * @return The options in a map.
 * @see de.xirp.profile.Option
 */
public Map<String, String> getOptionsAsMap() {
    Map<String, String> optionMap = new HashMap<String, String>();
    for (Option option : options) {
        optionMap.put(option.getName(), option.getValue());
    }
    return Collections.unmodifiableMap(optionMap);
}

From source file:com.orange.servicebroker.staticcreds.stories.get_syslog_drain_url.CreateLogDrainServiceBindingTest.java

@Test
public void create_service_binding_with_static_syslog_drain_url_set_at_service_plan_level() throws Exception {
    given().syslog_drain_url_set_in_catalog(
            service_broker_properties_with_syslog_drain_url_at_service_plan_level_with_requires_field_set());
    when().cloud_controller_requests_to_create_a_service_instance_binding_for_plan_id("dev-id");
    then().it_should_be_returned_with_syslog_drain_url(
            new CreateServiceInstanceAppBindingResponse().withSyslogDrainUrl("syslog://log.dev.com:5000")
                    .withCredentials(Collections.unmodifiableMap(
                            Stream.of(new AbstractMap.SimpleEntry<>("URI", "http://my-api.org"))
                                    .collect(Collectors.toMap((e) -> e.getKey(), (e) -> e.getValue())))));
}

From source file:de.matzefratze123.heavyspleef.core.FlagManager.java

public Map<String, AbstractFlag<?>> getPresentFlags() {
    return Collections.unmodifiableMap(flags);
}

From source file:com.parse.ParseConfig.java

Map<String, Object> getParams() {
    return Collections.unmodifiableMap(new HashMap<>(params));
}

From source file:com.liferay.faces.generator.Generator.java

private Map<String, Tag> createCommonComponentsMap(DocumentBuilder documentBuilder) {

    InputStream commonComponentsInputStream = getClass().getResourceAsStream("/common-tags.xml");
    Map<String, Tag> commonComponentsMap = new HashMap<String, Tag>();
    Document document = null;/*from  w ww. j  a v  a2  s.c om*/

    try {
        document = documentBuilder.parse(commonComponentsInputStream);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    Node documentNode = document.getDocumentElement();
    NodeList childNodes = documentNode.getChildNodes();
    int totalChildNodes = childNodes.getLength();

    for (int i = 0; i < totalChildNodes; i++) {

        Node childNode = childNodes.item(i);
        String nodeName = childNode.getNodeName();

        if (nodeName.equals("tag")) {

            Tag tag = new Tag(childNode);
            commonComponentsMap.put(tag.getTagName(), tag);
        }
    }

    Set<Entry<String, Tag>> commonComponentsEntrySet = commonComponentsMap.entrySet();

    for (Entry<String, Tag> commonTagEntry : commonComponentsEntrySet) {

        Tag tag = commonTagEntry.getValue();
        addExtensionAttributes(tag, commonComponentsMap, document);
        tag.removeExtendsTags();
    }

    return Collections.unmodifiableMap(commonComponentsMap);
}

From source file:com.autentia.tnt.manager.security.impl.fixed.DefaultSecurityConfiguration.java

/**
 * Constructor//from  w  ww .ja v  a2 s .com
 * 
 * @param cfg
 */
public DefaultSecurityConfiguration(ConfigurationUtil cfg) {
    try {

        String path2File = cfg.getConfigDir() + cfg.getSecurityMatrix();
        File confFile = new File(path2File);
        Map<GrantedAuthority, boolean[]> permissionsMap = null;

        if (!confFile.exists()) {
            throw new SecConfigException("Fichero de configuracin de seguridad no encontrado:" + path2File);
        }

        logger.info("Loading ACEGI configuration from " + confFile);

        this.roleAdminId = cfg.getRoleAdminId();
        this.roleSupervisorId = cfg.getRoleSupervisorId();
        this.roleStaffId = cfg.getRoleStaffId();
        this.roleUserId = cfg.getRoleUserId();
        this.roleClientId = cfg.getRoleClientId();
        this.roleProjectManagerId = cfg.getRoleProjectManagerId();

        this.readMatrix = new HashMap<AclMatrixKey, AclMatrixValue>();
        this.writeMatrix = new HashMap<AclMatrixKey, AclMatrixValue>();
        this.deleteMatrix = new HashMap<AclMatrixKey, AclMatrixValue>();
        this.rolePermissions = new HashMap<Integer, GrantedAuthority[]>();
        this.workFlowMatrix = new HashMap<String, WorkFlow>();
        this.detailViewMatrix = new HashMap<FieldAclMatrixKey, Boolean>();
        permissionsMap = new HashMap<GrantedAuthority, boolean[]>();

        DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
        DocumentBuilder domBuilder = domFactory.newDocumentBuilder();
        org.w3c.dom.Document document = domBuilder.parse(confFile);

        this.loadEntities(document, permissionsMap);
        this.loadActions(document, permissionsMap);
        this.loadFlows(document, workFlowMatrix);
        this.readMatrix = Collections.unmodifiableMap(this.readMatrix);
        this.writeMatrix = Collections.unmodifiableMap(this.writeMatrix);
        this.deleteMatrix = Collections.unmodifiableMap(this.deleteMatrix);
        this.workFlowMatrix = Collections.unmodifiableMap(this.workFlowMatrix);
        this.detailViewMatrix = Collections.unmodifiableMap(this.detailViewMatrix);

        this.rolePermissions.put(roleAdminId, loadPermsArray(permissionsMap, 0));
        this.rolePermissions.put(roleSupervisorId, loadPermsArray(permissionsMap, 1));
        this.rolePermissions.put(roleStaffId, loadPermsArray(permissionsMap, 2));
        this.rolePermissions.put(roleUserId, loadPermsArray(permissionsMap, 3));
        this.rolePermissions.put(roleClientId, loadPermsArray(permissionsMap, 4));
        this.rolePermissions.put(roleProjectManagerId, loadPermsArray(permissionsMap, 5));

        logger.info("ACEGI configuration OK readed" + confFile);
    } catch (Exception ex) {
        logger.fatal(ex); // SAXException, ParserConfigurationException,
        // IOException, SecConfigException
    }
}

From source file:com.google.gerrit.util.http.testutil.FakeHttpServletRequest.java

@Override
public Map<String, String[]> getParameterMap() {
    return Collections.unmodifiableMap(Maps.transformValues(parameters.asMap(), STRING_COLLECTION_TO_ARRAY));
}

From source file:com.workplacesystems.queuj.Queue.java

/** Creates a new instance of QueueBuilder */
Queue(Queue parent_queue, QueueRestriction restriction, Index index, Class<B> process_builder_class,
        Class<? extends BatchProcessServer> process_server_class, Occurrence default_occurence,
        Visibility default_visibility, Access default_access, Resilience default_resilience,
        Output default_output, HashMap<String, Serializable> implementation_options) {
    this.parent_queue = parent_queue;
    this.restriction = restriction;
    this.index = index;
    this.process_builder_class = process_builder_class;
    this.process_server_class = process_server_class;
    this.default_occurence = default_occurence;
    this.default_visibility = default_visibility;
    this.default_access = default_access;
    this.default_resilience = default_resilience;
    this.default_output = default_output;
    HashMap<String, Serializable> implementation_options0 = new HashMap<String, Serializable>();
    if (parent_queue != null)
        implementation_options0.putAll(parent_queue.getImplementationOptions());
    implementation_options0.putAll(implementation_options);
    this.implementation_options = Collections.unmodifiableMap(implementation_options0);

    setId(this);/*  w  w w  .j  a va2s. c o  m*/

    if (log.isDebugEnabled())
        log.debug("Creating Queue:" + new_line + toString());
}

From source file:org.agiso.tempel.Tempel.java

/**
 * //w  w w  .  ja  v  a2 s .  c om
 */
@Override
public void startTemplate(String name, Map<String, String> params, String workDir) throws Exception {
    Map<String, Object> properties = new TreeMap<String, Object>();

    // Wypeniamy map properties dodajc do niej parametry poszczeglnych
    // poziomw tak, e parametry wyszego poziomu przykrywaj parametry
    // niszego poziomu (przedefiniowywanie parametrw):

    // Parametry systemowe wywoania maszyny wirtualnej Java (1):
    properties.putAll(systemProperties);
    properties.put("SYSTEM", systemProperties);

    // Parametry ustawie globalnych (2), uytkownika (3) i lokalnych (4):
    templateProvider.initialize(properties);

    // Parametry uruchomieniowe (5):
    properties.putAll(params);

    // W oparciu o parametry uytkownika budujemy parametry uruchomienia:
    properties.putAll(addRuntimeProperties(properties));

    // Po zbudowaniu mapy properties przegldamy j i rozwijamy parametry:
    for (String key : properties.keySet()) {
        Object value = properties.get(key);
        if (value instanceof String) {
            String oldValue = (String) value;
            String newValue = expressionEvaluator.evaluate(oldValue, properties);
            if (!oldValue.equals(newValue)) {
                coreLogger.debug(Logs.LOG_01, key, oldValue, newValue);
                properties.put(key, newValue);
            }
        }
    }

    properties = Collections.unmodifiableMap(properties);

    // Po rozwiniciu parametrw inicjalizujemy provider'a szablonw:
    templateProvider.configure(properties);

    // Uruchamianie procesu generacji w oparciu o wskazany szablon:
    templateExecutor.executeTemplate(name, properties, workDir);
}

From source file:io.coala.json.DynaBean.java

protected void lock() {
    if (this.dynamicProperties != null)
        this.dynamicProperties = Collections.unmodifiableMap(this.dynamicProperties);
}