All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.emc.storageos.model.property.PropertiesMetadata Maven / Gradle / Ivy

There is a newer version: 3.5.0.0
Show newest version
/*
 * Copyright (c) 2012 EMC Corporation
 * All Rights Reserved
 */
package com.emc.storageos.model.property;

import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.Map;
import java.util.TreeMap;

@XmlRootElement(name = "properties_metadata")
public class PropertiesMetadata {
    // Singleton instance provides access to global metadata
    private static volatile PropertiesMetadata INSTANCE;

    private Map metadata;

    public static PropertiesMetadata getInstance() {
        if (INSTANCE == null) {
            INSTANCE = new PropertiesMetadata();
        }
        return INSTANCE;
    }

    public static Map getGlobalMetadata() {
        return getInstance().getMetadata();
    }

    public void setMetadata(Map newMetadata) {
        System.out.println("Setting: " + newMetadata);
        this.metadata = new TreeMap(newMetadata);
        INSTANCE = this;
    }

    @XmlElementWrapper(name = "metadata")
    public Map getMetadata() {
        if (metadata == null) {
            metadata = new TreeMap();
        }
        return metadata;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy