/* * Copyright (c) 2014 Cable Television Laboratories, Inc. and others. All rights reserved. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ package org.pcmm.objects; import java.util.HashMap; import java.util.Map; /** * This stores and handles the PCMM resources. * */ public class PCMMResourceSet { private Map> mapper; private static PCMMResourceSet instance; private PCMMResourceSet() { mapper = new HashMap>(); } public static PCMMResourceSet getInstance() { if (instance == null) instance = new PCMMResourceSet(); return instance; } /** * adds a new mapping * * @param key * to be used for identifying mapped structure * @return resource mapper */ @SuppressWarnings("unchecked") public PCMMResourcesMapper getMappedResources( Object key) { return (PCMMResourcesMapper) mapper.get(key); } public void mapResources(Object key, PCMMResourcesMapper resources) { mapper.put(key, resources); } public void removeMapping(Object key) { mapper.remove(key); } public void removeAllMappings() { mapper.clear(); } }