Merge "Parents pom distribution"
[controller.git] / opendaylight / hosttracker_new / api / src / main / java / org / opendaylight / controller / hosttracker / IEntityClass.java
1 /*
2  * Copyright (c) 2011,2012 Big Switch Networks, Inc.
3  *
4  * Licensed under the Eclipse Public License, Version 1.0 (the
5  * "License"); you may not use this file except in compliance with the
6  * License. You may obtain a copy of the License at
7  *
8  *      http://www.eclipse.org/legal/epl-v10.html
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
13  * implied. See the License for the specific language governing
14  * permissions and limitations under the License.
15  *
16  * This file incorporates work covered by the following copyright and
17  * permission notice:
18  *
19  *    Originally created by David Erickson, Stanford University
20  *
21  *    Licensed under the Apache License, Version 2.0 (the "License");
22  *    you may not use this file except in compliance with the
23  *    License. You may obtain a copy of the License at
24  *
25  *         http://www.apache.org/licenses/LICENSE-2.0
26  *
27  *    Unless required by applicable law or agreed to in writing,
28  *    software distributed under the License is distributed on an "AS
29  *    IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
30  *    express or implied. See the License for the specific language
31  *    governing permissions and limitations under the License.
32  */
33
34 package org.opendaylight.controller.hosttracker;
35
36 import java.util.EnumSet;
37
38 import org.opendaylight.controller.hosttracker.IDeviceService.DeviceField;
39 import org.osgi.service.device.Device;
40
41 /**
42  * Entities within an entity class are grouped into {@link Device} objects based
43  * on the {@link IEntityClass}, and the key fields specified by the entity
44  * class. A set of entities are considered to be the same device if and only if
45  * they belong to the same entity class and they match on all key fields for
46  * that entity class. A field is effectively wildcarded by not including it in
47  * the list of key fields returned by {@link IEntityClassifierService} and/or
48  * {@link IEntityClass}.
49  *
50  * Note that if you're not using static objects, you'll need to override
51  * {@link Object#equals(Object)} and {@link Object#hashCode()}.
52  *
53  * @author readams
54  *
55  */
56 public interface IEntityClass {
57     /**
58      * Return the set of key fields for this entity class. Entities belonging to
59      * this class that differ in fields not included in this collection will be
60      * considered the same device. The key fields for an entity class must not
61      * change unless associated with a flush of that entity class.
62      *
63      * @return a set containing the fields that should not be wildcarded. May be
64      *         null to indicate that all fields are key fields.
65      */
66     EnumSet<DeviceField> getKeyFields();
67
68     /**
69      * Returns a user-friendly, unique name for this EntityClass
70      *
71      * @return the name of the entity class
72      */
73     String getName();
74 }