This repository has been archived by the owner on Aug 20, 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
dd76488
commit 13818d6
Showing
25 changed files
with
1,028 additions
and
21 deletions.
There are no files selected for viewing
71 changes: 71 additions & 0 deletions
71
...anagement-api-model/src/main/java/io/gravitee/management/model/command/CommandEntity.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,71 @@ | ||
/** | ||
* 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.management.model.command; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class CommandEntity { | ||
|
||
private String id; | ||
private String to; | ||
private List<CommandTags> tags; | ||
private String content; | ||
private long ttlInSeconds; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getTo() { | ||
return to; | ||
} | ||
|
||
public void setTo(String to) { | ||
this.to = to; | ||
} | ||
|
||
public List<CommandTags> getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(List<CommandTags> tags) { | ||
this.tags = tags; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
public long getTtlInSeconds() { | ||
return ttlInSeconds; | ||
} | ||
|
||
public void setTtlInSeconds(long ttlInSeconds) { | ||
this.ttlInSeconds = ttlInSeconds; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...management-api-model/src/main/java/io/gravitee/management/model/command/CommandQuery.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,44 @@ | ||
/** | ||
* 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.management.model.command; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class CommandQuery { | ||
|
||
private String to; | ||
private List<CommandTags> tags; | ||
|
||
public String getTo() { | ||
return to; | ||
} | ||
|
||
public void setTo(String to) { | ||
this.to = to; | ||
} | ||
|
||
public List<CommandTags> getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(List<CommandTags> tags) { | ||
this.tags = tags; | ||
} | ||
} |
60 changes: 60 additions & 0 deletions
60
...-model/src/main/java/io/gravitee/management/model/command/CommandSearchIndexerEntity.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,60 @@ | ||
/** | ||
* 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.management.model.command; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class CommandSearchIndexerEntity { | ||
|
||
private String id; | ||
private String clazz; | ||
private String action; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getClazz() { | ||
return clazz; | ||
} | ||
|
||
public void setClazz(String clazz) { | ||
this.clazz = clazz; | ||
} | ||
|
||
public String getAction() { | ||
return action; | ||
} | ||
|
||
public void setAction(String action) { | ||
this.action = action; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "CommandSearchIndexerEntity{" + | ||
"id='" + id + '\'' + | ||
", clazz='" + clazz + '\'' + | ||
", action='" + action + '\'' + | ||
'}'; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...-management-api-model/src/main/java/io/gravitee/management/model/command/CommandTags.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.management.model.command; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
|
||
public enum CommandTags { | ||
DATA_TO_INDEX | ||
} |
62 changes: 62 additions & 0 deletions
62
...gement-api-model/src/main/java/io/gravitee/management/model/command/NewCommandEntity.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,62 @@ | ||
/** | ||
* 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.management.model.command; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public class NewCommandEntity { | ||
|
||
private String to; | ||
private List<CommandTags> tags; | ||
private String content; | ||
private long ttlInSeconds; | ||
|
||
public String getTo() { | ||
return to; | ||
} | ||
|
||
public void setTo(String to) { | ||
this.to = to; | ||
} | ||
|
||
public List<CommandTags> getTags() { | ||
return tags; | ||
} | ||
|
||
public void setTags(List<CommandTags> tags) { | ||
this.tags = tags; | ||
} | ||
|
||
public String getContent() { | ||
return content; | ||
} | ||
|
||
public void setContent(String content) { | ||
this.content = content; | ||
} | ||
|
||
public long getTtlInSeconds() { | ||
return ttlInSeconds; | ||
} | ||
|
||
public void setTtlInSeconds(long ttlInSeconds) { | ||
this.ttlInSeconds = ttlInSeconds; | ||
} | ||
} |
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
56 changes: 56 additions & 0 deletions
56
...ository/src/main/java/io/gravitee/management/repository/proxy/CommandRepositoryProxy.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,56 @@ | ||
/** | ||
* 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.management.repository.proxy; | ||
|
||
import io.gravitee.repository.exceptions.TechnicalException; | ||
import io.gravitee.repository.management.api.CommandRepository; | ||
import io.gravitee.repository.management.api.search.CommandCriteria; | ||
import io.gravitee.repository.management.model.Command; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
@Component | ||
public class CommandRepositoryProxy extends AbstractProxy<CommandRepository> implements CommandRepository { | ||
@Override | ||
public Optional<Command> findById(String id) throws TechnicalException { | ||
return target.findById(id); | ||
} | ||
|
||
@Override | ||
public Command create(Command command) throws TechnicalException { | ||
return target.create(command); | ||
} | ||
|
||
@Override | ||
public Command update(Command command) throws TechnicalException { | ||
return target.update(command); } | ||
|
||
@Override | ||
public void delete(String id) throws TechnicalException { | ||
target.delete(id); | ||
} | ||
|
||
@Override | ||
public List<Command> search(CommandCriteria criteria) { | ||
return target.search(criteria); | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
...e-management-api-service/src/main/java/io/gravitee/management/service/CommandService.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,33 @@ | ||
/** | ||
* 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.management.service; | ||
|
||
import io.gravitee.management.model.command.CommandEntity; | ||
import io.gravitee.management.model.command.CommandQuery; | ||
import io.gravitee.management.model.command.NewCommandEntity; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* @author Nicolas GERAUD (nicolas.geraud at graviteesource.com) | ||
* @author GraviteeSource Team | ||
*/ | ||
public interface CommandService { | ||
|
||
void send(NewCommandEntity message); | ||
List<CommandEntity> search(CommandQuery query); | ||
void ack(String messageId); | ||
} |
Oops, something went wrong.