This repository has been archived by the owner on Jul 29, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(search): synchronize search indexes across management instances
- Loading branch information
1 parent
c2d65ec
commit 5e3abf0
Showing
4 changed files
with
293 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/io/gravitee/repository/management/api/CommandRepository.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 (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.management.api; | ||
|
||
import io.gravitee.repository.management.api.search.CommandCriteria; | ||
import io.gravitee.repository.management.model.Command; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public interface CommandRepository extends CrudRepository<Command, String> { | ||
List<Command> search(CommandCriteria criteria); | ||
|
||
} |
104 changes: 104 additions & 0 deletions
104
src/main/java/io/gravitee/repository/management/api/search/CommandCriteria.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,104 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.management.api.search; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class CommandCriteria { | ||
private String to; | ||
private String[] tags; | ||
private boolean notDeleted; | ||
private String notFrom; | ||
private String notAckBy; | ||
|
||
CommandCriteria(Builder builder) { | ||
this.to = builder.to; | ||
this.tags = builder.tags; | ||
this.notDeleted = builder.notDeleted; | ||
this.notFrom = builder.notFrom; | ||
this.notAckBy = builder.notAckBy; | ||
} | ||
|
||
public String getTo() { | ||
return to; | ||
} | ||
|
||
public String[] getTags() { | ||
return tags; | ||
} | ||
|
||
public boolean isNotDeleted() { | ||
return notDeleted; | ||
} | ||
|
||
public String getNotFrom() { | ||
return notFrom; | ||
} | ||
|
||
public String getNotAckBy() { | ||
return notAckBy; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "criteria {" + | ||
"to: " + to + | ||
"tags: " + tags + | ||
"notDeleted: " + notDeleted + | ||
"notFrom: " + notFrom + | ||
"notAckBy:" + notAckBy + | ||
"}"; | ||
} | ||
|
||
public static class Builder { | ||
private String to; | ||
private String[] tags; | ||
private boolean notDeleted; | ||
private String notFrom; | ||
private String notAckBy; | ||
|
||
public CommandCriteria build() { | ||
return new CommandCriteria(this); | ||
} | ||
|
||
public Builder to(String to) { | ||
this.to = to; | ||
return this; | ||
} | ||
|
||
public Builder tags(String... tags) { | ||
this.tags = tags; | ||
return this; | ||
} | ||
|
||
public Builder notDeleted() { | ||
this.notDeleted = true; | ||
return this; | ||
} | ||
|
||
public Builder notFrom(String from) { | ||
this.notFrom = from; | ||
return this; | ||
} | ||
|
||
public Builder notAckBy(String by) { | ||
this.notAckBy = by; | ||
return this; | ||
} | ||
} | ||
} |
134 changes: 134 additions & 0 deletions
134
src/main/java/io/gravitee/repository/management/model/Command.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,134 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.management.model; | ||
|
||
import java.util.Date; | ||
import java.util.List; | ||
import java.util.Objects; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
|
||
public class Command { | ||
private String id; | ||
private String from; | ||
private String to; | ||
private List<String> tags; | ||
private String content; | ||
private List<String> acknowledgments; | ||
private Date deleteAt; | ||
private Date createdAt; | ||
private Date updatedAt; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getFrom() { | ||
return from; | ||
} | ||
|
||
public void setFrom(String from) { | ||
this.from = from; | ||
} | ||
|
||
public String getTo() { | ||
return to; | ||
} | ||
|
||
public void setTo(String to) { | ||
this.to = to; | ||
} | ||
|
||
public List<String> getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(List<String> tags) { | ||
this.tags = tags; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
public List<String> getAcknowledgments() { | ||
return acknowledgments; | ||
} | ||
|
||
public void setAcknowledgments(List<String> acknowledgments) { | ||
this.acknowledgments = acknowledgments; | ||
} | ||
|
||
public Date getDeleteAt() { | ||
return deleteAt; | ||
} | ||
|
||
public void setDeleteAt(Date deleteAt) { | ||
this.deleteAt = deleteAt; | ||
} | ||
|
||
public Date getCreatedAt() { | ||
return createdAt; | ||
} | ||
|
||
public void setCreatedAt(Date createdAt) { | ||
this.createdAt = createdAt; | ||
} | ||
|
||
public Date getUpdatedAt() { | ||
return updatedAt; | ||
} | ||
|
||
public void setUpdatedAt(Date updatedAt) { | ||
this.updatedAt = updatedAt; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
Command msg = (Command) o; | ||
return Objects.equals(id, msg.id); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(id); | ||
} | ||
|
||
public String toString() { | ||
return "Message{" + | ||
"id='" + id + '\'' + | ||
", from='" + from + '\'' + | ||
", to='" + to + '\'' + | ||
", tags='" + tags + '\'' + | ||
", content='" + content + '\'' + | ||
", acknowledgments=" + acknowledgments + | ||
", deleteAt=" + deleteAt + | ||
'}'; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
src/main/java/io/gravitee/repository/management/model/MessageRecipient.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,25 @@ | ||
/** | ||
* Copyright (C) 2015 The Gravitee team (http://gravitee.io) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.gravitee.repository.management.model; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
|
||
public enum MessageRecipient { | ||
MANAGEMENT_APIS, GATEWAYS | ||
} |