public class CswRecordConverter extends Object implements com.thoughtworks.xstream.converters.Converter, MetacardTransformer, InputTransformer
| Modifier and Type | Field and Description |
|---|---|
static MimeType |
XML_MIME_TYPE |
| Constructor and Description |
|---|
CswRecordConverter(MetacardType metacardType) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canConvert(Class clazz) |
static Serializable |
convertStringValueToMetacardValue(AttributeType.AttributeFormat attributeFormat,
String value)
Converts properties in CSW records that overlap with same name as a basic Metacard attribute,
e.g., title.
|
static String |
getCswAttributeFromAttributeName(String attributeName)
Converts an attribute name to the csw:Record attribute it corresponds to.
|
Attribute |
getMetacardAttributeFromCswAttribute(String cswAttributeName,
Serializable cswAttributeValue,
String metacardAttributeName)
|
void |
marshal(Object source,
com.thoughtworks.xstream.io.HierarchicalStreamWriter writer,
com.thoughtworks.xstream.converters.MarshallingContext context) |
Metacard |
transform(InputStream inputStream)
Transforms the input into a
Metacard. |
Metacard |
transform(InputStream inputStream,
String id)
|
BinaryContent |
transform(Metacard metacard,
Map<String,Serializable> arguments)
Transforms the provided
Metacard into a BinaryContent |
Object |
unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader,
com.thoughtworks.xstream.converters.UnmarshallingContext context) |
public static final MimeType XML_MIME_TYPE
public CswRecordConverter(MetacardType metacardType)
public boolean canConvert(Class clazz)
canConvert in interface com.thoughtworks.xstream.converters.ConverterMatcherpublic void marshal(Object source, com.thoughtworks.xstream.io.HierarchicalStreamWriter writer, com.thoughtworks.xstream.converters.MarshallingContext context)
marshal in interface com.thoughtworks.xstream.converters.Converterpublic Object unmarshal(com.thoughtworks.xstream.io.HierarchicalStreamReader reader, com.thoughtworks.xstream.converters.UnmarshallingContext context)
unmarshal in interface com.thoughtworks.xstream.converters.Converterpublic Metacard transform(InputStream inputStream) throws IOException, CatalogTransformerException
InputTransformerMetacard.transform in interface InputTransformerinputStream - the binary InputStream to transformMetacardIOException - if an I/O exception occurs when reading the InputStreamCatalogTransformerException - if an error occurs during transformationpublic Metacard transform(InputStream inputStream, String id) throws IOException, CatalogTransformerException
InputTransformertransform in interface InputTransformerinputStream - the binary InputStream to transformid - the attribute value for the Metacard.ID attribute that should be set in the
generated MetacardMetacardIOException - if an I/O exception occurs when reading the InputStreamCatalogTransformerException - if an error occurs during transformationpublic BinaryContent transform(Metacard metacard, Map<String,Serializable> arguments) throws CatalogTransformerException
MetacardTransformerMetacard into a BinaryContenttransform in interface MetacardTransformermetacard - the Metacard to be transformedarguments - any arguments to be used in the transformation. Keys are specific to each
MetacardTransformer implementationBinaryContent the result of the Metacard transformationCatalogTransformerException - if the Metacard can not be transformedpublic static Serializable convertStringValueToMetacardValue(AttributeType.AttributeFormat attributeFormat, String value)
attributeFormat - the format of the attribute to be convertedvalue - the value to be convertedreader and is of the type described by attributeFormatpublic Attribute getMetacardAttributeFromCswAttribute(String cswAttributeName, Serializable cswAttributeValue, String metacardAttributeName)
Attribute whose value is
cswAttributeValue converted to the type of the attribute metacardAttributeName
in a Metacard.cswAttributeName - the name of the CSW attributecswAttributeValue - the value of the CSW attributemetacardAttributeName - the name of the Metacard attribute whose type cswAttributeValue will be converted toAttribute with the name metacardAttributeName and the value cswAttributeValue converted to the type of the attribute metacardAttributeName in
a Metacard.public static String getCswAttributeFromAttributeName(String attributeName)
attributeName - the name of the attributeThis work is licensed under a Creative Commons Attribution 4.0 International License.