コード例 #1
0
  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;
  }
コード例 #2
0
 public boolean queryRawExists(String streamName, String queryRaw) {
   StreamStatusDTO streamStatus = streamStatusDao.get(streamName);
   if (streamStatus != null) {
     return streamStatus.getAddedQueries().containsValue(new QueryDTO(queryRaw));
   } else {
     return false;
   }
 }
コード例 #3
0
 public boolean queryIdExists(String streamName, String queryId) {
   StreamStatusDTO streamStatus = streamStatusDao.get(streamName);
   if (streamStatus != null) {
     return streamStatus.getAddedQueries().containsKey(queryId);
   } else {
     return false;
   }
 }
コード例 #4
0
  public void dropStream(String streamName) {

    Map<String, QueryDTO> attachedQueries = streamStatusDao.get(streamName).getAddedQueries();
    for (String queryId : attachedQueries.keySet()) {
      siddhiManager.removeQuery(queryId);
    }
    siddhiManager.removeStream(streamName);
    streamStatusDao.remove(streamName);
  }
コード例 #5
0
 public boolean isUserDefined(String streamName) {
   StreamStatusDTO streamStatus = streamStatusDao.get(streamName);
   return streamStatus != null ? streamStatus.getUserDefined() : false;
 }
コード例 #6
0
 public boolean streamExist(String streamName) {
   return streamStatusDao.get(streamName) != null ? true : false;
 }