OmniSciDB  2e3a973ef4
SqlAlterServer.java
Go to the documentation of this file.
1 package com.mapd.parser.extension.ddl;
2 
3 import com.google.gson.annotations.Expose;
4 
5 import org.apache.calcite.sql.SqlDdl;
6 import org.apache.calcite.sql.SqlKind;
7 import org.apache.calcite.sql.SqlNode;
8 import org.apache.calcite.sql.SqlOperator;
9 import org.apache.calcite.sql.SqlSpecialOperator;
10 import org.apache.calcite.sql.parser.SqlParserPos;
11 
12 import java.util.List;
13 import java.util.Map;
14 
18 public class SqlAlterServer extends SqlDdl implements JsonSerializableDdl {
19  private static final SqlOperator OPERATOR =
20  new SqlSpecialOperator("ALTER_SERVER", SqlKind.OTHER_DDL);
21 
34  public enum AlterType { SET_OPTIONS, CHANGE_OWNER, RENAME_SERVER, SET_DATA_WRAPPER }
35 
36  public static class Builder extends SqlOptionsBuilder {
38  private String serverName;
39  private String newServerName;
40  private String newOwner;
41  private String dataWrapper;
42  private SqlParserPos pos;
43 
44  public void setAlterType(final AlterType alterType) {
45  this.alterType = alterType;
46  }
47 
48  public void setServerName(final String serverName) {
49  this.serverName = serverName;
50  }
51 
52  public void setNewServerName(final String newServerName) {
53  this.newServerName = newServerName;
54  }
55 
56  public void setNewOwner(final String newOwner) {
57  this.newOwner = newOwner;
58  }
59 
60  public void setDataWrapper(final String dataWrapper) {
61  this.dataWrapper = dataWrapper;
62  }
63 
64  public void setPos(final SqlParserPos pos) {
65  this.pos = pos;
66  }
67 
68  public SqlAlterServer build() {
69  return new SqlAlterServer(pos,
70  alterType,
71  serverName,
72  newServerName,
73  newOwner,
74  dataWrapper,
75  super.options);
76  }
77  }
78 
79  @Expose
81  @Expose
82  private String newServerName;
83  @Expose
84  private String newOwner;
85  @Expose
86  private String serverName;
87  @Expose
88  private String dataWrapper;
89  @Expose
90  private String command;
91  @Expose
92  private Map<String, String> options;
93 
94  public SqlAlterServer(final SqlParserPos pos,
95  final AlterType alterType,
96  final String serverName,
97  final String newServerName,
98  final String newOwner,
99  final String dataWrapper,
100  final Map<String, String> options) {
101  super(OPERATOR, pos);
102  this.alterType = alterType;
103  this.newServerName = newServerName;
104  this.newOwner = newOwner;
105  this.serverName = serverName;
106  this.dataWrapper = dataWrapper;
107  this.options = options;
108  this.command = OPERATOR.getName();
109  }
110 
111  @Override
112  public List<SqlNode> getOperandList() {
113  return null;
114  }
115 
116  @Override
117  public String toString() {
118  return toJsonString();
119  }
120 }
void setNewServerName(final String newServerName)
SqlAlterServer(final SqlParserPos pos, final AlterType alterType, final String serverName, final String newServerName, final String newOwner, final String dataWrapper, final Map< String, String > options)