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.jabref.exporter.ExportFormats.java

/**
 * Get a Map of all export formats.//  w  w  w .ja  v  a 2s .  c  om
 * @return A Map containing all export formats, mapped to their console names.
 */
public static Map<String, IExportFormat> getExportFormats() {
    // It is perhaps overly paranoid to make a defensive copy in this case:
    return Collections.unmodifiableMap(ExportFormats.EXPORT_FORMATS);
}

From source file:nu.yona.server.goals.service.ActivityCategoryDto.java

@JsonIgnore
public Map<Locale, String> getLocalizableDescriptionByLocale() {
    return Collections.unmodifiableMap(localizableDescription);
}

From source file:com.medallia.spider.api.DynamicInputImpl.java

public Map<String, String[]> getInputParams() {
    return Collections.unmodifiableMap(inputParams);
}

From source file:com.streamsets.datacollector.runner.StageContext.java

public StageContext(final String instanceName, StageType stageType, int runnerId, boolean isPreview,
        OnRecordError onRecordError, List<String> outputLanes, Map<String, Class<?>[]> configToElDefMap,
        Map<String, Object> constants, ExecutionMode executionMode, DeliveryGuarantee deliveryGuarantee,
        String resourcesDir, EmailSender emailSender, Configuration configuration,
        LineagePublisherDelegator lineagePublisherDelegator, RuntimeInfo runtimeInfo,
        Map<Class, Object> services) {
    super(configuration, configToElDefMap, Collections.unmodifiableMap(constants), emailSender,
            new MetricRegistry(), "myPipeline", "0", 0, "x", stageType, null, resourcesDir);
    this.pipelineTitle = "My Pipeline";
    this.pipelineDescription = "Sample Pipeline";
    this.pipelineMetadata = new HashMap<>();
    this.sdcId = "mySDC";
    // create dummy info for Stage Runners. This is required for stages that expose custom metrics
    this.stageInfo = new Stage.Info() {
        @Override//from   w w w .  j av  a2 s .c  o  m
        public String getName() {
            return "x";
        }

        @Override
        public int getVersion() {
            return 0;
        }

        @Override
        public String getInstanceName() {
            return instanceName;
        }

        @Override
        public String getLabel() {
            return instanceName;
        }
    };
    this.userContext = new UserContext("sdk-user", runtimeInfo.isDPMEnabled(),
            configuration.get(RemoteSSOService.DPM_USER_ALIAS_NAME_ENABLED,
                    RemoteSSOService.DPM_USER_ALIAS_NAME_ENABLED_DEFAULT));
    pipelineInfo = ImmutableList.of(stageInfo);
    this.runnerId = runnerId;
    this.isPreview = isPreview;
    this.outputLanes = ImmutableList.copyOf(outputLanes);
    this.onRecordError = onRecordError;
    errorSink = new ErrorSink();
    eventSink = new EventSink();
    this.pipelineMaxMemory = new MemoryLimitConfiguration().getMemoryLimit();
    this.executionMode = executionMode;
    this.deliveryGuarantee = deliveryGuarantee;
    reportErrorDelegate = errorSink;
    this.sharedRunnerMap = new ConcurrentHashMap<>();
    this.runtimeInfo = runtimeInfo;
    this.services = services;
    this.isErrorStage = false;

    this.sourceResponseSink = new SourceResponseSink();

    // sample all records while testing
    this.startTime = System.currentTimeMillis();
    this.lineagePublisherDelegator = lineagePublisherDelegator;
}

From source file:com.erudika.scoold.utils.LanguageUtils.java

/**
 * Reads localized strings from a file first, then the DB if a file is not found.
 * Returns a map of all translations for a given language.
 * Defaults to the default language which must be set.
 * @param langCode the 2-letter language code
 * @return the language map//from w w w . j  a  va 2  s .com
 */
public Map<String, String> readLanguage(String langCode) {
    if (StringUtils.isBlank(langCode) || langCode.equals(getDefaultLanguageCode())) {
        return getDefaultLanguage();
    } else if (langCode.length() > 2 && !ALL_LOCALES.containsKey(langCode)) {
        return readLanguage(langCode.substring(0, 2));
    } else if (LANG_CACHE.containsKey(langCode)) {
        return LANG_CACHE.get(langCode);
    }

    // load language map from file
    Map<String, String> lang = readLanguageFromFile(langCode);
    if (lang == null || lang.isEmpty()) {
        // or try to load from DB
        lang = new TreeMap<String, String>(getDefaultLanguage());
        Sysprop s = pc.read(keyPrefix.concat(langCode));
        if (s != null && !s.getProperties().isEmpty()) {
            Map<String, Object> loaded = s.getProperties();
            for (Map.Entry<String, String> entry : lang.entrySet()) {
                if (loaded.containsKey(entry.getKey())) {
                    lang.put(entry.getKey(), String.valueOf(loaded.get(entry.getKey())));
                } else {
                    lang.put(entry.getKey(), entry.getValue());
                }
            }
        }
        LANG_CACHE.put(langCode, lang);
    }
    return Collections.unmodifiableMap(lang);
}

