Umesh Krishnaswamy | 345ee99 | 2012-12-13 20:29:48 -0800 | [diff] [blame] | 1 | /** |
| 2 | * Copyright 2011,2012, Big Switch Networks, Inc. |
| 3 | * Originally created by David Erickson, Stanford University |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 6 | * not use this file except in compliance with the License. You may obtain |
| 7 | * a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 13 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 14 | * License for the specific language governing permissions and limitations |
| 15 | * under the License. |
| 16 | **/ |
| 17 | |
| 18 | package net.floodlightcontroller.devicemanager; |
| 19 | |
| 20 | import java.util.EnumSet; |
| 21 | |
| 22 | import net.floodlightcontroller.devicemanager.IDeviceService.DeviceField; |
| 23 | import net.floodlightcontroller.devicemanager.internal.Device; |
| 24 | |
| 25 | /** |
| 26 | * Entities within an entity class are grouped into {@link Device} objects |
| 27 | * based on the {@link IEntityClass}, and the key fields specified by the entity |
| 28 | * class. A set of entities are considered to be the same device if and only |
| 29 | * if they belong to the same entity class and they match on all key fields |
| 30 | * for that entity class. A field is effectively wildcarded by not including |
| 31 | * it in the list of key fields returned by {@link IEntityClassifierService} and/or |
| 32 | * {@link IEntityClass}. |
| 33 | * |
| 34 | * Note that if you're not using static objects, you'll need to override |
| 35 | * {@link Object#equals(Object)} and {@link Object#hashCode()}. |
| 36 | * |
| 37 | * @author readams |
| 38 | * |
| 39 | */ |
| 40 | public interface IEntityClass { |
| 41 | /** |
| 42 | * Return the set of key fields for this entity class. Entities |
| 43 | * belonging to this class that differ in fields not included in |
| 44 | * this collection will be considered the same device. The key |
| 45 | * fields for an entity class must not change unless associated |
| 46 | * with a flush of that entity class. |
| 47 | * |
| 48 | * @return a set containing the fields that should not |
| 49 | * be wildcarded. May be null to indicate that all fields are key fields. |
| 50 | */ |
| 51 | EnumSet<DeviceField> getKeyFields(); |
| 52 | |
| 53 | /** |
| 54 | * Returns a user-friendly, unique name for this EntityClass |
| 55 | * @return the name of the entity class |
| 56 | */ |
| 57 | String getName(); |
| 58 | } |
| 59 | |