public class MetadataResource extends CurationService
Modifier and Type | Field and Description |
---|---|
static String |
CATALOG |
static String |
DELETE |
static String |
PRODUCT_TYPE |
static String |
STAGING |
static String |
UPDATE |
config, FORMAT_HTML, FORMAT_JSON, sso, UNKNOWN_OUT_FORMAT
CATALOG_FACTORY_CLASS, CRAWLER_CONF_FILE, DEFAULT_TRANSFER_FACTORY, FM_PROPS, FM_URL, MET_AREA_PATH, MET_EXTENSION, MET_EXTRACTOR_CONF_UPLOAD_PATH, POLICY_UPLOAD_PATH, STAGING_AREA_PATH
Constructor and Description |
---|
MetadataResource() |
MetadataResource(javax.servlet.ServletContext context) |
Modifier and Type | Method and Description |
---|---|
boolean |
addElementsForProductType(String policy,
String id,
String elementIds) |
boolean |
addParentForProductType(String policy,
String id,
String parentId) |
String |
deleteCatalogMetadata(String id,
String name)
Method to delete a specific product from the catalog
|
void |
deleteCatalogProduct(Product product)
Deletes a given product from the catalog
|
Metadata |
getCatalogMetadata(Product product)
|
String |
getCatalogMetadata(String id,
String format,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
String |
getElementsForProductType(String policy,
String id,
boolean direct) |
protected String |
getExtractorConfigIdsAsHTML(String[] configIds,
String current) |
protected String |
getExtractorConfigIdsAsJSON(String[] configIds) |
protected String |
getMetadataAsHTML(Metadata metadata) |
String |
getMetadataInfo(String id) |
String |
getMetExtractorConfigList(String current,
String format) |
String |
getParentTypeMap(String policy) |
String |
getProductTypeIdsHavingElement(String policy,
String elementId) |
String |
getProductTypeMetadata(String id,
String format,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
protected Metadata |
getStagingMetadata(String id,
String configId,
Boolean overwrite) |
String |
getStagingMetadata(String id,
String format,
String configId,
Boolean overwrite,
javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res) |
Metadata |
readMetFile(String file)
|
boolean |
removeAllElementsForProductType(String policy,
String id) |
boolean |
removeElementsForProductType(String policy,
String id,
String elementIds) |
boolean |
removeParentForProductType(String policy,
String id) |
boolean |
removeProductType(String policy,
String id) |
protected Metadata |
runMetExtractor(String id,
ExtractorConfig config) |
String |
setCatalogMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams,
String id) |
String |
setProductTypeMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams) |
String |
setStagingMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams) |
void |
updateCatalogMetadata(Product product,
Metadata newMetadata)
|
String |
updateMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams,
String id,
String name,
boolean replace,
boolean remove)
Method to update the catalog metadata for a given product.
|
void |
writeMetFile(String id,
Metadata metadata)
|
cleansePath, getDirectoryAreaAsJSON, getFilesInDirectory, init, sendRedirect
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
public static final String STAGING
public static final String CATALOG
public static final String PRODUCT_TYPE
public static final String UPDATE
public static final String DELETE
public MetadataResource()
public MetadataResource(@Context javax.servlet.ServletContext context)
public String getStagingMetadata(String id, String format, String configId, Boolean overwrite, @Context javax.servlet.http.HttpServletRequest req, @Context javax.servlet.http.HttpServletResponse res)
protected String getExtractorConfigIdsAsHTML(String[] configIds, String current)
protected Metadata getStagingMetadata(String id, String configId, Boolean overwrite) throws InstantiationException, IOException, MetExtractionException
id
- Relative path from staging root to product. The met extension will
be added to this id to look up and see if a met file exists with
in the met area.configId
- Reference to the extractor config. ExtractorConfigReader
will load the configurationoverwrite
- Flag to indicate whether or not to overwrite a met file if present
in the staging area.Metadata
retrieved from the met area path if present or
extracted using the met extractor config.FileNotFoundException
InstantiationException
IOException
MetExtractionException
protected Metadata runMetExtractor(String id, ExtractorConfig config) throws MetExtractionException
id
- Relative path from staging root to the productconfig
- Configuration to run this met extractorMetExtractionException
public String getCatalogMetadata(String id, String format, @Context javax.servlet.http.HttpServletRequest req, @Context javax.servlet.http.HttpServletResponse res)
public String setCatalogMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams, String id)
public String getProductTypeMetadata(String id, String format, @Context javax.servlet.http.HttpServletRequest req, @Context javax.servlet.http.HttpServletResponse res)
public String setProductTypeMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams)
public String setStagingMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams)
public Metadata readMetFile(String file) throws InstantiationException, IOException
file
- The full path to the .met File
.Metadata
object.InstantiationException
InstantiationException
- If there is an error instantiating the Metadata
class.IOException
FileNotFoundException
FileNotFoundException
- If the .met File
is not found.IOException
- If there is an IO problem opening the met file.public Metadata getCatalogMetadata(Product product) throws CatalogException
public void writeMetFile(String id, Metadata metadata) throws IOException
id
- The identifier of the .met file to write.metadata
- The Metadata
object to persist and write to a File
.FileNotFoundException
- If the .met File
cannot be written.IOException
- If there is an IO exception writing the File
.public String updateMetadata(javax.ws.rs.core.MultivaluedMap<String,String> formParams, String id, String name, boolean replace, boolean remove)
id
- identifier of CAS product - either 'id' or 'name' must be specifiedname
- name of CAS product - either 'id' or 'name' must be specifiedformParams
- HTTP (name, value) form parameters. The parameter names MUST start with "metadata."replace
- optional flag set to false to add the new metadata values to the existing values, for the given flagspublic void updateCatalogMetadata(Product product, Metadata newMetadata) throws CatalogException, IOException
product
- The Product
to update Metadata
for.CatalogException
- If any error occurs during the update.IOException
FileNotFoundException
public String deleteCatalogMetadata(String id, String name)
id
- identifier of CAS product - either 'id' or 'name' must be specifiedname
- name of CAS product - either 'id' or 'name' must be specifiedpublic void deleteCatalogProduct(Product product) throws CatalogException
product
- The Product
to deleteFileNotFoundException
IOException
CatalogException
- If any error occurs during this delete operation.public boolean addParentForProductType(String policy, String id, String parentId)
public boolean removeParentForProductType(String policy, String id) throws ValidationLayerException
ValidationLayerException
public boolean addElementsForProductType(String policy, String id, String elementIds)
public String getElementsForProductType(String policy, String id, boolean direct)
public boolean removeAllElementsForProductType(String policy, String id)
public boolean removeElementsForProductType(String policy, String id, String elementIds)
Copyright © 1999–2017 Apache OODT. All rights reserved.