From source file:com.netflix.evcache.pool.EVCacheClientPoolManager.java

public Map<String, EVCacheClientPool> getAllEVCacheClientPool() {
    return Collections.unmodifiableMap(poolMap);
}

From source file:io.lavagna.service.importexport.ImportEventProcessor.java

@Autowired
public ImportEventProcessor(CardRepository cardRepository, UserRepository userRepository,
        CardDataService cardDataService, CardService cardService, EventRepository eventRepository,

        LabelService labelService, CardLabelRepository cardLabelRepository, BoardRepository boardRepository) {

    this.userRepository = userRepository;

    Map<EventType, AbstractProcessEvent> mapping = new EnumMap<>(EventType.class);

    ///* w ww  . ja v  a 2s  .c o m*/
    mapping.put(EventType.CARD_CREATE,
            new CardCreate(cardRepository, userRepository, cardDataService, cardService));
    mapping.put(EventType.CARD_UPDATE,
            new CardUpdate(cardRepository, userRepository, cardDataService, cardService));
    mapping.put(EventType.CARD_MOVE,
            new CardMove(cardRepository, userRepository, cardDataService, cardService));

    AbstractProcessEvent abtProcessor = new CardArchiveBacklogTrash(cardRepository, userRepository,
            cardDataService, cardService, eventRepository);
    mapping.put(EventType.CARD_ARCHIVE, abtProcessor);
    mapping.put(EventType.CARD_BACKLOG, abtProcessor);
    mapping.put(EventType.CARD_TRASH, abtProcessor);

    AbstractProcessEvent descProcessor = new DescriptionCreateUpdate(cardRepository, userRepository,
            cardDataService);
    mapping.put(EventType.DESCRIPTION_CREATE, descProcessor);
    mapping.put(EventType.DESCRIPTION_UPDATE, descProcessor);

    mapping.put(EventType.COMMENT_CREATE, new CommentCreate(cardRepository, userRepository, cardDataService));
    mapping.put(EventType.COMMENT_UPDATE, new CommentUpdate(cardRepository, userRepository, cardDataService));
    mapping.put(EventType.COMMENT_DELETE, new CommentDelete(cardRepository, userRepository, cardDataService));

    mapping.put(EventType.ACTION_LIST_CREATE,
            new ActionListCreate(cardRepository, userRepository, cardDataService));
    mapping.put(EventType.ACTION_LIST_DELETE,
            new ActionListDelete(cardRepository, userRepository, cardDataService));

    mapping.put(EventType.ACTION_ITEM_CREATE,
            new ActionItemCreate(cardRepository, userRepository, cardDataService));
    mapping.put(EventType.ACTION_ITEM_DELETE,
            new ActionItemDelete(cardRepository, userRepository, cardDataService));
    mapping.put(EventType.ACTION_ITEM_MOVE,
            new ActionItemMove(cardRepository, userRepository, cardDataService));

    AbstractProcessEvent actionItemCheckUncheck = new ActionItemCheckUncheck(cardRepository, userRepository,
            cardDataService);
    mapping.put(EventType.ACTION_ITEM_CHECK, actionItemCheckUncheck);
    mapping.put(EventType.ACTION_ITEM_UNCHECK, actionItemCheckUncheck);

    mapping.put(EventType.LABEL_CREATE, new LabelCreate(cardRepository, userRepository, cardDataService,
            labelService, cardLabelRepository, boardRepository, eventRepository));
    mapping.put(EventType.LABEL_DELETE, new LabelDelete(cardRepository, userRepository, cardDataService,
            labelService, cardLabelRepository, boardRepository, eventRepository));

    mapping.put(EventType.FILE_UPLOAD, new FileUpload(cardRepository, userRepository, cardDataService));
    mapping.put(EventType.FILE_DELETE, new FileDelete(cardRepository, userRepository, cardDataService));
    //
    eventProcessors = Collections.unmodifiableMap(mapping);
}

From source file:org.eclipse.rdf4j.sail.federation.Federation.java

/**
 * Returns the configured {@link RepositoryBloomFilter}s (if any).
 * /*w ww  .j a v  a2 s . com*/
 * @return unmodifiable map of repositories to bloom filters.
 */
protected Map<Repository, RepositoryBloomFilter> getBloomFilters() {
    // unmodifiable to ensure no back-door changes
    return Collections.unmodifiableMap(bloomFilters);
}

From source file:eu.scidipes.toolkits.pawebapp.preservation.PreservationJobImpl.java

@Override
public Map<Preservable, PreservationJobItemResult<Preservable, ?>> getPreservationJobItemMap() {
    return Collections.unmodifiableMap(preservationJobItemMap);
}