abaf0fa84f1ac0fdab5b5b8a5ce31e4abdbb0667
[hc2vpp.git] /
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
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
17 package io.fd.hc2vpp.routing.write.factory.base;
18
19 import static com.google.common.base.Preconditions.checkNotNull;
20
21 import io.fd.hc2vpp.common.translate.util.NamingContext;
22 import io.fd.hc2vpp.v3po.vppclassifier.VppClassifierContextManager;
23 import javax.annotation.Nonnull;
24
25 /**
26  * Extension to {@code ClassifierContextHolder} to hold also {@code NamingContext}
27  */
28 public abstract class BasicHopRequestFactory extends ClassifierContextHolder {
29
30     private final NamingContext interfaceNamingContext;
31     private final NamingContext routingProtocolContext;
32
33     protected BasicHopRequestFactory(
34             @Nonnull final VppClassifierContextManager classifierContextManager,
35             @Nonnull final NamingContext interfaceContext,
36             @Nonnull final NamingContext routingProtocolContext) {
37         super(classifierContextManager);
38         this.interfaceNamingContext = checkNotNull(interfaceContext, "Interface context cannot be null");
39         this.routingProtocolContext = checkNotNull(routingProtocolContext, "Routing protocol context cannot be null");
40     }
41
42     protected NamingContext getInterfaceNamingContext() {
43         return interfaceNamingContext;
44     }
45
46     protected NamingContext getRoutingProtocolContext() {
47         return routingProtocolContext;
48     }
49 }