123aba59dceacd19be4d4b8f2252e472a42c6b6d
[hc2vpp.git] /
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 EidMappingContext localMappingContext;
39     protected EidMappingContext remoteMappingContext;
40
41     protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
42                                             @Nonnull final FutureJVppCore vppApi) {
43         this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
44         this.vppApi = checkNotNull(vppApi, "VPP api refference is null");
45     }
46
47     protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
48                                             @Nonnull final FutureJVppCore vppApi,
49                                             @Nonnull final NamingContext interfaceContext,
50                                             @Nonnull final EidMappingContext localMappingContext,
51                                             @Nonnull final EidMappingContext remoteMappingContext) {
52         this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
53         this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
54         this.interfaceContext = checkNotNull(interfaceContext,
55                 "Interface naming context is null,for readers that don't need this dependency,use different constructor");
56         this.localMappingContext = checkNotNull(localMappingContext,
57                 "Local mappings reference is null,for readers that don't need this dependency use different constructor");
58         this.remoteMappingContext = checkNotNull(remoteMappingContext,
59                 "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
60     }
61
62     protected AbstractLispReaderFactoryBase(@Nonnull final InstanceIdentifier<LispState> lispStateId,
63                                             @Nonnull final FutureJVppCore vppApi,
64                                             @Nonnull final NamingContext interfaceContext,
65                                             @Nonnull final NamingContext locatorSetContext,
66                                             @Nonnull final EidMappingContext localMappingContext,
67                                             @Nonnull final EidMappingContext remoteMappingContext) {
68         this.lispStateId = checkNotNull(lispStateId, "Lisp state identifier is null");
69         this.vppApi = checkNotNull(vppApi, "VPP api reference is null");
70         this.interfaceContext = checkNotNull(interfaceContext,
71                 "Interface naming context is null,for readers that don't need this dependency,use different constructor");
72         this.locatorSetContext = checkNotNull(locatorSetContext,
73                 "Locator set naming context is null,for readers that don't need this dependency,use different constructor");
74         this.localMappingContext = checkNotNull(localMappingContext,
75                 "Local mappings reference is null,for readers that don't need this dependency use different constructor");
76         this.remoteMappingContext = checkNotNull(remoteMappingContext,
77                 "Remote mappings reference is null,for readers that don't need this dependency use different constructor");
78     }
79 }