Beispiel #1
0
  @CliCommand(value = "columns", help = "list all streams querys into engine")
  public String listQuerys(
      @CliOption(
              key = {"stream"},
              help = "The stream name",
              mandatory = true,
              optionContext = "stream")
          final String streamName) {
    // XXX create new renderer to render this table
    try {

      List<ColumnNameTypeValue> columnsValues = ssaw.api().columnsFromStream(streamName);

      List<String> columns = Arrays.asList("Column", "Type");
      List<Map<String, Object>> data = new ArrayList<>();

      for (ColumnNameTypeValue columnValue : columnsValues) {
        Map<String, Object> row = new HashMap<>();
        row.put("Column", columnValue.getColumn());
        row.put("Type", columnValue.getType());

        data.add(row);
      }

      return TableRenderer.renderMapDataAsTable(data, columns);
    } catch (StratioStreamingException e) {
      throw new StreamingShellException(e);
    }
  }
Beispiel #2
0
 @CliCommand(value = "insert", help = "insert events into existing stream")
 public String insert(
     @CliOption(
             key = {"stream"},
             help = "The stream name",
             mandatory = true,
             optionContext = "stream")
         final String streamName,
     @CliOption(
             key = {"values"},
             help =
                 "Values to add. Comma seaparated name.value fields. Example: 'id.345,name.Test test test,age.26,date.1401198535",
             mandatory = true)
         final ColumnNameValueList columns) {
   try {
     ssaw.api().insertData(streamName, columns);
     return "Added an event to stream ".concat(streamName).concat(" correctly");
   } catch (StratioStreamingException e) {
     throw new StreamingShellException(e);
   }
 }
Beispiel #3
0
  @CliCommand(value = "alter", help = "alter existing stream")
  public String alter(
      @CliOption(
              key = {"stream"},
              help = "The stream name",
              mandatory = true,
              optionContext = "stream")
          final String streamName,
      @CliOption(
              key = {"definition"},
              help =
                  "Stream definition to add. Comma seaparated name.type fields. Example: 'id.integer,name.string,age.integer,date.long",
              mandatory = true)
          final ColumnNameTypeList columns) {
    try {
      ssaw.api().alterStream(streamName, columns);
      return "Stream ".concat(streamName).concat(" altered correctly");

    } catch (StratioStreamingException e) {
      throw new StreamingShellException(e);
    }
  }