2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 Amdocs
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
21 package org.onap.aai.sparky.autosuggestion.sync;
23 import org.onap.aai.sparky.dal.ActiveInventoryAdapter;
24 import org.onap.aai.sparky.dal.rest.config.RestEndpointConfig;
25 import org.onap.aai.sparky.search.SearchServiceAdapter;
26 import org.onap.aai.sparky.search.filters.config.FiltersConfig;
27 import org.onap.aai.sparky.sync.ElasticSearchSchemaFactory;
28 import org.onap.aai.sparky.sync.IndexIntegrityValidator;
29 import org.onap.aai.sparky.sync.SyncControllerImpl;
30 import org.onap.aai.sparky.sync.SyncControllerRegistrar;
31 import org.onap.aai.sparky.sync.SyncControllerRegistry;
32 import org.onap.aai.sparky.sync.config.ElasticSearchSchemaConfig;
33 import org.onap.aai.sparky.sync.config.NetworkStatisticsConfig;
34 import org.onap.aai.sparky.sync.config.SyncControllerConfig;
36 public class VnfAliasSyncController extends SyncControllerImpl implements SyncControllerRegistrar {
38 private SyncControllerRegistry syncControllerRegistry;
40 public VnfAliasSyncController(SyncControllerConfig syncControllerConfig,
41 ActiveInventoryAdapter aaiAdapter, SearchServiceAdapter searchServiceAdapter,
42 ElasticSearchSchemaConfig schemaConfig, RestEndpointConfig endpointConfig,
43 NetworkStatisticsConfig aaiStatConfig, NetworkStatisticsConfig esStatConfig,
44 FiltersConfig filtersConfig,
45 ElasticSearchSchemaFactory elasticSearchSchemaFactory) throws Exception {
46 super(syncControllerConfig);
48 // final String controllerName = "VNFs Alias Suggestion Synchronizer";
50 IndexIntegrityValidator indexValidator = new IndexIntegrityValidator(searchServiceAdapter, schemaConfig,
51 endpointConfig, elasticSearchSchemaFactory.getIndexSchema(schemaConfig));
53 registerIndexValidator(indexValidator);
55 VnfAliasSuggestionSynchronizer synchronizer = new VnfAliasSuggestionSynchronizer(schemaConfig,
56 syncControllerConfig.getNumInternalSyncWorkers(),
57 syncControllerConfig.getNumSyncActiveInventoryWorkers(),
58 syncControllerConfig.getNumSyncElasticWorkers(), aaiStatConfig, esStatConfig, filtersConfig);
60 synchronizer.setAaiAdapter(aaiAdapter);
61 synchronizer.setSearchServiceAdapter(searchServiceAdapter);
63 registerEntitySynchronizer(synchronizer);
67 public SyncControllerRegistry getSyncControllerRegistry() {
68 return syncControllerRegistry;
71 public void setSyncControllerRegistry(SyncControllerRegistry syncControllerRegistry) {
72 this.syncControllerRegistry = syncControllerRegistry;
76 public void registerController() {
78 if ( syncControllerRegistry != null ) {
79 if ( syncControllerConfig.isEnabled()) {
80 syncControllerRegistry.registerSyncController(this);