Thomas Vachuska | 4f1a60c | 2014-10-28 13:39:07 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 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 | */ |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 16 | package org.onosproject.net.intent.impl; |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 17 | |
Sho SHIMIZU | 877ec2c | 2015-02-09 12:50:36 -0800 | [diff] [blame] | 18 | import com.google.common.base.MoreObjects; |
| 19 | import org.onosproject.net.ElementId; |
Brian O'Connor | abafb50 | 2014-12-02 22:26:20 -0800 | [diff] [blame] | 20 | import org.onosproject.net.intent.IntentException; |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 21 | |
Sho SHIMIZU | 877ec2c | 2015-02-09 12:50:36 -0800 | [diff] [blame] | 22 | import static com.google.common.base.Preconditions.checkNotNull; |
| 23 | |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 24 | /** |
| 25 | * An exception thrown when a path is not found. |
| 26 | */ |
| 27 | public class PathNotFoundException extends IntentException { |
| 28 | private static final long serialVersionUID = -2087045731049914733L; |
| 29 | |
Sho SHIMIZU | 877ec2c | 2015-02-09 12:50:36 -0800 | [diff] [blame] | 30 | private final ElementId source; |
| 31 | private final ElementId destination; |
| 32 | |
| 33 | public PathNotFoundException(ElementId source, ElementId destination) { |
| 34 | super(String.format("No path from %s to %s", source, destination)); |
| 35 | this.source = checkNotNull(source); |
| 36 | this.destination = checkNotNull(destination); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 37 | } |
| 38 | |
Sho SHIMIZU | 877ec2c | 2015-02-09 12:50:36 -0800 | [diff] [blame] | 39 | @Override |
| 40 | public String toString() { |
| 41 | return MoreObjects.toStringHelper(this) |
| 42 | .add("source", source) |
| 43 | .add("destination", destination) |
| 44 | .toString(); |
Brian O'Connor | 66630c8 | 2014-10-02 21:08:19 -0700 | [diff] [blame] | 45 | } |
| 46 | } |