dependencyKeys() {
- return this.children();
- }
-
- /**
- * Mark the node identified by the given key as this node's dependency.
- *
- * @param dependencyKey the id of the dependency node
- */
- public void addDependency(String dependencyKey) {
- super.addChild(dependencyKey);
- }
-
- /**
- * @return true if this node has any dependency
- */
- public boolean hasDependencies() {
- return this.hasChildren();
- }
-
- /**
- * Mark or un-mark this node as preparer.
- *
- * @param isPreparer true if this node needs to be marked as preparer, false otherwise.
- */
- public void setPreparer(boolean isPreparer) {
- this.isPreparer = isPreparer;
- }
-
- /**
- * @return true if this node is marked as preparer
- */
- public boolean isPreparer() {
- return isPreparer;
- }
-
- /**
- * Initialize the node so that traversal can be performed on the parent DAG.
- */
- public void initialize() {
- this.toBeResolved = this.dependencyKeys().size();
- this.dependentKeys.clear();
- }
-
- /**
- * @return true if all dependencies of this node are ready to be consumed
- */
- boolean hasAllResolved() {
- return toBeResolved == 0;
- }
-
- /**
- * Reports that one of this node's dependency has been resolved and ready to be consumed.
- *
- * @param dependencyKey the id of the dependency node
- */
- void reportResolved(String dependencyKey) {
- if (toBeResolved == 0) {
- throw new RuntimeException("invalid state - " + this.key() + ": The dependency '" + dependencyKey + "' is already reported or there is no such dependencyKey");
- }
- toBeResolved--;
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGraph.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGraph.java
deleted file mode 100644
index 58179e0152ed4..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/DAGraph.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import java.util.ArrayDeque;
-import java.util.Map;
-import java.util.Queue;
-
-/**
- * Type representing a DAG (directed acyclic graph).
- *
- * each node in a DAG is represented by {@link DAGNode}
- *
- * @param the type of the data stored in the graph nodes
- * @param the type of the nodes in the graph
- */
-public class DAGraph> extends Graph {
- private Queue queue;
- private boolean hasParent;
- private U rootNode;
-
- /**
- * Creates a new DAG.
- *
- * @param rootNode the root node of this DAG
- */
- public DAGraph(U rootNode) {
- this.rootNode = rootNode;
- this.queue = new ArrayDeque<>();
- this.rootNode.setPreparer(true);
- this.addNode(rootNode);
- }
-
- /**
- * @return true if this DAG is merged with another DAG and hence has a parent
- */
- public boolean hasParent() {
- return hasParent;
- }
-
- /**
- * Checks whether the given node is root node of this DAG.
- *
- * @param node the node {@link DAGNode} to be checked
- * @return true if the given node is root node
- */
- public boolean isRootNode(U node) {
- return this.rootNode == node;
- }
-
- /**
- * @return true if this dag is the preparer responsible for
- * preparing the DAG for traversal.
- */
- public boolean isPreparer() {
- return this.rootNode.isPreparer();
- }
-
- /**
- * Merge this DAG with another DAG.
- *
- * This will mark this DAG as a child DAG, the dependencies of nodes in this DAG will be merged
- * with (copied to) the parent DAG
- *
- * @param parent the parent DAG
- */
- public void merge(DAGraph parent) {
- this.hasParent = true;
- parent.rootNode.addDependency(this.rootNode.key());
- for (Map.Entry entry: graph.entrySet()) {
- String key = entry.getKey();
- if (!parent.graph.containsKey(key)) {
- parent.graph.put(key, entry.getValue());
- }
- }
- }
-
- /**
- * Prepares this DAG for traversal using getNext method, each call to getNext returns next node
- * in the DAG with no dependencies.
- */
- public void prepare() {
- if (isPreparer()) {
- for (U node : graph.values()) {
- // Prepare each node for traversal
- node.initialize();
- if (!this.isRootNode(node)) {
- // Mark other sub-DAGs as non-preparer
- node.setPreparer(false);
- }
- }
- initializeDependentKeys();
- initializeQueue();
- }
- }
-
- /**
- * Gets next node in the DAG which has no dependency or all of it's dependencies are resolved and
- * ready to be consumed.
- *
- * @return next node or null if all the nodes have been explored
- */
- public U getNext() {
- return graph.get(queue.poll());
- }
-
- /**
- * Gets the data stored in a graph node with a given key.
- *
- * @param key the key of the node
- * @return the value stored in the node
- */
- public T getNodeData(String key) {
- return graph.get(key).data();
- }
-
- /**
- * Reports that a node is resolved hence other nodes depends on it can consume it.
- *
- * @param completed the node ready to be consumed
- */
- public void reportedCompleted(U completed) {
- completed.setPreparer(true);
- String dependency = completed.key();
- for (String dependentKey : graph.get(dependency).dependentKeys()) {
- DAGNode dependent = graph.get(dependentKey);
- dependent.reportResolved(dependency);
- if (dependent.hasAllResolved()) {
- queue.add(dependent.key());
- }
- }
- }
-
- /**
- * Initializes dependents of all nodes.
- *
- * The DAG will be explored in DFS order and all node's dependents will be identified,
- * this prepares the DAG for traversal using getNext method, each call to getNext returns next node
- * in the DAG with no dependencies.
- */
- private void initializeDependentKeys() {
- visit(new Visitor() {
- // This 'visit' will be called only once per each node.
- @Override
- public void visit(U node) {
- if (node.dependencyKeys().isEmpty()) {
- return;
- }
-
- String dependentKey = node.key();
- for (String dependencyKey : node.dependencyKeys()) {
- graph.get(dependencyKey)
- .addDependent(dependentKey);
- }
- }
- });
- }
-
- /**
- * Initializes the queue that tracks the next set of nodes with no dependencies or
- * whose dependencies are resolved.
- */
- private void initializeQueue() {
- this.queue.clear();
- for (Map.Entry entry: graph.entrySet()) {
- if (!entry.getValue().hasDependencies()) {
- this.queue.add(entry.getKey());
- }
- }
- if (queue.isEmpty()) {
- throw new RuntimeException("Found circular dependency");
- }
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Graph.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Graph.java
deleted file mode 100644
index 40ceebaa50b2b..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Graph.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Type representing a directed graph data structure.
- *
- * Each node in a graph is represented by {@link Node}
- *
- * @param the type of the data stored in the graph's nodes
- * @param the type of the nodes in the graph
- */
-public class Graph> {
- protected Map graph;
- private Set visited;
-
- /**
- * Creates a directed graph.
- */
- public Graph() {
- this.graph = new HashMap<>();
- this.visited = new HashSet<>();
- }
-
- /**
- * Adds a node to this graph.
- *
- * @param node the node
- */
- public void addNode(U node) {
- graph.put(node.key(), node);
- }
-
- /**
- * Represents a visitor to be implemented by the consumer who want to visit the
- * graph's nodes in DFS order.
- *
- * @param the type of the node
- */
- interface Visitor {
- /**
- * visit a node.
- *
- * @param node the node to visited
- */
- void visit(U node);
- }
-
- /**
- * Perform DFS visit in this graph.
- *
- * The directed graph will be traversed in DFS order and the visitor will be notified as
- * search explores each node
- *
- * @param visitor the graph visitor
- */
- public void visit(Visitor visitor) {
- for (Map.Entry> item : graph.entrySet()) {
- if (!visited.contains(item.getKey())) {
- this.dfs(visitor, item.getValue());
- }
- }
- visited.clear();
- }
-
- private void dfs(Visitor visitor, Node node) {
- visitor.visit(node);
- visited.add(node.key());
- for (String childKey : node.children()) {
- if (!visited.contains(childKey)) {
- this.dfs(visitor, this.graph.get(childKey));
- }
- }
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java
deleted file mode 100644
index 6e0b2ea92a96b..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ListOperationCallback.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.microsoft.rest.ServiceCallback;
-
-import java.util.List;
-
-/**
- * The callback used for client side asynchronous list operations.
- *
- * @param the item type
- */
-public abstract class ListOperationCallback extends ServiceCallback> {
- /**
- * A list result that stores the accumulated resources loaded from server.
- */
- private List result;
-
- /**
- * Number of loaded pages.
- */
- private int pageCount;
-
- /**
- * Creates an instance of ListOperationCallback.
- */
- public ListOperationCallback() {
- this.pageCount = 0;
- }
-
- /**
- * Override this method to handle progressive results.
- * The user is responsible for returning a {@link PagingBahavior} Enum to indicate
- * whether the client should continue loading or stop.
- *
- * @param partial the list of resources from the current request.
- * @return CONTINUE if you want to go on loading, STOP otherwise.
- *
- */
- public PagingBahavior progress(List partial) {
- return PagingBahavior.CONTINUE;
- }
-
- /**
- * Get the list result that stores the accumulated resources loaded from server.
- *
- * @return the list of resources.
- */
- public List get() {
- return result;
- }
-
- /**
- * This method is called by the client to load the most recent list of resources.
- * This method should only be called by the service client.
- *
- * @param result the most recent list of resources.
- */
- public void load(List result) {
- ++pageCount;
- if (this.result == null || this.result.isEmpty()) {
- this.result = result;
- } else {
- this.result.addAll(result);
- }
- }
-
- /**
- * Get the number of loaded pages.
- *
- * @return the number of pages.
- */
- public int pageCount() {
- return pageCount;
- }
-
- /**
- * An enum to indicate whether the client should continue loading or stop.
- */
- public enum PagingBahavior {
- /**
- * Indicates that the client should continue loading.
- */
- CONTINUE,
- /**
- * Indicates that the client should stop loading.
- */
- STOP
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Node.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Node.java
deleted file mode 100644
index cbb83f1d2a58f..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Node.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Type represents a node in a {@link Graph}.
- *
- * @param the type of the data stored in the node
- */
-public class Node {
- private String key;
- private T data;
- private List children;
-
- /**
- * Creates a graph node.
- *
- * @param key unique id of the node
- * @param data data to be stored in the node
- */
- public Node(String key, T data) {
- this.key = key;
- this.data = data;
- this.children = new ArrayList<>();
- }
-
- /**
- * @return this node's unique id
- */
- public String key() {
- return this.key;
- }
-
- /**
- * @return data stored in this node
- */
- public T data() {
- return data;
- }
-
- /**
- * @return true if this node has any children
- */
- public boolean hasChildren() {
- return !this.children.isEmpty();
- }
-
- /**
- * @return children (neighbours) of this node
- */
- public List children() {
- return Collections.unmodifiableList(this.children);
- }
-
- /**
- * @param childKey add a child (neighbour) of this node
- */
- public void addChild(String childKey) {
- this.children.add(childKey);
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Page.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Page.java
deleted file mode 100644
index 0d3c04eb9215a..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Page.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import java.util.List;
-
-/**
- * Defines a page interface in Azure responses.
- *
- * @param the element type.
- */
-public interface Page {
- /**
- * Gets the link to the next page.
- *
- * @return the link.
- */
- String getNextPageLink();
-
- /**
- * Gets the list of items.
- *
- * @return the list of items.
- */
- List getItems();
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java
deleted file mode 100644
index a88a044f751e7..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PagedList.java
+++ /dev/null
@@ -1,339 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.microsoft.rest.RestException;
-
-import javax.xml.bind.DataBindingException;
-import javax.xml.ws.WebServiceException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.NoSuchElementException;
-
-/**
- * Defines a list response from a paging operation. The pages are
- * lazy initialized when an instance of this class is iterated.
- *
- * @param the element type.
- */
-public abstract class PagedList implements List {
- /** The actual items in the list. */
- private List items;
- /** Stores the link to get the next page of items. */
- private String nextPageLink;
- /** Stores the latest page fetched. */
- private Page currentPage;
-
- /**
- * Creates an instance of Pagedlist.
- */
- public PagedList() {
- items = new ArrayList<>();
- }
-
- /**
- * Creates an instance of PagedList from a {@link Page} response.
- *
- * @param page the {@link Page} object.
- */
- public PagedList(Page page) {
- this();
- items.addAll(page.getItems());
- nextPageLink = page.getNextPageLink();
- currentPage = page;
- }
-
- /**
- * Override this method to load the next page of items from a next page link.
- *
- * @param nextPageLink the link to get the next page of items.
- * @return the {@link Page} object storing a page of items and a link to the next page.
- * @throws RestException thrown if an error is raised from Azure.
- * @throws IOException thrown if there's any failure in deserialization.
- */
- public abstract Page nextPage(String nextPageLink) throws RestException, IOException;
-
- /**
- * If there are more pages available.
- *
- * @return true if there are more pages to load. False otherwise.
- */
- public boolean hasNextPage() {
- return this.nextPageLink != null;
- }
-
- /**
- * Loads a page from next page link.
- * The exceptions are wrapped into Java Runtime exceptions.
- */
- public void loadNextPage() {
- try {
- Page nextPage = nextPage(this.nextPageLink);
- this.nextPageLink = nextPage.getNextPageLink();
- this.items.addAll(nextPage.getItems());
- this.currentPage = nextPage;
- } catch (RestException e) {
- throw new WebServiceException(e.toString(), e);
- } catch (IOException e) {
- throw new DataBindingException(e.getMessage(), e);
- }
- }
-
- /**
- * Keep loading the next page from the next page link until all items are loaded.
- */
- public void loadAll() {
- while (hasNextPage()) {
- loadNextPage();
- }
- }
-
- /**
- * Gets the latest page fetched.
- *
- * @return the latest page.
- */
- public Page currentPage() {
- return currentPage;
- }
-
- /**
- * Gets the next page's link.
- *
- * @return the next page link.
- */
- public String nextPageLink() {
- return nextPageLink;
- }
-
- /**
- * The implementation of {@link ListIterator} for PagedList.
- */
- private class ListItr implements ListIterator {
- /** The list iterator for the actual list of items. */
- private ListIterator itemsListItr;
-
- /**
- * Creates an instance of the ListIterator.
- *
- * @param index the position in the list to start.
- */
- ListItr(int index) {
- itemsListItr = items.listIterator(index);
- }
-
- @Override
- public boolean hasNext() {
- return itemsListItr.hasNext() || hasNextPage();
- }
-
- @Override
- public E next() {
- if (!itemsListItr.hasNext()) {
- if (!hasNextPage()) {
- throw new NoSuchElementException();
- } else {
- int size = items.size();
- loadNextPage();
- itemsListItr = items.listIterator(size);
- }
- }
- return itemsListItr.next();
- }
-
- @Override
- public void remove() {
- itemsListItr.remove();
- }
-
- @Override
- public boolean hasPrevious() {
- return itemsListItr.hasPrevious();
- }
-
- @Override
- public E previous() {
- return itemsListItr.previous();
- }
-
- @Override
- public int nextIndex() {
- return itemsListItr.nextIndex();
- }
-
- @Override
- public int previousIndex() {
- return itemsListItr.previousIndex();
- }
-
- @Override
- public void set(E e) {
- itemsListItr.set(e);
- }
-
- @Override
- public void add(E e) {
- itemsListItr.add(e);
- }
- }
-
- @Override
- public int size() {
- loadAll();
- return items.size();
- }
-
- @Override
- public boolean isEmpty() {
- return items.isEmpty() && !hasNextPage();
- }
-
- @Override
- public boolean contains(Object o) {
- return indexOf(o) >= 0;
- }
-
- @Override
- public Iterator iterator() {
- return new ListItr(0);
- }
-
- @Override
- public Object[] toArray() {
- loadAll();
- return items.toArray();
- }
-
- @Override
- public T[] toArray(T[] a) {
- loadAll();
- return items.toArray(a);
- }
-
- @Override
- public boolean add(E e) {
- return items.add(e);
- }
-
- @Override
- public boolean remove(Object o) {
- return items.remove(o);
- }
-
- @Override
- public boolean containsAll(Collection> c) {
- for (Object e : c) {
- if (!contains(e)) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public boolean addAll(Collection extends E> c) {
- return items.addAll(c);
- }
-
- @Override
- public boolean addAll(int index, Collection extends E> c) {
- return items.addAll(index, c);
- }
-
- @Override
- public boolean removeAll(Collection> c) {
- return items.removeAll(c);
- }
-
- @Override
- public boolean retainAll(Collection> c) {
- return items.retainAll(c);
- }
-
- @Override
- public void clear() {
- items.clear();
- }
-
- @Override
- public E get(int index) {
- while (index >= items.size() && hasNextPage()) {
- loadNextPage();
- }
- return items.get(index);
- }
-
- @Override
- public E set(int index, E element) {
- return items.set(index, element);
- }
-
- @Override
- public void add(int index, E element) {
- items.add(index, element);
- }
-
- @Override
- public E remove(int index) {
- return items.remove(index);
- }
-
- @Override
- public int indexOf(Object o) {
- int index = 0;
- if (o == null) {
- for (E item : this) {
- if (item == null) {
- return index;
- }
- ++index;
- }
- } else {
- for (E item : this) {
- if (item == o) {
- return index;
- }
- ++index;
- }
- }
- return -1;
- }
-
- @Override
- public int lastIndexOf(Object o) {
- loadAll();
- return items.lastIndexOf(o);
- }
-
- @Override
- public ListIterator listIterator() {
- return new ListItr(0);
- }
-
- @Override
- public ListIterator listIterator(int index) {
- while (index >= items.size() && hasNextPage()) {
- loadNextPage();
- }
- return new ListItr(index);
- }
-
- @Override
- public List subList(int fromIndex, int toIndex) {
- while ((fromIndex >= items.size()
- || toIndex >= items.size())
- && hasNextPage()) {
- loadNextPage();
- }
- return items.subList(fromIndex, toIndex);
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java
deleted file mode 100644
index 50255ba600899..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/PollingState.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.microsoft.rest.serializer.JacksonMapperAdapter;
-
-import java.io.IOException;
-import java.lang.reflect.Type;
-
-import okhttp3.ResponseBody;
-import retrofit2.Response;
-
-/**
- * An instance of this class defines the state of a long running operation.
- *
- * @param the type of the resource the operation returns.
- */
-public class PollingState {
- /** The Retrofit response object. */
- private Response response;
- /** The polling status. */
- private String status;
- /** The link in 'Azure-AsyncOperation' header. */
- private String azureAsyncOperationHeaderLink;
- /** The link in 'Location' Header. */
- private String locationHeaderLink;
- /** The timeout interval between two polling operations. */
- private Integer retryTimeout;
- /** The response resource object. */
- private T resource;
- /** The type of the response resource object. */
- private Type resourceType;
- /** The error during the polling operations. */
- private CloudError error;
- /** The adapter for {@link com.fasterxml.jackson.databind.ObjectMapper}. */
- private JacksonMapperAdapter mapperAdapter;
-
- /**
- * Initializes an instance of {@link PollingState}.
- *
- * @param response the response from Retrofit REST call.
- * @param retryTimeout the long running operation retry timeout.
- * @param resourceType the type of the resource the long running operation returns
- * @param mapperAdapter the adapter for the Jackson object mapper
- * @throws IOException thrown by deserialization
- */
- public PollingState(Response response, Integer retryTimeout, Type resourceType, JacksonMapperAdapter mapperAdapter) throws IOException {
- this.retryTimeout = retryTimeout;
- this.setResponse(response);
- this.resourceType = resourceType;
- this.mapperAdapter = mapperAdapter;
-
- String responseContent = null;
- PollingResource resource = null;
- if (response.body() != null) {
- responseContent = response.body().string();
- response.body().close();
- }
- if (responseContent != null && !responseContent.isEmpty()) {
- this.resource = mapperAdapter.deserialize(responseContent, resourceType);
- resource = mapperAdapter.deserialize(responseContent, PollingResource.class);
- }
- if (resource != null && resource.getProperties() != null
- && resource.getProperties().getProvisioningState() != null) {
- setStatus(resource.getProperties().getProvisioningState());
- } else {
- switch (this.response.code()) {
- case 202:
- setStatus(AzureAsyncOperation.IN_PROGRESS_STATUS);
- break;
- case 204:
- case 201:
- case 200:
- setStatus(AzureAsyncOperation.SUCCESS_STATUS);
- break;
- default:
- setStatus(AzureAsyncOperation.FAILED_STATUS);
- }
- }
- }
-
- /**
- * Updates the polling state from a PUT or PATCH operation.
- *
- * @param response the response from Retrofit REST call
- * @throws CloudException thrown if the response is invalid
- * @throws IOException thrown by deserialization
- */
- public void updateFromResponseOnPutPatch(Response response) throws CloudException, IOException {
- String responseContent = null;
- if (response.body() != null) {
- responseContent = response.body().string();
- response.body().close();
- }
-
- if (responseContent == null || responseContent.isEmpty()) {
- CloudException exception = new CloudException("no body");
- exception.setResponse(response);
- throw exception;
- }
-
- PollingResource resource = mapperAdapter.deserialize(responseContent, PollingResource.class);
- if (resource != null && resource.getProperties() != null && resource.getProperties().getProvisioningState() != null) {
- this.setStatus(resource.getProperties().getProvisioningState());
- } else {
- this.setStatus(AzureAsyncOperation.SUCCESS_STATUS);
- }
-
- CloudError error = new CloudError();
- this.setError(error);
- error.setCode(this.getStatus());
- error.setMessage("Long running operation failed");
- this.setResponse(response);
- this.setResource(mapperAdapter.deserialize(responseContent, resourceType));
- }
-
- /**
- * Updates the polling state from a DELETE or POST operation.
- *
- * @param response the response from Retrofit REST call
- * @throws IOException thrown by deserialization
- */
-
- public void updateFromResponseOnDeletePost(Response response) throws IOException {
- this.setResponse(response);
- String responseContent = null;
- if (response.body() != null) {
- responseContent = response.body().string();
- response.body().close();
- }
- this.setResource(mapperAdapter.deserialize(responseContent, resourceType));
- setStatus(AzureAsyncOperation.SUCCESS_STATUS);
- }
-
- /**
- * Gets long running operation delay in milliseconds.
- *
- * @return the delay in milliseconds.
- */
- public int getDelayInMilliseconds() {
- if (this.retryTimeout != null) {
- return this.retryTimeout * 1000;
- }
- if (this.response != null && response.headers().get("Retry-After") != null) {
- return Integer.parseInt(response.headers().get("Retry-After")) * 1000;
- }
- return AzureAsyncOperation.DEFAULT_DELAY * 1000;
- }
-
- /**
- * Gets the polling status.
- *
- * @return the polling status.
- */
- public String getStatus() {
- return status;
- }
-
-
- /**
- * Sets the polling status.
- *
- * @param status the polling status.
- * @throws IllegalArgumentException thrown if status is null.
- */
- public void setStatus(String status) throws IllegalArgumentException {
- if (status == null) {
- throw new IllegalArgumentException("Status is null.");
- }
- this.status = status;
- }
-
- /**
- * Gets the last operation response.
- *
- * @return the last operation response.
- */
- public Response getResponse() {
- return this.response;
- }
-
-
- /**
- * Sets the last operation response.
- *
- * @param response the last operation response.
- */
- public void setResponse(Response response) {
- this.response = response;
- if (response != null) {
- String asyncHeader = response.headers().get("Azure-AsyncOperation");
- String locationHeader = response.headers().get("Location");
- if (asyncHeader != null) {
- this.azureAsyncOperationHeaderLink = asyncHeader;
- }
- if (locationHeader != null) {
- this.locationHeaderLink = locationHeader;
- }
- }
- }
-
- /**
- * Gets the latest value captured from Azure-AsyncOperation header.
- *
- * @return the link in the header.
- */
- public String getAzureAsyncOperationHeaderLink() {
- return azureAsyncOperationHeaderLink;
- }
-
- /**
- * Gets the latest value captured from Location header.
- *
- * @return the link in the header.
- */
- public String getLocationHeaderLink() {
- return locationHeaderLink;
- }
-
- /**
- * Gets the resource.
- *
- * @return the resource.
- */
- public T getResource() {
- return resource;
- }
-
- /**
- * Sets the resource.
- *
- * @param resource the resource.
- */
- public void setResource(T resource) {
- this.resource = resource;
- }
-
- /**
- * Gets {@link CloudError} from current instance.
- *
- * @return the cloud error.
- */
- public CloudError getError() {
- return error;
- }
-
- /**
- * Sets {@link CloudError} from current instance.
- *
- * @param error the cloud error.
- */
- public void setError(CloudError error) {
- this.error = error;
- }
-
- /**
- * An instance of this class describes the status of a long running operation
- * and is returned from server each time.
- */
- static class PollingResource {
- /** Inner properties object. */
- @JsonProperty(value = "properties")
- private Properties properties;
-
- /**
- * Gets the inner properties object.
- *
- * @return the inner properties.
- */
- public Properties getProperties() {
- return properties;
- }
-
- /**
- * Sets the inner properties object.
- *
- * @param properties the inner properties.
- */
- public void setProperties(Properties properties) {
- this.properties = properties;
- }
-
- /**
- * Inner properties class.
- */
- static class Properties {
- /** The provisioning state of the resource. */
- @JsonProperty(value = "provisioningState")
- private String provisioningState;
-
- /**
- * Gets the provisioning state of the resource.
- *
- * @return the provisioning state.
- */
- public String getProvisioningState() {
- return provisioningState;
- }
-
- /**
- * Sets the provisioning state of the resource.
- *
- * @param provisioningState the provisioning state.
- */
- public void setProvisioningState(String provisioningState) {
- this.provisioningState = provisioningState;
- }
- }
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RequestIdHeaderInterceptor.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RequestIdHeaderInterceptor.java
deleted file mode 100644
index ddbe0db30ec0b..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RequestIdHeaderInterceptor.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import okhttp3.Interceptor;
-import okhttp3.Request;
-import okhttp3.Response;
-
-import java.io.IOException;
-import java.util.UUID;
-
-/**
- * An instance of this class puts an UUID in the request header. Azure uses
- * the request id as the unique identifier for
- */
-public class RequestIdHeaderInterceptor implements Interceptor {
- @Override
- public Response intercept(Chain chain) throws IOException {
- Request request = chain.request().newBuilder()
- .header("x-ms-client-request-id", UUID.randomUUID().toString())
- .build();
- return chain.proceed(request);
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Resource.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Resource.java
deleted file mode 100644
index 2f98e586a960d..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/Resource.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-import java.util.Map;
-
-/**
- * The Resource model.
- */
-public class Resource {
- /**
- * Resource Id.
- */
- @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
- private String id;
-
- /**
- * Resource name.
- */
- @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
- private String name;
-
- /**
- * Resource type.
- */
- @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
- private String type;
-
- /**
- * Resource location.
- */
- @JsonProperty(required = true)
- private String location;
-
- /**
- * Resource tags.
- */
- private Map tags;
-
- /**
- * Get the id value.
- *
- * @return the id value
- */
- public String id() {
- return this.id;
- }
-
- /**
- * Get the name value.
- *
- * @return the name value
- */
- public String name() {
- return this.name;
- }
-
- /**
- * Get the type value.
- *
- * @return the type value
- */
- public String type() {
- return this.type;
- }
-
- /**
- * Get the location value.
- *
- * @return the location value
- */
- public String location() {
- return this.location;
- }
-
- /**
- * Set the location value.
- *
- * @param location the location value to set
- * @return the resource itself
- */
- public Resource withLocation(String location) {
- this.location = location;
- return this;
- }
-
- /**
- * Get the tags value.
- *
- * @return the tags value
- */
- public Map getTags() {
- return this.tags;
- }
-
- /**
- * Set the tags value.
- *
- * @param tags the tags value to set
- * @return the resource itself
- */
- public Resource withTags(Map tags) {
- this.tags = tags;
- return this;
- }
-}
\ No newline at end of file
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ResourceGetExponentialBackoffRetryStrategy.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ResourceGetExponentialBackoffRetryStrategy.java
deleted file mode 100644
index a145fecc6795b..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/ResourceGetExponentialBackoffRetryStrategy.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.microsoft.rest.retry.RetryStrategy;
-import okhttp3.Response;
-
-/**
- * A retry strategy with backoff parameters for calculating the exponential
- * delay between retries for 404s from GET calls.
- */
-public class ResourceGetExponentialBackoffRetryStrategy extends RetryStrategy {
- /**
- * Represents the default number of retries.
- */
- private static final int DEFAULT_NUMBER_OF_ATTEMPTS = 3;
-
- /**
- * Creates an instance of the retry strategy.
- */
- public ResourceGetExponentialBackoffRetryStrategy() {
- this(null, DEFAULT_FIRST_FAST_RETRY);
- }
-
- /**
- * Initializes a new instance of the {@link RetryStrategy} class.
- *
- * @param name The name of the retry strategy.
- * @param firstFastRetry true to immediately retry in the first attempt; otherwise, false.
- */
- private ResourceGetExponentialBackoffRetryStrategy(String name, boolean firstFastRetry) {
- super(name, firstFastRetry);
- }
-
- @Override
- public boolean shouldRetry(int retryCount, Response response) {
- int code = response.code();
- //CHECKSTYLE IGNORE MagicNumber FOR NEXT 2 LINES
- return retryCount < DEFAULT_NUMBER_OF_ATTEMPTS
- && code == 404
- && response.request().method().equalsIgnoreCase("GET");
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RestClient.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RestClient.java
deleted file mode 100644
index 0ace881f0ee51..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/RestClient.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.microsoft.azure.serializer.AzureJacksonMapperAdapter;
-import com.microsoft.rest.BaseUrlHandler;
-import com.microsoft.rest.CustomHeadersInterceptor;
-import com.microsoft.rest.UserAgentInterceptor;
-import com.microsoft.rest.credentials.ServiceClientCredentials;
-import com.microsoft.rest.retry.RetryHandler;
-import com.microsoft.rest.serializer.JacksonMapperAdapter;
-import okhttp3.ConnectionPool;
-import okhttp3.Interceptor;
-import okhttp3.JavaNetCookieJar;
-import okhttp3.OkHttpClient;
-import okhttp3.logging.HttpLoggingInterceptor;
-import retrofit2.Retrofit;
-
-import java.lang.reflect.Field;
-import java.net.CookieManager;
-import java.net.CookiePolicy;
-import java.net.Proxy;
-import java.util.concurrent.Executor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * An instance of this class stores the client information for making REST calls.
- */
-public class RestClient {
- /** The {@link okhttp3.OkHttpClient} object. */
- private OkHttpClient httpClient;
- /** The {@link retrofit2.Retrofit} object. */
- private Retrofit retrofit;
- /** The credentials to authenticate. */
- private ServiceClientCredentials credentials;
- /** The interceptor to handle custom headers. */
- private CustomHeadersInterceptor customHeadersInterceptor;
- /** The interceptor to handle base URL. */
- private BaseUrlHandler baseUrlHandler;
- /** The adapter to a Jackson {@link com.fasterxml.jackson.databind.ObjectMapper}. */
- private JacksonMapperAdapter mapperAdapter;
- /** The interceptor to set 'User-Agent' header. */
- private UserAgentInterceptor userAgentInterceptor;
-
- protected RestClient(OkHttpClient httpClient,
- Retrofit retrofit,
- ServiceClientCredentials credentials,
- CustomHeadersInterceptor customHeadersInterceptor,
- UserAgentInterceptor userAgentInterceptor,
- BaseUrlHandler baseUrlHandler,
- JacksonMapperAdapter mapperAdapter) {
- this.httpClient = httpClient;
- this.retrofit = retrofit;
- this.credentials = credentials;
- this.customHeadersInterceptor = customHeadersInterceptor;
- this.userAgentInterceptor = userAgentInterceptor;
- this.baseUrlHandler = baseUrlHandler;
- this.mapperAdapter = mapperAdapter;
- }
-
- /**
- * Get the headers interceptor.
- *
- * @return the headers interceptor.
- */
- public CustomHeadersInterceptor headers() {
- return customHeadersInterceptor;
- }
-
- /**
- * Get the adapter to {@link com.fasterxml.jackson.databind.ObjectMapper}.
- *
- * @return the Jackson mapper adapter.
- */
- public JacksonMapperAdapter mapperAdapter() {
- return mapperAdapter;
- }
-
- /**
- * Sets the mapper adapter.
- *
- * @param mapperAdapter an adapter to a Jackson mapper.
- * @return the builder itself for chaining.
- */
- public RestClient withMapperAdapater(JacksonMapperAdapter mapperAdapter) {
- this.mapperAdapter = mapperAdapter;
- return this;
- }
-
- /**
- * Get the http client.
- *
- * @return the {@link OkHttpClient} object.
- */
- public OkHttpClient httpClient() {
- return httpClient;
- }
-
- /**
- * Get the retrofit instance.
- *
- * @return the {@link Retrofit} object.
- */
- public Retrofit retrofit() {
- return retrofit;
- }
-
- /**
- * Get the credentials attached to this REST client.
- *
- * @return the credentials.
- */
- public ServiceClientCredentials credentials() {
- return this.credentials;
- }
-
- /**
- * The builder class for building a REST client.
- */
- public static class Builder {
- /** The dynamic base URL with variables wrapped in "{" and "}". */
- protected String baseUrl;
- /** The builder to build an {@link OkHttpClient}. */
- protected OkHttpClient.Builder httpClientBuilder;
- /** The builder to build a {@link Retrofit}. */
- protected Retrofit.Builder retrofitBuilder;
- /** The credentials to authenticate. */
- protected ServiceClientCredentials credentials;
- /** The interceptor to handle custom headers. */
- protected CustomHeadersInterceptor customHeadersInterceptor;
- /** The interceptor to handle base URL. */
- protected BaseUrlHandler baseUrlHandler;
- /** The interceptor to set 'User-Agent' header. */
- protected UserAgentInterceptor userAgentInterceptor;
- /** The inner Builder instance. */
- protected Buildable buildable;
-
- /**
- * Creates an instance of the builder with a base URL to the service.
- */
- public Builder() {
- this(new OkHttpClient.Builder(), new Retrofit.Builder());
- }
-
- /**
- * Creates an instance of the builder with a base URL and 2 custom builders.
- *
- * @param httpClientBuilder the builder to build an {@link OkHttpClient}.
- * @param retrofitBuilder the builder to build a {@link Retrofit}.
- */
- public Builder(OkHttpClient.Builder httpClientBuilder, Retrofit.Builder retrofitBuilder) {
- if (httpClientBuilder == null) {
- throw new IllegalArgumentException("httpClientBuilder == null");
- }
- if (retrofitBuilder == null) {
- throw new IllegalArgumentException("retrofitBuilder == null");
- }
- CookieManager cookieManager = new CookieManager();
- cookieManager.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
- customHeadersInterceptor = new CustomHeadersInterceptor();
- baseUrlHandler = new BaseUrlHandler();
- userAgentInterceptor = new UserAgentInterceptor();
- // Set up OkHttp client
- this.httpClientBuilder = httpClientBuilder
- .cookieJar(new JavaNetCookieJar(cookieManager))
- .addInterceptor(userAgentInterceptor);
- this.retrofitBuilder = retrofitBuilder;
- this.buildable = new Buildable();
- }
-
- /**
- * Sets the dynamic base URL.
- *
- * @param baseUrl the base URL to use.
- * @return the builder itself for chaining.
- */
- public Buildable withBaseUrl(String baseUrl) {
- this.baseUrl = baseUrl;
- return buildable;
- }
-
- /**
- * Sets the base URL with the default from the service client.
- *
- * @param serviceClientClass the service client class containing a default base URL.
- * @return the builder itself for chaining.
- */
- public Buildable withDefaultBaseUrl(Class> serviceClientClass) {
- try {
- Field field = serviceClientClass.getDeclaredField("DEFAULT_BASE_URL");
- field.setAccessible(true);
- baseUrl = (String) field.get(null);
- } catch (NoSuchFieldException | IllegalAccessException e) {
- throw new UnsupportedOperationException("Cannot read static field DEFAULT_BASE_URL", e);
- }
- return buildable;
- }
-
- /**
- * Sets the base URL with the default from the Azure Environment.
- *
- * @param environment the environment the application is running in
- * @return the builder itself for chaining
- */
- public RestClient.Builder.Buildable withDefaultBaseUrl(AzureEnvironment environment) {
- withBaseUrl(environment.getBaseUrl());
- return buildable;
- }
-
- /**
- * The inner class from which a Rest Client can be built.
- */
- public class Buildable {
- /**
- * Sets the user agent header.
- *
- * @param userAgent the user agent header.
- * @return the builder itself for chaining.
- */
- public Buildable withUserAgent(String userAgent) {
- userAgentInterceptor.withUserAgent(userAgent);
- return this;
- }
-
- /**
- * Sets the credentials.
- *
- * @param credentials the credentials object.
- * @return the builder itself for chaining.
- */
- public Buildable withCredentials(ServiceClientCredentials credentials) {
- Builder.this.credentials = credentials;
- if (credentials != null) {
- credentials.applyCredentialsFilter(httpClientBuilder);
- }
- return this;
- }
-
- /**
- * Sets the log level.
- *
- * @param logLevel the {@link okhttp3.logging.HttpLoggingInterceptor.Level} enum.
- * @return the builder itself for chaining.
- */
- public Buildable withLogLevel(HttpLoggingInterceptor.Level logLevel) {
- httpClientBuilder.addInterceptor(new HttpLoggingInterceptor().setLevel(logLevel));
- return this;
- }
-
- /**
- * Add an interceptor the Http client pipeline.
- *
- * @param interceptor the interceptor to add.
- * @return the builder itself for chaining.
- */
- public Buildable withInterceptor(Interceptor interceptor) {
- httpClientBuilder.addInterceptor(interceptor);
- return this;
- }
-
- /**
- * Set the read timeout on the HTTP client. Default is 10 seconds.
- *
- * @param timeout the timeout numeric value
- * @param unit the time unit for the numeric value
- * @return the builder itself for chaining
- */
- public Buildable withReadTimeout(long timeout, TimeUnit unit) {
- httpClientBuilder.readTimeout(timeout, unit);
- return this;
- }
-
- /**
- * Set the connection timeout on the HTTP client. Default is 10 seconds.
- *
- * @param timeout the timeout numeric value
- * @param unit the time unit for the numeric value
- * @return the builder itself for chaining
- */
- public Buildable withConnectionTimeout(long timeout, TimeUnit unit) {
- httpClientBuilder.connectTimeout(timeout, unit);
- return this;
- }
-
- /**
- * Set the maximum idle connections for the HTTP client. Default is 5.
- *
- * @param maxIdleConnections the maximum idle connections
- * @return the builder itself for chaining
- */
- public Buildable withMaxIdleConnections(int maxIdleConnections) {
- httpClientBuilder.connectionPool(new ConnectionPool(maxIdleConnections, 5, TimeUnit.MINUTES));
- return this;
- }
-
- /**
- * Sets the executor for async callbacks to run on.
- *
- * @param executor the executor to execute the callbacks.
- * @return the builder itself for chaining
- */
- public Buildable withCallbackExecutor(Executor executor) {
- retrofitBuilder.callbackExecutor(executor);
- return this;
- }
-
- /**
- * Sets the proxy for the HTTP client.
- *
- * @param proxy the proxy to use
- * @return the builder itself for chaining
- */
- public Buildable withProxy(Proxy proxy) {
- httpClientBuilder.proxy(proxy);
- return this;
- }
-
- /**
- * Build a RestClient with all the current configurations.
- *
- * @return a {@link RestClient}.
- */
- public RestClient build() {
- AzureJacksonMapperAdapter mapperAdapter = new AzureJacksonMapperAdapter();
- OkHttpClient httpClient = httpClientBuilder
- .addInterceptor(baseUrlHandler)
- .addInterceptor(customHeadersInterceptor)
- .addInterceptor(new RetryHandler(new ResourceGetExponentialBackoffRetryStrategy()))
- .addInterceptor(new RetryHandler())
- .build();
- return new RestClient(httpClient,
- retrofitBuilder
- .baseUrl(baseUrl)
- .client(httpClient)
- .addConverterFactory(mapperAdapter.getConverterFactory())
- .build(),
- credentials,
- customHeadersInterceptor,
- userAgentInterceptor,
- baseUrlHandler,
- mapperAdapter);
- }
-
- }
- }
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/SubResource.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/SubResource.java
deleted file mode 100644
index 12bedc30c57fc..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/SubResource.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-/**
- * The SubResource model.
- */
-public class SubResource {
- /**
- * Resource Id.
- */
- private String id;
-
- /**
- * Get the id value.
- *
- * @return the id value
- */
- public String id() {
- return this.id;
- }
-
- /**
- * Set the id value.
- *
- * @param id the id value to set
- * @return the sub resource itself
- */
- public SubResource withId(String id) {
- this.id = id;
- return this;
- }
-}
\ No newline at end of file
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroup.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroup.java
deleted file mode 100644
index 26bbbece2606b..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroup.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.microsoft.rest.ServiceCall;
-import com.microsoft.rest.ServiceCallback;
-
-/**
- * Represents a group of related tasks.
- *
- * each task in a group is represented by {@link TaskItem}
- *
- * @param the type of result of tasks in the group
- * @param the task type
- */
-public interface TaskGroup> {
- /**
- * Gets underlying directed acyclic graph structure that stores tasks in the group and
- * dependency information between them.
- *
- * @return the dag
- */
- DAGraph> dag();
-
- /**
- * Merges this task group with parent task group.
- *
- * once merged, calling execute in the parent group will executes the task in this
- * group as well.
- *
- * @param parentTaskGroup task group
- */
- void merge(TaskGroup parentTaskGroup);
-
- /**
- * @return true if the group is responsible for preparing execution of original task in
- * this group and all tasks belong other task group it composes.
- */
- boolean isPreparer();
-
- /**
- * Prepare the graph for execution.
- */
- void prepare();
-
- /**
- * Executes the tasks in the group.
- *
- * the order of execution of tasks ensure that a task gets selected for execution only after
- * the execution of all the tasks it depends on
- * @throws Exception the exception
- */
- void execute() throws Exception;
-
- /**
- * Executes the tasks in the group asynchronously.
- *
- * @param callback the callback to call on failure or success
- * @return the handle to the REST call
- */
- ServiceCall executeAsync(ServiceCallback callback);
-
- /**
- * Gets the result of execution of a task in the group.
- *
- * this method can null if the task has not yet been executed
- *
- * @param taskId the task id
- * @return the task result
- */
- T taskResult(String taskId);
-}
diff --git a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java b/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java
deleted file mode 100644
index efc8d30e491bc..0000000000000
--- a/src/client/Java/azure-client-runtime/src/main/java/com/microsoft/azure/TaskGroupBase.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- *
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Licensed under the MIT License. See License.txt in the project root for license information.
- *
- */
-
-package com.microsoft.azure;
-
-import com.microsoft.rest.ServiceCall;
-import com.microsoft.rest.ServiceCallback;
-
-/**
- * The base implementation of TaskGroup interface.
- *
- * @param the result type of the tasks in the group
- */
-public abstract class TaskGroupBase
- implements TaskGroup> {
- private DAGraph, DAGNode>> dag;
-
- /**
- * Creates TaskGroupBase.
- *
- * @param rootTaskItemId the id of the root task in this task group
- * @param rootTaskItem the root task
- */
- public TaskGroupBase(String rootTaskItemId, TaskItem rootTaskItem) {
- this.dag = new DAGraph<>(new DAGNode<>(rootTaskItemId, rootTaskItem));
- }
-
- @Override
- public DAGraph, DAGNode>> dag() {
- return dag;
- }
-
- @Override
- public boolean isPreparer() {
- return dag.isPreparer();
- }
-
- @Override
- public void merge(TaskGroup> parentTaskGroup) {
- dag.merge(parentTaskGroup.dag());
- }
-
- @Override
- public void prepare() {
- if (isPreparer()) {
- dag.prepare();
- }
- }
-
- @Override
- public void execute() throws Exception {
- DAGNode> nextNode = dag.getNext();
- if (nextNode == null) {
- return;
- }
-
- if (dag.isRootNode(nextNode)) {
- executeRootTask(nextNode.data());
- } else {
- nextNode.data().execute(this, nextNode);
- }
- }
-
- @Override
- public ServiceCall executeAsync(final ServiceCallback callback) {
- final DAGNode> nextNode = dag.getNext();
- if (nextNode == null) {
- return null;
- }
-
- if (dag.isRootNode(nextNode)) {
- return executeRootTaskAsync(nextNode.data(), callback);
- } else {
- return nextNode.data().executeAsync(this, nextNode, callback);
- }
- }
-
- @Override
- public T taskResult(String taskId) {
- return dag.getNodeData(taskId).result();
- }
-
- /**
- * Executes the root task in this group.
- *
- * This method will be invoked when all the task dependencies of the root task are finished
- * executing, at this point root task can be executed by consuming the result of tasks it
- * depends on.
- *
- * @param task the root task in this group
- * @throws Exception the exception
- */
- public abstract void executeRootTask(TaskItem task) throws Exception;
-
- /**
- * Executes the root task in this group asynchronously.
- *