2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017 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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.viewandinspect.sync;
25 import org.onap.aai.sparky.config.oxm.OxmEntityContainerLookup;
26 import org.onap.aai.sparky.config.oxm.OxmEntityLookup;
27 import org.onap.aai.sparky.config.oxm.SearchableEntityLookup;
28 import org.onap.aai.sparky.dal.ElasticSearchAdapter;
29 import org.onap.aai.sparky.dal.GizmoAdapter;
30 import org.onap.aai.sparky.sync.ElasticSearchIndexCleaner;
31 import org.onap.aai.sparky.sync.ElasticSearchSchemaFactory;
32 import org.onap.aai.sparky.sync.IndexCleaner;
33 import org.onap.aai.sparky.sync.IndexIntegrityValidator;
34 import org.onap.aai.sparky.sync.SyncControllerImpl;
35 import org.onap.aai.sparky.sync.SyncControllerRegistrar;
36 import org.onap.aai.sparky.sync.SyncControllerRegistry;
37 import org.onap.aai.sparky.sync.config.ElasticSearchEndpointConfig;
38 import org.onap.aai.sparky.sync.config.ElasticSearchSchemaConfig;
39 import org.onap.aai.sparky.sync.config.NetworkStatisticsConfig;
40 import org.onap.aai.sparky.sync.config.SyncControllerConfig;
42 public class ViewInspectGizmoSyncController extends SyncControllerImpl
43 implements SyncControllerRegistrar {
45 private SyncControllerRegistry syncControllerRegistry;
46 //private GizmoAdapter gizmoAdapter;
47 //private ElasticSearchAdapter esAdapter;
48 //private ElasticSearchSchemaConfig schemaConfig;
49 //private ElasticSearchEndpointConfig endpointConfig;
51 public ViewInspectGizmoSyncController(SyncControllerConfig syncControllerConfig,
52 GizmoAdapter gizmoAdapter, ElasticSearchAdapter esAdapter,
53 ElasticSearchSchemaConfig schemaConfig, ElasticSearchEndpointConfig endpointConfig,
54 NetworkStatisticsConfig gizmoStatConfig, NetworkStatisticsConfig esStatConfig,
55 OxmEntityLookup oxmEntityLookup,
56 SearchableEntityLookup searchableEntityLookup, OxmEntityContainerLookup oxmEntityContainerLookup) throws Exception {
57 super(syncControllerConfig);
59 // final String controllerName = "View and Inspect Entity Synchronizer";
61 //this.gizmoAdapter = gizmoAdapter;
62 //this.esAdapter = esAdapter;
63 //this.schemaConfig = schemaConfig;
64 //this.endpointConfig = endpointConfig;
66 IndexIntegrityValidator indexValidator = new IndexIntegrityValidator(esAdapter, schemaConfig,
67 endpointConfig, ElasticSearchSchemaFactory.getIndexSchema(schemaConfig));
69 registerIndexValidator(indexValidator);
71 ViewInspectGizmoEntitySynchronizer ses = new ViewInspectGizmoEntitySynchronizer(schemaConfig,
72 syncControllerConfig.getNumInternalSyncWorkers(),
73 syncControllerConfig.getNumSyncActiveInventoryWorkers(),
74 syncControllerConfig.getNumSyncElasticWorkers(), gizmoStatConfig, esStatConfig,
75 oxmEntityLookup, searchableEntityLookup, oxmEntityContainerLookup);
77 ses.setGizmoAdapter(gizmoAdapter);
78 ses.setElasticSearchAdapter(esAdapter);
80 registerEntitySynchronizer(ses);
82 IndexCleaner indexCleaner =
83 new ElasticSearchIndexCleaner(esAdapter, endpointConfig, schemaConfig);
85 registerIndexCleaner(indexCleaner);
89 public SyncControllerRegistry getSyncControllerRegistry() {
90 return syncControllerRegistry;
93 public void setSyncControllerRegistry(SyncControllerRegistry syncControllerRegistry) {
94 this.syncControllerRegistry = syncControllerRegistry;
98 public void registerController() {
99 if ( syncControllerRegistry != null ) {
100 if ( syncControllerConfig.isEnabled()) {
101 syncControllerRegistry.registerSyncController(this);