diff options
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource')
10 files changed, 0 insertions, 907 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java deleted file mode 100644 index 28c429bd..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAdminService.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableList; - -import java.util.List; - -/** - * Service for administering resource service behavior. - */ -@Beta -public interface ResourceAdminService { - /** - * Registers the specified resources. - * - * @param resources resources to be registered - * @return true if registration is successfully done, false otherwise. Registration - * succeeds when each resource is not registered or unallocated. - */ - default boolean registerResources(ResourcePath... resources) { - return registerResources(ImmutableList.copyOf(resources)); - } - - /** - * Registers the specified resources. - * - * @param resources resources to be registered - * @return true if registration is successfully done, false otherwise. Registration - * succeeds when each resource is not registered or unallocated. - */ - boolean registerResources(List<ResourcePath> resources); - - /** - * Unregisters the specified resources. - * - * @param resources resources to be unregistered - * @return true if unregistration is successfully done, false otherwise. Unregistration - * succeeds when each resource is not registered or unallocated. - */ - default boolean unregisterResources(ResourcePath... resources) { - return unregisterResources(ImmutableList.copyOf(resources)); - } - - /** - * Unregisters the specified resources. - * - * @param resources resources to be unregistered - * @return true if unregistration is successfully done, false otherwise. Unregistration - * succeeds when each resource is not registered or unallocated. - */ - boolean unregisterResources(List<ResourcePath> resources); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAllocation.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAllocation.java deleted file mode 100644 index e6980267..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceAllocation.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; - -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Represents allocation of resource which is identified by the specifier. - */ -@Beta -public class ResourceAllocation { - - private final ResourcePath resource; - private final ResourceConsumer consumer; - - /** - * Creates an instance with the specified subject, resource and consumer. - * - * @param resource resource of the subject - * @param consumer consumer ot this resource - */ - public ResourceAllocation(ResourcePath resource, ResourceConsumer consumer) { - this.resource = checkNotNull(resource); - this.consumer = consumer; - } - - // for serialization - private ResourceAllocation() { - this.resource = null; - this.consumer = null; - } - - /** - * Returns the specifier of the resource this allocation uses. - * - * @return the specifier of the resource this allocation uses - */ - public ResourcePath resource() { - return resource; - } - - /** - * Returns the consumer of this resource. - * - * @return the consumer of this resource - */ - public ResourceConsumer consumer() { - return consumer; - } - - @Override - public int hashCode() { - return Objects.hash(resource, consumer); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof ResourceAllocation)) { - return false; - } - final ResourceAllocation that = (ResourceAllocation) obj; - return Objects.equals(this.resource, that.resource) - && Objects.equals(this.consumer, that.consumer); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("resource", resource) - .add("consumer", consumer) - .toString(); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceConsumer.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceConsumer.java deleted file mode 100644 index 1f67e204..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceConsumer.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; - -/** - * Marker interface representing an entity using resource. - */ -@Beta -public interface ResourceConsumer { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceEvent.java deleted file mode 100644 index 98abf301..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceEvent.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; -import org.onosproject.event.AbstractEvent; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Describes an event related to a resource. - */ -@Beta -public final class ResourceEvent extends AbstractEvent<ResourceEvent.Type, ResourcePath> { - - /** - * Type of resource events. - */ - @Beta - public enum Type { - /** - * Signifies that a new resource has been detected. - */ - RESOURCE_ADDED, - - /** - * Signifies that a resource has been removed. - */ - RESOURCE_REMOVED - } - - /** - * Create a resource event. - * - * @param type type of resource event - * @param subject subject of resource event - */ - public ResourceEvent(Type type, ResourcePath subject) { - super(checkNotNull(type), checkNotNull(subject)); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceListener.java deleted file mode 100644 index 3f871900..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; -import org.onosproject.event.EventListener; - -/** - * Entity capable of receiving resource related events. - */ -@Beta -public interface ResourceListener extends EventListener<ResourceEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourcePath.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourcePath.java deleted file mode 100644 index 72f8ac01..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourcePath.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; -import com.google.common.base.MoreObjects; -import com.google.common.collect.ImmutableList; -import org.onosproject.net.DeviceId; -import org.onosproject.net.PortNumber; - -import java.util.LinkedList; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Preconditions.checkState; - -/** - * An object that is used to locate a resource in a network. - * A ResourcePath represents a path that is hierarchical and composed of a sequence - * of elementary resources that are not globally identifiable. A ResourcePath can be a globally - * unique resource identifier. - * - * Two types of resource are considered. One is discrete type and the other is continuous type. - * Discrete type resource is a resource whose amount is measured as a discrete unit. VLAN ID and - * MPLS label are examples of discrete type resource. Continuous type resource is a resource whose - * amount is measured as a continuous value. Bandwidth is an example of continuous type resource. - * A double value is associated with a continuous type value. - * - * Users of this class must keep the semantics of resources regarding the hierarchical structure. - * For example, resource path, Device:1/Port:1/VLAN ID:100, is valid, but resource path, - * VLAN ID:100/Device:1/Port:1 is not valid because a link is not a sub-component of a VLAN ID. - */ -@Beta -public abstract class ResourcePath { - - private final Discrete parent; - private final Object last; - - public static final Discrete ROOT = new Discrete(); - - public static ResourcePath discrete(DeviceId device) { - return new Discrete(ImmutableList.of(device)); - } - - /** - * Creates an resource path which represents a discrete-type resource from the specified components. - * - * @param device device ID which is the first component of the path - * @param components following components of the path. The order represents hierarchical structure of the resource. - * @return resource path instance - */ - public static ResourcePath discrete(DeviceId device, Object... components) { - return new Discrete(ImmutableList.builder() - .add(device) - .add(components) - .build()); - } - - /** - * Creates an resource path which represents a discrete-type resource from the specified components. - * - * @param device device ID which is the first component of the path - * @param port port number which is the second component of the path - * @param components following components of the path. The order represents hierarchical structure of the resource. - * @return resource path instance - */ - public static ResourcePath discrete(DeviceId device, PortNumber port, Object... components) { - return new Discrete(ImmutableList.builder() - .add(device) - .add(port) - .add(components) - .build()); - } - - /** - * Creates an resource path which represents a continuous-type resource from the specified components. - * - * @param value amount of the resource - * @param device device ID which is the first component of the path - * @param components following components of the path. The order represents hierarchical structure of the resource. - * @return resource path instance - */ - public static ResourcePath continuous(double value, DeviceId device, Object... components) { - checkArgument(components.length > 0, - "Length of components must be greater thant 0, but " + components.length); - - return new Continuous(ImmutableList.builder() - .add(device) - .add(components) - .build(), value); - } - - /** - * Creates an resource path which represents a continuous-type resource from the specified components. - * - * @param value amount of the resource - * @param device device ID which is the first component of the path. - * @param port port number which is the second component of the path. - * @param components following components of the path. The order represents hierarchical structure of the resource. - * @return resource path instance - */ - public static ResourcePath continuous(double value, DeviceId device, PortNumber port, Object... components) { - return new Continuous(ImmutableList.builder() - .add(device) - .add(port) - .add(components) - .build(), value); - } - - /** - * Creates an resource path from the specified components. - * - * @param components components of the path. The order represents hierarchical structure of the resource. - */ - protected ResourcePath(List<Object> components) { - checkNotNull(components); - checkArgument(!components.isEmpty()); - - LinkedList<Object> children = new LinkedList<>(components); - this.last = children.pollLast(); - if (children.isEmpty()) { - this.parent = ROOT; - } else { - this.parent = new Discrete(children); - } - } - - /** - * Creates an resource path from the specified parent and child. - * - * @param parent the parent of this resource - * @param last a child of the parent - */ - protected ResourcePath(Discrete parent, Object last) { - checkNotNull(parent); - checkNotNull(last); - - this.parent = parent; - this.last = last; - } - - // for serialization - private ResourcePath() { - this.parent = null; - this.last = null; - } - - /** - * Returns the components of this resource path. - * - * @return the components of this resource path - */ - public List<Object> components() { - LinkedList<Object> components = new LinkedList<>(); - - ResourcePath current = this; - while (current.parent().isPresent()) { - components.addFirst(current.last); - current = current.parent; - } - - return components; - } - - /** - * Returns the parent resource path of this instance. - * E.g. if this path is Link:1/VLAN ID:100, the return value is the resource path for Link:1. - * - * @return the parent resource path of this instance. - * If there is no parent, empty instance will be returned. - */ - public Optional<Discrete> parent() { - return Optional.ofNullable(parent); - } - - /** - * Returns a child resource path of this instance with specifying the child object. - * The child resource path is discrete-type. - * - * @param child child object - * @return a child resource path - */ - public ResourcePath child(Object child) { - checkState(this instanceof Discrete); - - return new Discrete((Discrete) this, child); - } - - /** - * Returns a child resource path of this instance with specifying a child object and - * value. The child resource path is continuous-type. - * - * @param child child object - * @param value value - * @return a child resource path - */ - public ResourcePath child(Object child, double value) { - checkState(this instanceof Discrete); - - return new Continuous((Discrete) this, child, value); - } - - /** - * Returns the last component of this instance. - * - * @return the last component of this instance. - * The return value is equal to the last object of {@code components()}. - */ - public Object last() { - return last; - } - - @Override - public int hashCode() { - return Objects.hash(this.parent, this.last); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof ResourcePath)) { - return false; - } - final ResourcePath that = (ResourcePath) obj; - return Objects.equals(this.parent, that.parent) - && Objects.equals(this.last, that.last); - } - - @Override - public String toString() { - return MoreObjects.toStringHelper(this) - .add("parent", parent) - .add("last", last) - .toString(); - } - - /** - * Represents a resource path which specifies a resource which can be measured - * as a discrete unit. A VLAN ID and a MPLS label of a link are examples of the resource. - * <p> - * Note: This class is exposed to the public, but intended to be used in the resource API - * implementation only. It is not for resource API user. - * </p> - */ - @Beta - public static final class Discrete extends ResourcePath { - private Discrete() { - super(); - } - - private Discrete(List<Object> components) { - super(components); - } - - private Discrete(Discrete parent, Object last) { - super(parent, last); - } - } - - /** - * Represents a resource path which specifies a resource which can be measured - * as continuous value. Bandwidth of a link is an example of the resource. - * <p> - * Note: This class is exposed to the public, but intended to be used in the resource API - * implementation only. It is not for resource API user. - */ - @Beta - public static final class Continuous extends ResourcePath { - // Note: value is not taken into account for equality - private final double value; - - private Continuous(List<Object> components, double value) { - super(components); - this.value = value; - } - - public Continuous(Discrete parent, Object last, double value) { - super(parent, last); - this.value = value; - } - - /** - * Returns the value of the resource amount. - * - * @return the value of the resource amount - */ - public double value() { - return value; - } - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java deleted file mode 100644 index 966de500..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceService.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableList; -import org.onosproject.event.ListenerService; - -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Service for allocating/releasing resource(s) and retrieving allocation(s) and availability. - */ -@Beta -public interface ResourceService extends ListenerService<ResourceEvent, ResourceListener> { - /** - * Allocates the specified resource to the specified user. - * - * @param consumer resource user which the resource is allocated to - * @param resource resource to be allocated - * @return allocation information enclosed by Optional. If the allocation fails, the return value is empty - */ - default Optional<ResourceAllocation> allocate(ResourceConsumer consumer, ResourcePath resource) { - checkNotNull(consumer); - checkNotNull(resource); - - List<ResourceAllocation> allocations = allocate(consumer, ImmutableList.of(resource)); - if (allocations.isEmpty()) { - return Optional.empty(); - } - - assert allocations.size() == 1; - - ResourceAllocation allocation = allocations.get(0); - - assert allocation.resource().equals(resource); - - // cast is ensured by the assertions above - return Optional.of(allocation); - } - - /** - * Transactionally allocates the specified resources to the specified user. - * All allocations are made when this method succeeds, or no allocation is made when this method fails. - * - * @param consumer resource user which the resources are allocated to - * @param resources resources to be allocated - * @return non-empty list of allocation information if succeeded, otherwise empty list - */ - List<ResourceAllocation> allocate(ResourceConsumer consumer, List<ResourcePath> resources); - - /** - * Transactionally allocates the specified resources to the specified user. - * All allocations are made when this method succeeds, or no allocation is made when this method fails. - * - * @param consumer resource user which the resources are allocated to - * @param resources resources to be allocated - * @return non-empty list of allocation information if succeeded, otherwise empty list - */ - default List<ResourceAllocation> allocate(ResourceConsumer consumer, ResourcePath... resources) { - checkNotNull(consumer); - checkNotNull(resources); - - return allocate(consumer, Arrays.asList(resources)); - } - - /** - * Releases the specified resource allocation. - * - * @param allocation resource allocation to be released - * @return true if succeeded, otherwise false - */ - default boolean release(ResourceAllocation allocation) { - checkNotNull(allocation); - - return release(ImmutableList.of(allocation)); - } - - /** - * Transactionally releases the specified resource allocations. - * All allocations are released when this method succeeded, or no allocation is released when this method fails. - * - * @param allocations resource allocations to be released - * @return true if succeeded, otherwise false - */ - boolean release(List<ResourceAllocation> allocations); - - /** - * Transactionally releases the specified resource allocations. - * All allocations are released when this method succeeded, or no allocation is released when this method fails. - * - * @param allocations resource allocations to be released - * @return true if succeeded, otherwise false - */ - default boolean release(ResourceAllocation... allocations) { - checkNotNull(allocations); - - return release(ImmutableList.copyOf(allocations)); - } - - /** - * Transactionally releases the resources allocated to the specified consumer. - * All allocations are released when this method succeeded, or no allocation is released when this method fails. - * - * @param consumer consumer whose allocated resources are to be released - * @return true if succeeded, otherwise false - */ - boolean release(ResourceConsumer consumer); - - /** - * Returns resource allocation of the specified resource. - * - * @param resource resource to check the allocation - * @return allocation information enclosed by Optional. - * If the resource is not allocated, the return value is empty. - */ - Optional<ResourceAllocation> getResourceAllocation(ResourcePath resource); - - /** - * Returns allocated resources being as children of the specified parent and being the specified resource type. - * - * @param parent parent resource path - * @param cls class to specify a type of resource - * @param <T> type of the resource - * @return non-empty collection of resource allocations if resources are allocated with the subject and type, - * empty collection if no resource is allocated with the subject and type - */ - <T> Collection<ResourceAllocation> getResourceAllocations(ResourcePath parent, Class<T> cls); - - /** - * Returns resources allocated to the specified consumer. - * - * @param consumer consumer whose allocated resources are to be returned - * @return resources allocated to the consumer - */ - Collection<ResourceAllocation> getResourceAllocations(ResourceConsumer consumer); - - /** - * Returns resource paths that point available child resources under the specified resource path. - * - * @param parent parent resource path - * @return available resource paths under the specified resource path - */ - Collection<ResourcePath> getAvailableResources(ResourcePath parent); - - /** - * Returns the availability of the specified resource. - * - * @param resource resource to check the availability - * @return true if available, otherwise false - */ - boolean isAvailable(ResourcePath resource); - - // TODO: listener and event mechanism need to be considered -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java deleted file mode 100644 index 7c67430e..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceStore.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import com.google.common.annotations.Beta; -import org.onosproject.store.Store; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -/** - * Service for storing resource and consumer information. - */ -@Beta -public interface ResourceStore extends Store<ResourceEvent, ResourceStoreDelegate> { - - /** - * Registers the resources in transactional way. - * Resource registration must be done before resource allocation. The state after completion - * of this method is all the resources are registered, or none of the given resources is registered. - * The whole registration fails when any one of the resource can't be registered. - * - * @param resources resources to be registered - * @return true if the registration succeeds, false otherwise - */ - boolean register(List<ResourcePath> resources); - - /** - * Unregisters the resources in transactional way. - * The state after completion of this method is all the resources are unregistered, - * or none of the given resources is unregistered. The whole unregistration fails when any one of the - * resource can't be unregistered. - * - * @param resources resources to be unregistered - * @return true if the registration succeeds, false otherwise - */ - boolean unregister(List<ResourcePath> resources); - - /** - * Allocates the specified resources to the specified consumer in transactional way. - * The state after completion of this method is all the resources are allocated to the consumer, - * or no resource is allocated to the consumer. The whole allocation fails when any one of - * the resource can't be allocated. - * - * @param resources resources to be allocated - * @param consumer resource consumer which the resources are allocated to - * @return true if the allocation succeeds, false otherwise. - */ - boolean allocate(List<ResourcePath> resources, ResourceConsumer consumer); - - /** - * Releases the specified resources allocated to the specified corresponding consumers - * in transactional way. The state after completion of this method is all the resources - * are released from the consumer, or no resource is released. The whole release fails - * when any one of the resource can't be released. The size of the list of resources and - * that of consumers must be equal. The resource and consumer with the same position from - * the head of each list correspond to each other. - * - * @param resources resources to be released - * @param consumers resource consumers to whom the resource allocated to - * @return true if succeeds, otherwise false - */ - boolean release(List<ResourcePath> resources, List<ResourceConsumer> consumers); - - /** - * Returns the resource consumer to whom the specified resource is allocated. - * - * @param resource resource whose allocated consumer to be returned - * @return resource consumer who are allocated the resource - */ - Optional<ResourceConsumer> getConsumer(ResourcePath resource); - - /** - * Returns a collection of the resources allocated to the specified consumer. - * - * @param consumer resource consumer whose allocated resource are searched for - * @return a collection of the resources allocated to the specified consumer - */ - Collection<ResourcePath> getResources(ResourceConsumer consumer); - - /** - * Returns a collection of the child resources of the specified parent. - * - * @param parent parent of the resource to be returned - * @return a collection of the child resources of the specified resource - */ - Collection<ResourcePath> getChildResources(ResourcePath parent); - - /** - * Returns a collection of the resources which are children of the specified parent and - * whose type is the specified class. - * - * @param parent parent of the resources to be returned - * @param cls class instance of the children - * @param <T> type of the resource - * @return a collection of the resources which belongs to the specified subject and - * whose type is the specified class. - */ - <T> Collection<ResourcePath> getAllocatedResources(ResourcePath parent, Class<T> cls); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceStoreDelegate.java deleted file mode 100644 index a0b9bb25..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/ResourceStoreDelegate.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.onosproject.net.newresource; - -import org.onosproject.store.StoreDelegate; - -/** - * Resource store delegate abstraction. - */ -public interface ResourceStoreDelegate extends StoreDelegate<ResourceEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/package-info.java deleted file mode 100644 index 52bb8588..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/newresource/package-info.java +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015 Open Networking Laboratory - * - * 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. - */ - -/** - * Generic network resource model and services for resource allocation and - * resource tracking. - */ -package org.onosproject.net.newresource;
\ No newline at end of file |