-
Notifications
You must be signed in to change notification settings - Fork 242
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Added a remote query service to allow the webserver to call through to the query microservices * Added a remote query logic that can invoke a remote query service using an injected RemoteQueryService. * Added the ability to wrap a query logic with a filtered query logic that would only invoke the underlying logic if the filter passes. * Created separate predicates for auths and query parameters that can be reused elsewhere
- Loading branch information
Showing
29 changed files
with
2,129 additions
and
55 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
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
149 changes: 149 additions & 0 deletions
149
warehouse/query-core/src/main/java/datawave/query/config/RemoteQueryConfiguration.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,149 @@ | ||
package datawave.query.config; | ||
|
||
import datawave.query.tables.RemoteEventQueryLogic; | ||
import datawave.webservice.query.Query; | ||
import datawave.webservice.query.configuration.GenericQueryConfiguration; | ||
|
||
import java.io.ObjectStreamException; | ||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
/** | ||
* <p> | ||
* A GenericQueryConfiguration implementation that provides the additional logic on top of the traditional query that is needed to run a remote query logic | ||
* | ||
*/ | ||
public class RemoteQueryConfiguration extends GenericQueryConfiguration implements Serializable { | ||
|
||
private static final long serialVersionUID = -4354990715046146110L; | ||
|
||
// the id of the remote query | ||
private String remoteId; | ||
|
||
private String remoteQueryLogic; | ||
|
||
private Query query; | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
public RemoteQueryConfiguration() { | ||
super(); | ||
} | ||
|
||
/** | ||
* Performs a deep copy of the provided RemoteQueryConfiguration into a new instance | ||
* | ||
* @param other | ||
* - another RemoteQueryConfiguration instance | ||
*/ | ||
public RemoteQueryConfiguration(RemoteQueryConfiguration other) { | ||
|
||
// GenericQueryConfiguration copy first | ||
super(other); | ||
|
||
// RemoteQueryConfiguration copy | ||
this.remoteId = other.getRemoteId(); | ||
this.remoteQueryLogic = other.getRemoteQueryLogic(); | ||
this.query = other.getQuery(); | ||
} | ||
|
||
/** | ||
* Delegates deep copy work to appropriate constructor, sets additional values specific to the provided RemoteRemoteQueryLogic | ||
* | ||
* @param logic | ||
* - a RemoteQueryLogic instance or subclass | ||
*/ | ||
public RemoteQueryConfiguration(RemoteEventQueryLogic logic) { | ||
this(logic.getConfig()); | ||
} | ||
|
||
/** | ||
* Factory method that instantiates an fresh RemoteQueryConfiguration | ||
* | ||
* @return - a clean RemoteQueryConfiguration | ||
*/ | ||
public static RemoteQueryConfiguration create() { | ||
return new RemoteQueryConfiguration(); | ||
} | ||
|
||
/** | ||
* Factory method that returns a deep copy of the provided RemoteQueryConfiguration | ||
* | ||
* @param other | ||
* - another instance of a RemoteQueryConfiguration | ||
* @return - copy of provided RemoteQueryConfiguration | ||
*/ | ||
public static RemoteQueryConfiguration create(RemoteQueryConfiguration other) { | ||
return new RemoteQueryConfiguration(other); | ||
} | ||
|
||
/** | ||
* Factory method that creates a RemoteQueryConfiguration deep copy from a RemoteQueryLogic | ||
* | ||
* @param remoteQueryLogic | ||
* - a configured RemoteQueryLogic | ||
* @return - a RemoteQueryConfiguration | ||
*/ | ||
public static RemoteQueryConfiguration create(RemoteEventQueryLogic remoteQueryLogic) { | ||
return create(remoteQueryLogic.getConfig()); | ||
} | ||
|
||
/** | ||
* Factory method that creates a RemoteQueryConfiguration from a RemoteQueryLogic and a Query | ||
* | ||
* @param remoteQueryLogic | ||
* - a configured RemoteQueryLogic | ||
* @param query | ||
* - a configured Query object | ||
* @return - a RemoteQueryConfiguration | ||
*/ | ||
public static RemoteQueryConfiguration create(RemoteEventQueryLogic remoteQueryLogic, Query query) { | ||
RemoteQueryConfiguration config = create(remoteQueryLogic); | ||
config.setQuery(query); | ||
return config; | ||
} | ||
|
||
public String getRemoteId() { | ||
return remoteId; | ||
} | ||
|
||
public void setRemoteId(String remoteId) { | ||
this.remoteId = remoteId; | ||
} | ||
|
||
public String getRemoteQueryLogic() { | ||
return remoteQueryLogic; | ||
} | ||
|
||
public void setRemoteQueryLogic(String remoteQueryLogic) { | ||
this.remoteQueryLogic = remoteQueryLogic; | ||
} | ||
|
||
public Query getQuery() { | ||
return query; | ||
} | ||
|
||
public void setQuery(Query query) { | ||
this.query = query; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) | ||
return true; | ||
if (o == null || getClass() != o.getClass()) | ||
return false; | ||
if (!super.equals(o)) | ||
return false; | ||
RemoteQueryConfiguration that = (RemoteQueryConfiguration) o; | ||
return Objects.equals(getRemoteId(), that.getRemoteId()) && Objects.equals(getRemoteQueryLogic(), that.getRemoteQueryLogic()) | ||
&& Objects.equals(getQuery(), that.getQuery()); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(super.hashCode(), getRemoteId(), getRemoteQueryLogic(), getQuery()); | ||
} | ||
|
||
} |
Oops, something went wrong.