public List<StratioStreamingMessage> list() {
    List<StratioStreamingMessage> result = new ArrayList<>();
    for (StreamDefinition streamDefinition : siddhiManager.getStreamDefinitions()) {
      if (suitableToList(streamDefinition.getStreamId())) {
        StratioStreamingMessage message = new StratioStreamingMessage();
        for (Attribute attribute : streamDefinition.getAttributeList()) {
          message.addColumn(
              new ColumnNameTypeValue(
                  attribute.getName(), this.getStreamingType(attribute.getType()), null));
        }
        StreamStatusDTO streamStatus = streamStatusDao.get(streamDefinition.getStreamId());

        if (streamStatus != null) {
          Map<String, QueryDTO> attachedQueries = streamStatus.getAddedQueries();

          for (Map.Entry<String, QueryDTO> entry : attachedQueries.entrySet()) {
            message.addQuery(new StreamQuery(entry.getKey(), entry.getValue().getQueryRaw()));
          }
          message.setUserDefined(streamStatus.getUserDefined());
          message.setActiveActions(
              streamStatusDao.getEnabledActions(streamDefinition.getStreamId()));
        }

        message.setStreamName(streamDefinition.getStreamId());

        result.add(message);
      }
    }

    return result;
  }
 public String addQuery(String streamName, String queryString) {
   String queryId = siddhiManager.addQuery(queryString);
   streamStatusDao.addQuery(streamName, queryId, queryString);
   for (StreamDefinition streamDefinition : siddhiManager.getStreamDefinitions()) {
     // XXX refactor to obtain exactly siddhi inferred streams.
     streamStatusDao.createInferredStream(
         streamDefinition.getStreamId(),
         castToColumnNameTypeValue(streamDefinition.getAttributeList()));
   }
   return queryId;
 }
 public List<StreamDefinition> getSiddhiStreams(
     String[] inputStreamDefinitions, String queryExpressions) throws SiddhiParserException {
   SiddhiManager siddhiManager = createMockSiddhiManager(inputStreamDefinitions, queryExpressions);
   List<org.wso2.siddhi.query.api.definition.StreamDefinition> streamDefinitions =
       siddhiManager.getStreamDefinitions();
   List<StreamDefinition> databridgeStreamDefinitions =
       new ArrayList<StreamDefinition>(streamDefinitions.size());
   for (org.wso2.siddhi.query.api.definition.StreamDefinition siddhiStreamDef :
       streamDefinitions) {
     StreamConfiguration streamConfig = new StreamConfiguration(siddhiStreamDef.getStreamId());
     StreamDefinition databridgeStreamDef =
         EventProcessorUtil.convertToDatabridgeStreamDefinition(siddhiStreamDef, streamConfig);
     databridgeStreamDefinitions.add(databridgeStreamDef);
   }
   siddhiManager.shutdown();
   return databridgeStreamDefinitions;
 }