blob: a48aa4f98576ab3df2222920c36cb47c7bdfad30 [file] [log] [blame]
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -08003 *
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 */
16package org.onosproject.net.driver;
17
Thomas Vachuskafacc3f52015-04-10 08:58:36 -070018import static com.google.common.base.Preconditions.checkState;
19
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080020/**
Thomas Vachuska3afbc7f2016-02-01 15:55:38 -080021 * Base implementation of a driver behaviour.
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080022 */
23public class AbstractBehaviour implements Behaviour {
24
25 private DriverData data;
26
27 @Override
Thomas Vachuskafacc3f52015-04-10 08:58:36 -070028 public DriverData data() {
29 return data;
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080030 }
alshabib910aff12015-04-09 16:55:57 -070031
32 @Override
Thomas Vachuskafacc3f52015-04-10 08:58:36 -070033 public void setData(DriverData data) {
34 checkState(this.data == null, "Driver data already set");
35 this.data = data;
alshabib910aff12015-04-09 16:55:57 -070036 }
Thomas Vachuskaa8f4e7d2015-01-08 17:31:55 -080037}