-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add DROP CONNECTOR functionality (#3245)
- Loading branch information
Showing
20 changed files
with
421 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
.../src/main/java/io/confluent/ksql/cli/console/table/builder/DropConnectorTableBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2019 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (the "License"; you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.cli.console.table.builder; | ||
|
||
import io.confluent.ksql.cli.console.table.Table; | ||
import io.confluent.ksql.rest.entity.DropConnectorEntity; | ||
|
||
public class DropConnectorTableBuilder implements TableBuilder<DropConnectorEntity> { | ||
|
||
@Override | ||
public Table buildTable(final DropConnectorEntity entity) { | ||
return new Table.Builder() | ||
.withColumnHeaders("Message") | ||
.withRow("Dropped connector \"" + entity.getConnectorName() + '"') | ||
.build(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
ksql-parser/src/main/java/io/confluent/ksql/parser/tree/DropConnector.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright 2019 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (the "License"; you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.parser.tree; | ||
|
||
import io.confluent.ksql.parser.NodeLocation; | ||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
public class DropConnector extends Statement { | ||
|
||
private final String connectorName; | ||
|
||
public DropConnector(final Optional<NodeLocation> location, final String connectorName) { | ||
super(location); | ||
this.connectorName = connectorName; | ||
} | ||
|
||
public String getConnectorName() { | ||
return connectorName; | ||
} | ||
|
||
@Override | ||
public boolean equals(final Object o) { | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
final DropConnector that = (DropConnector) o; | ||
return Objects.equals(connectorName, that.connectorName); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(connectorName); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DropConnector{" | ||
+ "connectorName='" + connectorName + '\'' | ||
+ '}'; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
ksql-rest-app/src/main/java/io/confluent/ksql/rest/entity/DropConnectorEntity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2019 Confluent Inc. | ||
* | ||
* Licensed under the Confluent Community License (the "License"; you may not use | ||
* this file except in compliance with the License. You may obtain a copy of the | ||
* License at | ||
* | ||
* http://www.confluent.io/confluent-community-license | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
*/ | ||
|
||
package io.confluent.ksql.rest.entity; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import java.util.Objects; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class DropConnectorEntity extends KsqlEntity { | ||
|
||
private final String connectorName; | ||
|
||
public DropConnectorEntity( | ||
@JsonProperty("statementText") final String statementText, | ||
@JsonProperty("connectorName") final String connectorName | ||
) { | ||
super(statementText); | ||
this.connectorName = Objects.requireNonNull(connectorName, "connectorName"); | ||
} | ||
|
||
public String getConnectorName() { | ||
return connectorName; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "DropConnectorEntity{" | ||
+ "connectorName='" + connectorName + '\'' | ||
+ '}'; | ||
} | ||
} |
Oops, something went wrong.