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

gov.nasa.pds.citool.util.RegistryObjectCache Maven / Gradle / Ivy

Go to download

The Legacy Catalog Tool provides functionality for ingesting PDS3 catalog files into the PDS4 infrastructure including the Registry Service.

There is a newer version: 3.1.0
Show newest version
package gov.nasa.pds.citool.util;

import java.util.HashMap;
import java.util.Map;

import gov.nasa.pds.citool.registry.model.RegistryObject;

public class RegistryObjectCache 
{
	private static RegistryObjectCache instance = new RegistryObjectCache();
	
	private Map map;
	
	private RegistryObjectCache()
	{
		map = new HashMap<>();
	}
	
	public static RegistryObjectCache getInstance()
	{
		return instance;
	}
	
	public void put(RegistryObject ro)
	{
		if(ro == null) return;
		
		// Main LID
		map.put(ro.getLid(), ro);
		
		// Alternative LID (Instrument host can have one, e.g., 
		// main = urn:nasa:pds:context_pds3:instrument_host:spacecraft.go
	    // alternative = urn:nasa:pds:context_pds3:instrument_host:instrument_host.gp)
		if(ro.getAltLid() != null)
		{
			map.put(ro.getAltLid(), ro);
		}
	}
	
	public RegistryObject get(String lid)
	{
		return map.get(lid);
	}
	
	public void clear()
	{
		map.clear();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy