com.okworx.ilcd.validation.reference.ReferenceCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ilcd-validation Show documentation
Show all versions of ilcd-validation Show documentation
A Java library for performing technical validation of data in ILCD data format.
package com.okworx.ilcd.validation.reference;
import java.io.File;
import java.net.URI;
import java.util.Collection;
import java.util.HashMap;
import org.apache.logging.log4j.Logger;
import com.okworx.ilcd.validation.common.DefaultValidationContext;
import com.okworx.ilcd.validation.common.IContextAwareComponent;
import com.okworx.ilcd.validation.common.IValidationContext;
/**
* ReferenceCache class.
*
* @author oliver.kusche
* @version $Id: $Id
*/
public class ReferenceCache implements IContextAwareComponent {
protected final Logger log = org.apache.logging.log4j.LogManager.getLogger(this
.getClass());
private HashMap references = new HashMap();
private IValidationContext validationContext = new DefaultValidationContext();
/**
* getLinks.
*
* @return a {@link java.util.HashMap} object.
*/
public HashMap getLinks() {
return references;
}
/**
* put.
*
* @param objects a {@link java.util.HashMap} object.
*/
public void put(HashMap objects) {
this.references.putAll( objects );
}
/**
* initializeFromDir.
*
* @param directory a {@link java.io.File} object.
*/
public void initializeFromDir(File directory) {
ReferenceBuilder builder = new ReferenceBuilder();
builder.setValidationContext(validationContext);
builder.build(directory);
this.references = builder.getReferences();
}
/**
* initializeFromFiles.
*
* @param files a {@link java.util.Collection} object.
*/
public void initializeFromFiles(Collection files) {
}
/**
* initializeFromURIs.
*
* @param files a {@link java.util.Collection} object.
*/
public void initializeFromURIs(Collection files) {
}
/**
* initializeFromArchive.
*
* @param archive a {@link java.io.File} object.
*/
public void initializeFromArchive(File archive) {
initializeFromDir(archive);
}
/**
* contains.
*
* @param reference a {@link com.okworx.ilcd.validation.reference.IDatasetReference} object.
* @return a boolean.
*/
public boolean contains(IDatasetReference reference) {
return references.containsKey(reference.getUuid());
}
/**
* contains.
*
* @param uuid a {@link java.lang.String} object.
* @return a boolean.
*/
public boolean contains(String uuid) {
return references.containsKey(uuid);
}
/**
* Getter for the field validationContext
.
*
* @return a {@link com.okworx.ilcd.validation.common.IValidationContext} object.
*/
public IValidationContext getValidationContext() {
return validationContext;
}
/** {@inheritDoc} */
public void setValidationContext(IValidationContext validationContext) {
this.validationContext = validationContext;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy