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;
  }
Exemplo n.º 2
0
 public StreamStatusDTO addQuery(String streamName, String queryId, String queryRaw) {
   StreamStatusDTO streamStatus = streamStatuses.get(streamName);
   if (streamStatus != null) {
     streamStatus.getAddedQueries().put(queryId, new QueryDTO(queryRaw));
   }
   return streamStatus;
 }
 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;
   }
 }
 public boolean queryIdExists(String streamName, String queryId) {
   StreamStatusDTO streamStatus = streamStatusDao.get(streamName);
   if (streamStatus != null) {
     return streamStatus.getAddedQueries().containsKey(queryId);
   } else {
     return false;
   }
 }
Exemplo n.º 5
0
 public Set<StreamAction> getEnabledActions(String streamName) {
   StreamStatusDTO streamStatus = streamStatuses.get(streamName);
   Set<StreamAction> enabledActions = new HashSet<>();
   if (streamStatus != null) {
     enabledActions = streamStatus.getActionsEnabled();
   }
   return enabledActions;
 }
 public boolean isUserDefined(String streamName) {
   StreamStatusDTO streamStatus = streamStatusDao.get(streamName);
   return streamStatus != null ? streamStatus.getUserDefined() : false;
 }
Exemplo n.º 7
0
 public void disableAction(String streamName, StreamAction action) {
   StreamStatusDTO streamStatus = streamStatuses.get(streamName);
   streamStatus.getActionsEnabled().remove(action);
 }
Exemplo n.º 8
0
 public void removeQuery(String streamName, String queryId) {
   StreamStatusDTO streamStatus = streamStatuses.get(streamName);
   if (streamStatus != null) {
     streamStatus.getAddedQueries().remove(queryId);
   }
 }
Exemplo n.º 9
0
 public void setActionQuery(String streamName, String queryId) {
   StreamStatusDTO streamStatus = streamStatuses.get(streamName);
   streamStatus.setActionQueryId(queryId);
 }
Exemplo n.º 10
0
 public String getActionQuery(String streamName) {
   StreamStatusDTO streamStatus = streamStatuses.get(streamName);
   String actionQueryId = streamStatus.getActionQueryId();
   streamStatus.setActionQueryId(null);
   return actionQueryId;
 }