Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | package org.onosproject.incubator.net.domain; |
| 17 | |
| 18 | import com.google.common.annotations.Beta; |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame^] | 19 | import org.onosproject.net.Path; |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 20 | |
| 21 | /** |
| 22 | * Context for intent primitive requests to an intent domain provider. A context |
| 23 | * must be explicitly applied before it can be used. The purpose of the request |
| 24 | * context is so that an application can coordinate multiple requests across multiple |
| 25 | * domains before committing. Contexts can be explicitly cancelled if they are not |
| 26 | * needed (due to a better context or incomplete path across domains); they can |
| 27 | * also be automatically cancelled by a provider after a short timeout. |
| 28 | */ |
| 29 | @Beta |
Brian O'Connor | ce2d8b5 | 2015-07-29 16:24:13 -0700 | [diff] [blame] | 30 | public class RequestContext { |
Brian O'Connor | 59a9285 | 2015-07-30 19:08:24 -0700 | [diff] [blame] | 31 | private final IntentDomain domain; |
| 32 | private final IntentResource resource; |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame^] | 33 | private final Path path; |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 34 | //TODO other common parameters: |
| 35 | //String cost; |
| 36 | |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame^] | 37 | public RequestContext(IntentDomain domain, IntentResource resource, Path path) { |
Brian O'Connor | 59a9285 | 2015-07-30 19:08:24 -0700 | [diff] [blame] | 38 | this.domain = domain; |
| 39 | this.resource = resource; |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame^] | 40 | this.path = path; |
Brian O'Connor | 59a9285 | 2015-07-30 19:08:24 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | public IntentDomain domain() { |
| 44 | return domain; |
| 45 | } |
| 46 | |
| 47 | public IntentResource resource() { |
| 48 | return resource; |
| 49 | } |
Aaron Kruglikov | c61d2d1 | 2015-09-01 11:10:48 -0700 | [diff] [blame^] | 50 | |
| 51 | public Path path() { |
| 52 | return path; |
| 53 | } |
Brian O'Connor | b7baf71 | 2015-07-28 23:27:03 -0700 | [diff] [blame] | 54 | } |