Skip to content

Commit

Permalink
Merge pull request #17 from orkes-io/models_not_in_http
Browse files Browse the repository at this point in the history
refactor the model outside of http
  • Loading branch information
v1r3n authored Sep 13, 2022
2 parents 08d8b7c + f3a1db9 commit f9c8bf8
Show file tree
Hide file tree
Showing 61 changed files with 136 additions and 108 deletions.
2 changes: 1 addition & 1 deletion src/main/java/io/orkes/conductor/client/ApiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import io.orkes.conductor.client.http.auth.Authentication;
import io.orkes.conductor.client.http.auth.HttpBasicAuth;
import io.orkes.conductor.client.http.auth.OAuth;
import io.orkes.conductor.client.http.model.GenerateTokenRequest;
import io.orkes.conductor.client.model.GenerateTokenRequest;

import com.squareup.okhttp.*;
import com.squareup.okhttp.internal.http.HttpMethod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import java.util.List;
import java.util.Map;

import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.*;

public interface AuthorizationClient {

Expand Down
67 changes: 34 additions & 33 deletions src/main/java/io/orkes/conductor/client/OrkesClients.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@
package io.orkes.conductor.client;

import com.netflix.conductor.client.config.DefaultConductorClientConfiguration;
import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;

import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.auth.AuthorizationClientFilter;

import com.sun.jersey.api.client.config.ClientConfig;
import com.sun.jersey.api.client.config.DefaultClientConfig;

public class OrkesClients {

private final ApiClient apiClient;
Expand Down Expand Up @@ -57,17 +59,22 @@ public TaskClient getTaskClient() {
public com.netflix.conductor.client.http.WorkflowClient getWorkflowClientLegacy() {
return getWorkflowClientLegacy(10);
}
public com.netflix.conductor.client.http.WorkflowClient getWorkflowClientLegacy(int threadPoolSize) {
AuthorizationClientFilter authorizationClientFilter = new AuthorizationClientFilter(apiClient);
com.netflix.conductor.client.http.WorkflowClient workflowClient
= new com.netflix.conductor.client.http.WorkflowClient(
conductorClientConfig(apiClient.getReadTimeout(), apiClient.getConnectTimeout(), threadPoolSize),

public com.netflix.conductor.client.http.WorkflowClient getWorkflowClientLegacy(
int threadPoolSize) {
AuthorizationClientFilter authorizationClientFilter =
new AuthorizationClientFilter(apiClient);
com.netflix.conductor.client.http.WorkflowClient workflowClient =
new com.netflix.conductor.client.http.WorkflowClient(
conductorClientConfig(
apiClient.getReadTimeout(),
apiClient.getConnectTimeout(),
threadPoolSize),
new DefaultConductorClientConfiguration(),
null,
authorizationClientFilter
);
authorizationClientFilter);
String basePath = apiClient.getBasePath();
if(!basePath.endsWith("/")){
if (!basePath.endsWith("/")) {
basePath = basePath + "/";
}
workflowClient.setRootURI(basePath);
Expand All @@ -80,39 +87,33 @@ public com.netflix.conductor.client.http.TaskClient getTaskClientLegacy() {
}

public com.netflix.conductor.client.http.TaskClient getTaskClientLegacy(int threadPoolSize) {
AuthorizationClientFilter authorizationClientFilter = new AuthorizationClientFilter(apiClient);
com.netflix.conductor.client.http.TaskClient taskClient
= new com.netflix.conductor.client.http.TaskClient(
conductorClientConfig(apiClient.getReadTimeout(), apiClient.getConnectTimeout(), threadPoolSize),
new DefaultConductorClientConfiguration(),
null,
authorizationClientFilter
);
AuthorizationClientFilter authorizationClientFilter =
new AuthorizationClientFilter(apiClient);
com.netflix.conductor.client.http.TaskClient taskClient =
new com.netflix.conductor.client.http.TaskClient(
conductorClientConfig(
apiClient.getReadTimeout(),
apiClient.getConnectTimeout(),
threadPoolSize),
new DefaultConductorClientConfiguration(),
null,
authorizationClientFilter);
String basePath = apiClient.getBasePath();
if(!basePath.endsWith("/")){
if (!basePath.endsWith("/")) {
basePath = basePath + "/";
}
taskClient.setRootURI(basePath);

return taskClient;
}


private ClientConfig conductorClientConfig(int readTimeout, int connectionTimeout, int threadPoolSize) {
private ClientConfig conductorClientConfig(
int readTimeout, int connectionTimeout, int threadPoolSize) {
var clientConfig = new DefaultClientConfig();
var clientConfigProps = clientConfig.getProperties();
clientConfigProps.put(
ClientConfig.PROPERTY_CONNECT_TIMEOUT,
connectionTimeout
);
clientConfigProps.put(
ClientConfig.PROPERTY_READ_TIMEOUT,
readTimeout
);
clientConfigProps.put(
ClientConfig.PROPERTY_THREADPOOL_SIZE,
threadPoolSize
);
clientConfigProps.put(ClientConfig.PROPERTY_CONNECT_TIMEOUT, connectionTimeout);
clientConfigProps.put(ClientConfig.PROPERTY_READ_TIMEOUT, readTimeout);
clientConfigProps.put(ClientConfig.PROPERTY_THREADPOOL_SIZE, threadPoolSize);
return clientConfig;
}
}
6 changes: 3 additions & 3 deletions src/main/java/io/orkes/conductor/client/SchedulerClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import java.util.List;

import io.orkes.conductor.client.http.model.SaveScheduleRequest;
import io.orkes.conductor.client.http.model.SearchResultWorkflowScheduleExecutionModel;
import io.orkes.conductor.client.http.model.WorkflowSchedule;
import io.orkes.conductor.client.model.SaveScheduleRequest;
import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel;
import io.orkes.conductor.client.model.WorkflowSchedule;

public interface SchedulerClient {
void deleteSchedule(String name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import com.netflix.conductor.common.run.WorkflowSummary;

import io.orkes.conductor.client.http.ApiCallback;
import io.orkes.conductor.client.http.model.WorkflowStatus;
import io.orkes.conductor.client.model.WorkflowStatus;

import com.squareup.okhttp.Call;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import io.orkes.conductor.client.http.api.AuthorizationResourceApi;
import io.orkes.conductor.client.http.api.GroupResourceApi;
import io.orkes.conductor.client.http.api.UserResourceApi;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.*;

public class OrkesAuthorizationClient extends OrkesClient implements AuthorizationClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import io.orkes.conductor.client.MetadataClient;
import io.orkes.conductor.client.http.api.MetadataResourceApi;
import io.orkes.conductor.client.http.api.TagsApi;
import io.orkes.conductor.client.http.model.TagObject;
import io.orkes.conductor.client.http.model.TagString;
import io.orkes.conductor.client.model.TagObject;
import io.orkes.conductor.client.model.TagString;

public class OrkesMetadataClient extends OrkesClient implements MetadataClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.SchedulerClient;
import io.orkes.conductor.client.http.api.SchedulerResourceApi;
import io.orkes.conductor.client.http.model.SaveScheduleRequest;
import io.orkes.conductor.client.http.model.SearchResultWorkflowScheduleExecutionModel;
import io.orkes.conductor.client.http.model.WorkflowSchedule;
import io.orkes.conductor.client.model.SaveScheduleRequest;
import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel;
import io.orkes.conductor.client.model.WorkflowSchedule;

public class OrkesSchedulerClient extends OrkesClient implements SchedulerClient {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import io.orkes.conductor.client.WorkflowClient;
import io.orkes.conductor.client.http.api.WorkflowBulkResourceApi;
import io.orkes.conductor.client.http.api.WorkflowResourceApi;
import io.orkes.conductor.client.http.model.WorkflowStatus;
import io.orkes.conductor.client.model.WorkflowStatus;

import com.google.common.base.Preconditions;
import com.squareup.okhttp.Call;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.*;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.http.model.Subject;
import io.orkes.conductor.client.http.Configuration;
import io.orkes.conductor.client.model.AuthorizationRequest;
import io.orkes.conductor.client.model.Subject;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.ConductorUser;
import io.orkes.conductor.client.model.GrantedAccessResponse;
import io.orkes.conductor.client.model.Group;
import io.orkes.conductor.client.model.UpsertGroupRequest;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.SaveScheduleRequest;
import io.orkes.conductor.client.model.SearchResultWorkflowScheduleExecutionModel;
import io.orkes.conductor.client.model.WorkflowSchedule;

import com.google.gson.reflect.TypeToken;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/orkes/conductor/client/http/api/TagsApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.TagObject;
import io.orkes.conductor.client.http.model.TagString;
import io.orkes.conductor.client.model.TagObject;
import io.orkes.conductor.client.model.TagString;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.ExternalStorageLocation;
import io.orkes.conductor.client.http.model.SearchResultTask;
import io.orkes.conductor.client.http.model.SearchResultTaskSummary;
import io.orkes.conductor.client.model.ExternalStorageLocation;
import io.orkes.conductor.client.model.SearchResultTask;
import io.orkes.conductor.client.model.SearchResultTaskSummary;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.GenerateTokenRequest;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.ConductorUser;
import io.orkes.conductor.client.model.GrantedAccessResponse;
import io.orkes.conductor.client.model.Response;
import io.orkes.conductor.client.model.UpsertUserRequest;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

import io.orkes.conductor.client.ApiClient;
import io.orkes.conductor.client.http.*;
import io.orkes.conductor.client.http.model.*;
import io.orkes.conductor.client.model.*;

import com.google.gson.reflect.TypeToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

public class AccessKeyResponse {
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

public enum AccessKeyStatus {
ACTIVE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.io.IOException;
import java.util.Objects;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

public class CreateAccessKeyResponse {
private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.util.Objects;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* 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.orkes.conductor.client.http.model;
package io.orkes.conductor.client.model;

import java.util.ArrayList;
import java.util.List;
Expand Down
Loading

0 comments on commit f9c8bf8

Please sign in to comment.