+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.onap.so</groupId>
- <artifactId>aria-client</artifactId>
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>aria</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <dependencies>
- <dependency>
- <groupId>org.glassfish.jersey.core</groupId>
- <artifactId>jersey-client</artifactId>
- <version>2.26-b03</version>
- </dependency>
- <dependency>
- <groupId>org.glassfish.jersey.media</groupId>
- <artifactId>jersey-media-json-jackson1</artifactId>
- <version>2.26-b03</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.8.7</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-base</artifactId>
- <version>2.9.2</version>
- </dependency>
-<dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-json-provider</artifactId>
- <version>2.9.2</version>
-</dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.jaxrs</groupId>
- <artifactId>jackson-jaxrs-providers</artifactId>
- <version>2.9.2</version>
- <type>pom</type>
- </dependency>
- <dependency>
- <groupId>org.apache.httpcomponents</groupId>
- <artifactId>httpclient</artifactId>
- </dependency>
- </dependencies>
-
-</project>
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-import com.gigaspaces.aria.rest.client.exceptions.StorageException;\r
-import com.gigaspaces.aria.rest.client.exceptions.ValidationException;\r
-\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface AriaClient {\r
-\r
- /**\r
- * Installs a service template\r
- *\r
- * @param template\r
- * @throws ValidationException\r
- * @throws StorageException\r
- */\r
- public void install_service_template(ServiceTemplate template)throws ValidationException, StorageException, Exception;\r
-\r
- /**\r
- * Validate a service template\r
- * @param template\r
- * @return\r
- */\r
- public ValidationResult validate_service_template(ServiceTemplate template)throws Exception;\r
-\r
- /**\r
- * Fetch a list of stored service templates\r
- *\r
- * @return\r
- */\r
- public List<? extends ServiceTemplate> list_service_templates();\r
-\r
- /**\r
- * Delete an existing template\r
- *\r
- * @param template_id\r
- * @throws IllegalArgumentException\r
- */\r
- public void delete_service_template(int template_id) throws IllegalArgumentException, Exception;\r
-\r
- /**\r
- * Returns a list of node templates for a given service template\r
- * @param template_id\r
- * @return\r
- */\r
- List<? extends NodeTemplate> list_nodes(int template_id);\r
-\r
- /**\r
- * Fetch a given node template\r
- *\r
- * @param node_id\r
- * @return\r
- * @throws IllegalArgumentException\r
- */\r
- public NodeTemplate get_node( int node_id) throws IllegalArgumentException;\r
-\r
- /**\r
- * List all services\r
- *\r
- * @return\r
- */\r
- public List<? extends Service> list_services();\r
-\r
- /**\r
- * Fetch the specified service\r
- *\r
- * @param service_id\r
- * @return\r
- * @throws IllegalArgumentException\r
- */\r
- public Service get_service(int service_id) throws IllegalArgumentException;\r
-\r
- /**\r
- * Fetch the outputs of the specified service\r
- *\r
- * @param service_id\r
- * @return\r
- * @throws IllegalArgumentException\r
- */\r
- public List<? extends Output> list_service_outputs(int service_id) throws IllegalArgumentException;\r
-\r
- /**\r
- * Fetch the inputs of the specified service\r
- *\r
- * @param service_id\r
- * @return\r
- * @throws IllegalArgumentException\r
- */\r
- public List<? extends Input> list_service_inputs(int service_id) throws IllegalArgumentException;\r
-\r
- /**\r
- * Create a service\r
- *\r
- * @param template_id\r
- * @param service_name\r
- * @param inputs\r
- * @throws Exception\r
- */\r
- public void create_service(int template_id, String service_name, List<Input> inputs)throws Exception;\r
-\r
- /**\r
- * Delete the specified service\r
- *\r
- * @param service_id\r
- * @throws IllegalArgumentException\r
- */\r
- public void delete_service(int service_id)throws Exception;\r
-\r
- /**\r
- * List workflows for the provided service\r
- *\r
- * @param service_id\r
- * @return\r
- * @throws IllegalArgumentException\r
- */\r
- public List<? extends Workflow> list_workflows(int service_id)throws IllegalArgumentException;\r
-\r
- /**\r
- * Fetch the specified workflow\r
- *\r
- * @param workflow_id\r
- * @return the requested Workflow\r
- * @throws IllegalArgumentException when the workflow_id doesn't exist\r
- */\r
- public Workflow get_workflow(int workflow_id)throws IllegalArgumentException;\r
-\r
- /**\r
- * List all executions\r
- *\r
- * @return\r
- * @throws Exception\r
- */\r
- public List<? extends Execution> list_executions()throws Exception;\r
-\r
- /**\r
- * List executions for provided service\r
- *\r
- * @param service_id\r
- * @return\r
- * @throws Exception\r
- */\r
- public List<? extends Execution> list_executions(int service_id)throws Exception;\r
-\r
- /**\r
- * Fetch the specified execution\r
- *\r
- * @param execution_id\r
- * @return\r
- * @throws IllegalArgumentException\r
- */\r
- public Execution get_execution(int execution_id)throws IllegalArgumentException;\r
-\r
- /**\r
- * Starts an execution\r
- *\r
- * @param service_id\r
- * @param workflow_name\r
- * @param details\r
- * @return the execution id\r
- * @throws Exception\r
- */\r
- public int start_execution(int service_id, String workflow_name, ExecutionDetails details)throws Exception;\r
-\r
- /**\r
- * Resumes an interrupted execution\r
- *\r
- * @param execution_id\r
- * @param details\r
- * @throws IllegalArgumentException\r
- */\r
- public void resume_execution(int execution_id, ExecutionDetails details)throws IllegalArgumentException;\r
-\r
- /**\r
- * Cancels the specified execution\r
- *\r
- * @param execution_id\r
- * @throws IllegalArgumentException\r
- */\r
- public void cancel_execution(int execution_id)throws Exception;\r
-}\r
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-import java.net.URL;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public class AriaClientFactory {\r
-\r
- public AriaClient createRestClient(String protocol, String address, int port, String version){\r
- return new AriaRestClient(protocol, address, port, version);\r
- }\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-import java.util.List;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.codehaus.jackson.JsonFactory;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.jaxrs.JacksonJsonProvider;
-import org.codehaus.jackson.map.ObjectMapper;
-import com.gigaspaces.aria.rest.client.exceptions.StorageException;
-import com.gigaspaces.aria.rest.client.exceptions.ValidationException;
-
-import sun.reflect.generics.reflectiveObjects.NotImplementedException;
-
-/**
- * Created by DeWayne on 7/12/2017.
- */
-public class AriaRestClient implements AriaClient {
- private Client client = null;
- private WebTarget base_target = null;
-
- /**
- * Construct an Aria REST client
- *
- * @param protocol
- * either http or https
- * @param address
- * the IP address or host name
- * @param port
- * the port of the service
- * @param version
- * the api version
- */
- public AriaRestClient(String protocol, String address, int port, String version) {
- this.client = ClientBuilder.newBuilder().register(JacksonJsonProvider.class).build();
- base_target = client.target(protocol + "://" + address + ":" + port + "/api/" + version);
- }
-
- /**
- * Installs a service template
- *
- * @param template
- * the template object
- * @throws ValidationException
- * @throws StorageException
- */
- public void install_service_template(ServiceTemplate template)
- throws ValidationException, StorageException, Exception {
-
- byte[] csarBytes = template.getCSARBytes();
- Response response = null;
- if (csarBytes == null) {
- response = base_target.path("templates/" + template.getName()).request(MediaType.APPLICATION_JSON)
- .put(Entity.entity(
- "{\"service-template-path\":\"" + template.getURI().toString() + "\""
- + ",\"service-template-filename\":\"" + template.getFilename() + "\"",
- MediaType.APPLICATION_JSON));
- }
- else {
-
- response = base_target.path("templates/" + template.getName()).request("application/zip")
- .put(Entity.entity(csarBytes, "application/zip"));
- }
-
- if (response.getStatus() == 500) {
- throw new StorageException(response.readEntity(String.class));
- } else if (response.getStatus() == 400) {
- throw new ValidationException(response.readEntity(String.class));
- } else if (response.getStatus() > 199 && response.getStatus() < 300) {
- return;
- } else {
- throw new Exception(
- "Error installing template: " + response.getStatus() + " " + response.readEntity(String.class));
- }
- }
-
- public ValidationResult validate_service_template(ServiceTemplate template) throws Exception {
- Response response = base_target.path("templates").request(MediaType.APPLICATION_JSON)
- .post(Entity.entity(
- "{\"service-template-path\":\"" + template.getURI().toString() + "\""
- + ",\"service-template-filename\":\"" + template.getFilename() + "\"}",
- MediaType.APPLICATION_JSON));
-
- ValidationResultImpl result = new ValidationResultImpl();
- if (response.getStatus() >= 200 && response.getStatus() < 300) {
- result.setFailed(false);
- } else if (response.getStatus() == 400) {
- result.setFailed(true);
- } else {
- throw new Exception(
- "received error response '" + response.getStatus() + "':" + response.readEntity(String.class));
- }
- return result;
-
- }
-
- /**
- *
- * @return a list of service templates
- */
- public List<? extends ServiceTemplate> list_service_templates() {
- List<? extends ServiceTemplate> templates = base_target.path("templates").request(MediaType.APPLICATION_JSON)
- .get(new GenericType<List<ServiceTemplateImpl>>() {
- });
-
- return templates;
- }
-
- /**
- * Deletes the specified template.
- *
- * TODO: Error handling is a little blunt. Need to describe failures better
- *
- * @param template_id
- * the template id to delete
- * @throws IllegalArgumentException
- * thrown when the template can't be deleted
- * @throws Exception
- * other server side errors
- */
- public void delete_service_template(int template_id) throws IllegalArgumentException, Exception {
- Response response = base_target.path("templates/" + template_id).request(MediaType.APPLICATION_JSON).delete();
-
- if (response.getStatus() >= 200 && response.getStatus() < 300) {
- return;
- } else if (response.getStatus() == 400) {
- throw new IllegalArgumentException("Error deleting template '" + template_id + "'");
- } else {
- throw new Exception("Error processing request. Return code = " + response.getStatus());
- }
- }
-
- /**
- * List the node templates for a given template id
- *
- * @param template_id
- * @return
- */
- public List<? extends NodeTemplate> list_nodes(int template_id) {
- List<? extends NodeTemplate> nodes = base_target.path("templates/" + template_id + "/nodes")
- .request(MediaType.APPLICATION_JSON).get(new GenericType<List<NodeTemplateImpl>>() {
- });
- return nodes;
- }
-
- /**
- * Get a specific node by id
- *
- * @param node_id
- * the node id
- * @return
- * @throws IllegalArgumentException
- */
- public NodeTemplate get_node(int node_id) throws IllegalArgumentException {
- NodeTemplate node = base_target.path("nodes/" + node_id).request(MediaType.APPLICATION_JSON)
- .get(NodeTemplateImpl.class);
- return node;
- }
-
- public List<? extends Service> list_services() {
- List<? extends Service> services = base_target.path("services").request(MediaType.APPLICATION_JSON)
- .get(new GenericType<List<ServiceImpl>>() {
- });
- return services;
- }
-
- public Service get_service(int service_id) throws IllegalArgumentException {
- throw new NotImplementedException();
- }
-
- public List<? extends Output> list_service_outputs(int service_id) throws IllegalArgumentException {
- List<? extends Output> outputs = base_target.path("services").request(MediaType.APPLICATION_JSON)
- .get(new GenericType<List<OutputImpl>>() {
- });
- return outputs;
- }
-
- public List<? extends Input> list_service_inputs(int service_id) throws IllegalArgumentException {
- List<? extends Input> inputs = base_target.path("services").request(MediaType.APPLICATION_JSON)
- .get(new GenericType<List<InputImpl>>() {
- });
- return inputs;
- }
-
- /**
- * Create a service based on the supplied template
- *
- * @param template_id
- * the template to create the service for
- * @param service_name
- * a name for the service
- * @param inputs
- * an optional list of inputs for the service (can be null)
- * @throws Exception
- */
- public void create_service(int template_id, String service_name, List<Input> inputs) throws Exception {
-
- String json = "{" + inputsToJson(inputs) + "}";
-
- Response response = base_target.path("templates/" + template_id + "/services/" + service_name)
- .request(MediaType.APPLICATION_JSON).post(Entity.entity(json, MediaType.APPLICATION_JSON));
-
- if (response.getStatus() < 200 || response.getStatus() > 299) {
- throw new Exception(
- "create service failed:" + response.getStatus() + " " + response.readEntity(String.class));
- }
- }
-
- public void delete_service(int service_id) throws Exception {
- Response response = base_target.path("services/" + service_id).request(MediaType.APPLICATION_JSON).delete();
- if (!responseOK(response)) {
- throw new Exception(
- "delete service failed: " + response.getStatus() + " " + response.readEntity(String.class));
- }
- }
-
- /**
- * List user workflows for supplied service
- *
- * @param service_id
- * @return
- * @throws IllegalArgumentException
- */
- public List<? extends Workflow> list_workflows(int service_id) throws IllegalArgumentException {
- List<? extends Workflow> workflows = base_target.path("services/" + service_id + "/workflows")
- .request(MediaType.APPLICATION_JSON).get(new GenericType<List<WorkflowImpl>>() {
- });
- return workflows;
- }
-
- public Workflow get_workflow(int workflow_id) throws IllegalArgumentException {
- throw new NotImplementedException();
- }
-
- /**
- * List all executions
- *
- * @return
- * @throws Exception
- */
- public List<? extends Execution> list_executions() throws Exception {
- List<? extends Execution> executions = base_target.path("executions").request(MediaType.APPLICATION_JSON)
- .get(new GenericType<List<ExecutionImpl>>() {
- });
- return executions;
- }
-
- /**
- * List executions for specified service
- *
- * @param service_id
- * @return
- * @throws Exception
- */
- public List<? extends Execution> list_executions(int service_id) throws Exception {
- List<? extends Execution> executions = base_target.path("services/" + service_id + "/executions")
- .request(MediaType.APPLICATION_JSON).get(new GenericType<List<ExecutionImpl>>() {
- });
- return executions;
- }
-
- /**
- * Get details about a specified execution
- *
- * @param execution_id
- * @return
- * @throws IllegalArgumentException
- */
- public Execution get_execution(int execution_id) throws IllegalArgumentException {
- Execution execution = base_target.path("executions/" + execution_id).request(MediaType.APPLICATION_JSON)
- .get(ExecutionImpl.class);
- return execution;
- }
-
- /**
- * Start an execution for the specified service
- *
- * @param service_id
- * the service to run the execution for
- * @param workflow_name
- * the name of the workflow to execute
- * @param details
- * details controlling execution operation
- * @return the execution id
- * @throws Exception
- */
- public int start_execution(int service_id, String workflow_name, ExecutionDetails details) throws Exception {
- StringBuilder json = new StringBuilder("{");
- if (details.getExecutor().length() > 0) {
- json.append("\"executor\":\"").append(details.getExecutor()).append("\",");
- }
- if (details.getInputs() != null) {
- json.append(inputsToJson(details.getInputs()));
- }
- json.append("\"task_max_attempts\":").append(details.getTaskMaxAttempts()).append(",");
- json.append("\"task_retry_interval\":").append(details.getTaskRetryInterval()).append("}");
-
- System.out.println("JSON=" + json.toString());
-
- Response response = base_target.path("services/" + service_id + "/executions/" + workflow_name)
- .request(MediaType.APPLICATION_JSON).post(Entity.entity(json.toString(), MediaType.APPLICATION_JSON));
-
- if (!responseOK(response)) {
- throw new Exception(
- "start execution failed: " + response.getStatus() + " " + response.readEntity(String.class));
- }
-
- ObjectMapper mapper = new ObjectMapper(new JsonFactory());
- JsonNode rootNode = mapper.readTree(response.readEntity(String.class));
- int id = rootNode.get("id").asInt(-1);
- return id;
- }
-
- public void resume_execution(int execution_id, ExecutionDetails details) throws IllegalArgumentException {
- StringBuilder json = new StringBuilder("{");
- if (details.getExecutor().length() > 0) {
- json.append("\"executor\":\"").append(details.getExecutor()).append("\",");
- }
- json.append("\"retry_failed_tasks\":").append(details.isRetry_failed_tasks()).append("}");
- Response response = base_target.path("executions/" + execution_id).request(MediaType.APPLICATION_JSON)
- .post(Entity.entity(json.toString(), MediaType.APPLICATION_JSON));
- }
-
- public void cancel_execution(int execution_id) throws Exception {
- Response response = base_target.path("executions/" + execution_id).request(MediaType.APPLICATION_JSON).delete();
- if (!responseOK(response)) {
- throw new Exception(
- "delete service failed: " + response.getStatus() + " " + response.readEntity(String.class));
- }
- }
-
- /**
- * ----- ----- PRIVATE METHODS -----
- */
-
- private boolean responseOK(Response response) {
- return response.getStatus() > 199 && response.getStatus() < 300;
- }
-
- private String inputsToJson(List<Input> inputs) {
- if (inputs == null)
- return null;
-
- StringBuilder sb = new StringBuilder("\"inputs\":{");
- for (Input input : inputs) {
- sb.append("\"").append(input.getName()).append("\":\"").append(input.getValue()).append("\",");
- }
- if (inputs.size() > 0)
- sb.deleteCharAt(sb.length() - 1); // trim comma
-
- return sb.toString();
- }
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface Execution {\r
- int getExecutionId();\r
- String getWorkflowName();\r
- String getServiceTemplateName();\r
- String getServiceName();\r
- String getStatus();\r
-}\r
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-import java.util.List;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public class ExecutionDetails {\r
- private String executor=""; //default\r
- private int task_max_attempts=30;\r
- private int task_retry_interval=30;\r
- private List<Input> inputs=null;\r
- private boolean retry_failed_tasks=false;\r
-\r
- public ExecutionDetails(){}\r
-\r
- public ExecutionDetails(String executor){\r
- this.executor=executor;\r
- }\r
-\r
- public ExecutionDetails(String executor, int task_max_attempts, int task_retry_interval, boolean retry_failed_tasks,\r
- List<Input> inputs){\r
- this.executor=executor;\r
- this.task_max_attempts=task_max_attempts;\r
- this.task_retry_interval=task_retry_interval;\r
- this.retry_failed_tasks = retry_failed_tasks;\r
- this.inputs=inputs;\r
- }\r
- public String getExecutor(){\r
- return executor;\r
- }\r
- public void setExecutor(String executor){\r
- this.executor=executor;\r
- }\r
- public int getTaskMaxAttempts(){\r
- return task_max_attempts;\r
- }\r
- public void setTaskMaxAttempts(int max){\r
- this.task_max_attempts=max;\r
- }\r
- public int getTaskRetryInterval(){\r
- return task_retry_interval;\r
- }\r
- public void setTaskRetryInterval(int interval){\r
- this.task_retry_interval=interval;\r
- }\r
- public List<Input> getInputs(){\r
- return inputs;\r
- }\r
- public void setInputs(List<Input> inputs){\r
- this.inputs=inputs;\r
- }\r
- public boolean isRetry_failed_tasks() {return retry_failed_tasks;}\r
- public void setRetry_failed_tasks(boolean retry_failed_tasks) {this.retry_failed_tasks = retry_failed_tasks;}\r
-\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by DeWayne on 7/17/2017.
- */
-public class ExecutionImpl implements Execution {
- @JsonProperty("execution_id")
- int execution_id;
- @JsonProperty("workflow_name")
- String workflow_name;
- @JsonProperty("service_template_name")
- String service_template_name;
- @JsonProperty("service_name")
- String service_name;
- String status;
-
- public int getExecutionId() {
- return execution_id;
- }
- public String getWorkflowName() {
- return workflow_name;
- }
-
- public String getServiceTemplateName() {
- return service_template_name;
- }
-
- public String getServiceName() {
- return service_name;
- }
-
- public String getStatus() {
- return status;
- }
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface Input {\r
- String getName();\r
- String getDescription();\r
- String getValue();\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-/**
- * Created by DeWayne on 7/17/2017.
- */
-public class InputImpl implements Input {
- private String name, description, value;
-
- public InputImpl(){}
-
- public InputImpl(String name,String value,String description){
- if(name==null || value==null){
- throw new IllegalArgumentException("null argument supplied");
- }
- this.name=name;
- this.value=value;
- if(description!=null)this.description=description;
- }
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getValue() {
- return value;
- }
-
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface NodeTemplate {\r
- int getId();\r
- String getName();\r
- String getDescription();\r
- int getServiceTemplateId();\r
- String getTypeName();\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-/**
- * Created by DeWayne on 7/18/2017.
- */
-public class NodeTemplateImpl implements NodeTemplate {
- private int id;
- private String name;
- private String description="";
- @JsonProperty("service_template_id")
- private int service_template_id;
- @JsonProperty("type_name")
- private String type_name="";
-
- public NodeTemplateImpl(){}
-
- public NodeTemplateImpl(int id, String name, String description, int service_template_id, String type_name){
- this.id=id;
- this.description=description;
- this.service_template_id=service_template_id;
- this.type_name=type_name;
- }
-
- public int getId() {
- return id;
- }
-
- public String getDescription() {
- return description;
- }
-
- public int getServiceTemplateId() {
- return service_template_id;
- }
-
- public String getTypeName() {
- return type_name;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
-
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface Output {\r
- String getName();\r
- String getDescription();\r
- String getValue();\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-/**
- * Created by DeWayne on 7/17/2017.
- */
-public class OutputImpl implements Output {
- private String name, description, value;
-
- public String getName() {
- return name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public String getValue() {
- return value;
- }
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-import java.util.Date;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface Service {\r
- int getId();\r
- String getDescription();\r
- String getName();\r
- String getServiceTemplate();\r
- Date getCreated();\r
- Date getUpdated();\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-import java.net.URI;
-import java.util.Date;
-
-/**
- *
- *
- * Created by DeWayne on 7/17/2017.
- */
-public class ServiceImpl implements Service {
- private int id;
- private String description, name, template;
- private Date created, updated;
-
- public int getId(){
- return id;
- }
-
- public String getDescription(){
- return description;
- }
-
- public String getName(){
- return name;
- }
-
- public String getServiceTemplate(){
- return template;
- }
-
- public Date getCreated(){
- return created;
- }
-
- public Date getUpdated(){
- return updated;
- }
-
-
-}
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-import java.net.URI;
-
-/**
- * Created by DeWayne on 7/12/2017.
- */
-public interface ServiceTemplate {
- String getName();
- URI getURI();
- int getId();
- String getFilename();
- String getDescription();
- byte[] getCSARBytes();
-}
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-import java.net.URI;
-
-/**
- * CSAR based implementation
- *
- * Created by DeWayne on 7/17/2017.
- */
-public class ServiceTemplateImpl implements ServiceTemplate {
- public static final String DEFAULT_TEMPLATE_NAME = "service-template.yaml";
- private String name;
- private int id;
- private URI uri;
- private String filename = DEFAULT_TEMPLATE_NAME;
- private String description;
- private byte[] csar_blob; // for opaque binary
-
- public ServiceTemplateImpl(){}
-
- public ServiceTemplateImpl(String name, URI uri){
- this.name=name;
- this.uri=uri;
- }
-
- /**
- * Construct service template from CSAR byte array
- */
- public ServiceTemplateImpl(String name, byte[] csar){
- this.csar_blob = csar;
- this.name = name;
- }
-
- /**
- * Construct an instance based on CSAR
- * @param name a textual name for the template
- * @param uri a URI to a CSAR
- * @param filename the filename in the CSAR representing main yaml template
- */
- public ServiceTemplateImpl(String name, URI uri, String filename, String description){
- this.name=name;
- this.uri=uri;
- this.filename=filename;
- this.description=description;
- }
-
- public int getId(){
- return id;
- }
- public void setId(int id){
- this.id=id;
- }
- public String getName() {
- return name;
- }
- public void setName(String name){
- this.name=name;
- }
- public URI getURI() {
- return uri;
- }
- public void setPath(String path){
- this.uri=uri;
- }
- public String getFilename() {
- return filename;
- }
- public void setFilename(String filename){
- this.filename=filename;
- }
- public byte[] getCSARBytes() {
- return csar_blob;
- }
-
- public String getDescription(){ return description;}
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface ValidationResult {\r
-\r
- boolean getFailed();\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-/**
- * Created by DeWayne on 7/17/2017.
- */
-public class ValidationResultImpl implements ValidationResult {
- private boolean failed=false;
-
- public void setFailed(boolean failed){
- this.failed=failed;
- }
- public boolean getFailed() {
- return failed;
- }
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public interface Workflow {\r
- String getName();\r
-}\r
+++ /dev/null
-/*
- * ============LICENSE_START===================================================
- * Copyright (c) 2017 Cloudify.co. All rights reserved.
- * ===================================================================
- * 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.
- * ============LICENSE_END====================================================
-*/
-package com.gigaspaces.aria.rest.client;
-
-/**
- * Created by DeWayne on 7/17/2017.
- */
-public class WorkflowImpl implements Workflow{
- String name;
-
- public String getName() {
- return name;
- }
-}
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client.exceptions;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public class StorageException extends Exception {\r
- public StorageException(String message){\r
- super(message);\r
- }\r
-}\r
+++ /dev/null
-/*\r
- * ============LICENSE_START===================================================\r
- * Copyright (c) 2017 Cloudify.co. All rights reserved.\r
- * ===================================================================\r
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not\r
- * use this file except in compliance with the License. You may obtain a copy\r
- * of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT\r
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r
- * License for the specific language governing permissions and limitations under\r
- * the License.\r
- * ============LICENSE_END====================================================\r
-*/\r
-package com.gigaspaces.aria.rest.client.exceptions;\r
-\r
-/**\r
- * Created by DeWayne on 7/12/2017.\r
- */\r
-public class ValidationException extends Exception {\r
- public ValidationException(String message){\r
- super(message);\r
- }\r
-}\r
+++ /dev/null
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.onap.so</groupId>
- <artifactId>so</artifactId>
- <version>1.2.0-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>aria</artifactId>
-
- <name>ARIA related artifacts</name>
- <description>ARIA related artifacts</description>
- <packaging>pom</packaging>
-
- <modules>
- <module>aria-rest-java-client</module>
- <!-- <module>aria-rest-server</module> -->
- <module>multivim-plugin</module>
- </modules>
-</project>