2aec19fcbd0c674359846d96d20df18c5ddb0ad4
[honeycomb.git] / lisp / lisp2vpp / src / main / java / io / fd / honeycomb / lisp / translate / read / factory / AbstractLispReaderFactoryBase.java
1 /*
2  * Copyright (c) 2015 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.honeycomb.lisp.translate.read.factory;
18
19 import static com.google.common.base.Preconditions.checkNotNull;
20
21 import io.fd.honeycomb.lisp.context.util.EidMappingContext;
22 import io.fd.honeycomb.translate.vpp.util.NamingContext;
23 import javax.annotation.Nonnull;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.lisp.rev160520.LispState;
25 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
26 import io.fd.vpp.jvpp.core.future.FutureJVppCore;
27
28
29 /**
30  * Basic attributes for lisp reader factories
31  */
32 abstract class AbstractLispReaderFactoryBase {
33
34     protected final InstanceIdentifier<LispState> lispStateId;
35     protected final FutureJVppCore vppApi;
36     protected NamingContext interfaceContext;
37     protected NamingContext locatorSetContext;
38     protected NamingContext bridgeDomainContext;
39     protected EidMappingContext localMappingContext;
40     protected EidMappingContext remoteMappingContext;
41
42     protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
43                                             @Nonnull final FutureJVppCore vppApi) {
44         this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
45         this.vppApi = checkNotNull(vppApi, "VPP api refference is null");
46     }
47
48     protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
49                                             @Nonnull final FutureJVppCore vppApi,
50                                             @Nonnull final NamingContext interfaceContext,
51                                             @Nonnull final EidMappingContext localMappingContext,
52                                             @Nonnull final EidMappingContext remoteMappingContext) {
53         this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
54         this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
55         this.interfaceContext = checkNotNull(interfaceContext,
56                 "Interface naming context is null,for readers that don't need this dependency,use different constructor");
57         this.localMappingContext = checkNotNull(localMappingContext,
58                 "Local mappings reference is null,for readers that don't need this dependency use different constructor");
59         this.remoteMappingContext = checkNotNull(remoteMappingContext,
60                 "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
61     }
62
63     protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
64                                             @Nonnull final FutureJVppCore vppApi,
65                                             @Nonnull final NamingContext interfaceContext,
66                                             @Nonnull final NamingContext locatorSetContext,
67                                             @Nonnull final EidMappingContext localMappingContext,
68                                             @Nonnull final EidMappingContext remoteMappingContext) {
69         this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
70         this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
71         this.interfaceContext = checkNotNull(interfaceContext,
72                 "Interface naming context is null,for readers that don't need this dependency,use different constructor");
73         this.locatorSetContext = checkNotNull(locatorSetContext,
74                 "Locator set naming context is null,for readers that don't need this dependency,use different constructor");
75         this.localMappingContext = checkNotNull(localMappingContext,
76                 "Local mappings reference is null,for readers that don't need this dependency use different constructor");
77         this.remoteMappingContext = checkNotNull(remoteMappingContext,
78                 "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
79     }
80
81     protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
82                                             @Nonnull final FutureJVppCore vppApi,
83                                             @Nonnull final NamingContext interfaceContext,
84                                             @Nonnull final NamingContext locatorSetContext,
85                                             @Nonnull final NamingContext bridgeDomainContext,
86                                             @Nonnull final EidMappingContext localMappingContext,
87                                             @Nonnull final EidMappingContext remoteMappingContext) {
88         this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
89         this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
90         this.interfaceContext = checkNotNull(interfaceContext,
91                 "Interface naming context is null,for readers that don't need this dependency,use different constructor");
92         this.locatorSetContext = checkNotNull(locatorSetContext,
93                 "Locator set naming context is null,for readers that don't need this dependency,use different constructor");
94         this.bridgeDomainContext = checkNotNull(bridgeDomainContext,
95                 "Bridge domain naming context is null,for readers that don't need this dependency,use different constructor");
96         this.localMappingContext = checkNotNull(localMappingContext,
97                 "Local mappings reference is null,for readers that don't need this dependency use different constructor");
98         this.remoteMappingContext = checkNotNull(remoteMappingContext,
99                 "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
100     }
101 }