public static SortedMap<String, AlertStreamSchemaEntity> getAttrMap(String streamName) { SortedMap<String, AlertStreamSchemaEntity> map = StreamMetadataManager.getInstance().getMetadataEntityMapForStream(streamName); if(map == null || map.size() == 0){ throw new IllegalStateException("Alert stream schema ["+streamName+"] should never be empty"); } return map; }
/** * 1. input has 3 fields, first is siddhi context, second is streamName, the last one is map of attribute name/value * 2. runtime check for input data (This is very expensive, so we ignore for now) * the size of input map should be equal to size of attributes which stream metadata defines * the attribute names should be equal to attribute names which stream metadata defines * the input field cannot be null */ @SuppressWarnings({"rawtypes"}) @Override public void evaluate(ValuesArray data) throws Exception { if (!siddhiRuntime.markdownEnabled) { if (LOG.isDebugEnabled()) { LOG.debug("Siddhi policy evaluator consumers data :" + data); } Collector outputCollector = (Collector) data.get(0); String streamName = (String) data.get(1); SortedMap dataMap = (SortedMap) data.get(2); // Get metadata keyset for the stream. Set<String> metadataKeys = StreamMetadataManager.getInstance() .getMetadataEntityMapForStream(streamName).keySet(); validateEventInRuntime(streamName, dataMap, metadataKeys); synchronized (siddhiRuntime) { // retain the collector in the context. This assignment is idempotent context.outputCollector = outputCollector; List<Object> input = new ArrayList<Object>(); putAttrsIntoInputStream(input, streamName, metadataKeys, dataMap); siddhiRuntime.siddhiInputHandlers.get(streamName).send(input.toArray(new Object[0])); } } }
@Override public void init() { StreamMetadataManager.getInstance().init(config, getAlertStreamSchemaDAO(config));
Map<String, String> tags = new HashMap<String, String>(); for (String sourceStream : sourceStreamsArr) { List<AlertStreamSchemaEntity> list = StreamMetadataManager.getInstance().getMetadataEntitiesForStream(sourceStream.trim()); for (AlertStreamSchemaEntity alertStream : list) { if (alertStream.getUsedAsTag() != null && alertStream.getUsedAsTag() == true) {