Search in sources :

Example 1 with AnyURIObjectPropertyType

use of org.mitre.cybox.common_2.AnyURIObjectPropertyType in project metron by apache.

the class URIHandler method extract.

@Override
public Iterable<LookupKV> extract(URIObjectType type, Map<String, Object> config) throws IOException {
    List<LookupKV> ret = new ArrayList<>();
    if (type != null) {
        AnyURIObjectPropertyType val = type.getValue();
        if (val != null) {
            Object v = val.getValue();
            if (v != null) {
                final String indicatorType = getType();
                LookupKV results = new LookupKV(new EnrichmentKey(indicatorType, v.toString()), new EnrichmentValue(new HashMap<String, Object>() {

                    {
                        put("source-type", "STIX");
                        put("uri", v.toString());
                        put("indicator-type", indicatorType);
                        put("source", type.toXMLString());
                    }
                }));
                ret.add(results);
            }
        }
    }
    return ret;
}
Also used : LookupKV(org.apache.metron.enrichment.lookup.LookupKV) AnyURIObjectPropertyType(org.mitre.cybox.common_2.AnyURIObjectPropertyType) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EnrichmentKey(org.apache.metron.enrichment.converter.EnrichmentKey) EnrichmentValue(org.apache.metron.enrichment.converter.EnrichmentValue)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 EnrichmentKey (org.apache.metron.enrichment.converter.EnrichmentKey)1 EnrichmentValue (org.apache.metron.enrichment.converter.EnrichmentValue)1 LookupKV (org.apache.metron.enrichment.lookup.LookupKV)1 AnyURIObjectPropertyType (org.mitre.cybox.common_2.AnyURIObjectPropertyType)1