public int enlargeStream(
      String streamName, List<ColumnNameTypeValue> columns, Boolean raiseException)
      throws ServiceException {
    int addedColumns = 0;
    StreamDefinition streamMetaData = siddhiManager.getStreamDefinition(streamName);
    for (ColumnNameTypeValue columnNameTypeValue : columns) {
      if (!SiddhiUtils.columnAlreadyExistsInStream(
          columnNameTypeValue.getColumn(), streamMetaData)) {
        addedColumns++;
        // JPFM -- Updating the columns in streamStatusDao
        streamStatusDao.addColumn(streamName, columnNameTypeValue);
        streamMetaData.attribute(
            columnNameTypeValue.getColumn(), getSiddhiType(columnNameTypeValue.getType()));
      } else {
        if (raiseException) {
          throw new ServiceException(
              String.format(
                  "Alter stream error, Column %s already " + "exists.",
                  columnNameTypeValue.getColumn()));
        }
      }
    }

    return addedColumns;
  }
 public void removeQuery(String queryId, String streamName) {
   siddhiManager.removeQuery(queryId);
   streamStatusDao.removeQuery(streamName, queryId);
   for (Map.Entry<String, StreamStatusDTO> streamStatus : streamStatusDao.getAll().entrySet()) {
     String temporalStreamName = streamStatus.getKey();
     if (siddhiManager.getStreamDefinition(temporalStreamName) == null) {
       this.dropStream(temporalStreamName);
     }
   }
 }
 public void send(String streamName, List<ColumnNameTypeValue> columns) throws ServiceException {
   try {
     siddhiManager
         .getInputHandler(streamName)
         .send(
             SiddhiUtils.getOrderedValues(siddhiManager.getStreamDefinition(streamName), columns));
   } catch (InterruptedException e) {
     throw new ServiceException(
         String.format("Error sending data to stream %s, column data: %s", streamName, columns),
         e);
   }
 }
  @Override
  public void declareOutputFields(OutputFieldsDeclarer declarer) {
    if (siddhiManager == null) {
      init();
    }

    // Declaring output fileds for each exported stream ID
    for (String streamId : exportedStreamIds) {
      StreamDefinition streamDefinition = siddhiManager.getStreamDefinition(streamId);

      if (streamDefinition == null) {
        throw new RuntimeException("Cannot find exported stream - " + streamId);
      }
      List<String> list = new ArrayList<String>();

      for (Attribute attribute : streamDefinition.getAttributeList()) {
        list.add(attribute.getName());
      }
      Fields fields = new Fields(list);
      declarer.declareStream(streamId, fields);
      log.info("Declaring output field for stream -" + streamId);
    }
  }