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,
57 ElasticSearchSchemaFactory elasticSearchSchemaFactory) throws Exception {
58 super(syncControllerConfig);
60 // final String controllerName = "View and Inspect Entity Synchronizer";
62 //this.gizmoAdapter = gizmoAdapter;
63 //this.esAdapter = esAdapter;
64 //this.schemaConfig = schemaConfig;
65 //this.endpointConfig = endpointConfig;
67 IndexIntegrityValidator indexValidator = new IndexIntegrityValidator(esAdapter, schemaConfig,
68 endpointConfig, elasticSearchSchemaFactory.getIndexSchema(schemaConfig));
70 registerIndexValidator(indexValidator);
72 ViewInspectGizmoEntitySynchronizer ses = new ViewInspectGizmoEntitySynchronizer(schemaConfig,
73 syncControllerConfig.getNumInternalSyncWorkers(),
74 syncControllerConfig.getNumSyncActiveInventoryWorkers(),
75 syncControllerConfig.getNumSyncElasticWorkers(), gizmoStatConfig, esStatConfig,
76 oxmEntityLookup, searchableEntityLookup, oxmEntityContainerLookup);
78 ses.setGizmoAdapter(gizmoAdapter);
79 ses.setElasticSearchAdapter(esAdapter);
81 registerEntitySynchronizer(ses);
83 IndexCleaner indexCleaner =
84 new ElasticSearchIndexCleaner(esAdapter, endpointConfig, schemaConfig);
86 registerIndexCleaner(indexCleaner);
90 public SyncControllerRegistry getSyncControllerRegistry() {
91 return syncControllerRegistry;
94 public void setSyncControllerRegistry(SyncControllerRegistry syncControllerRegistry) {
95 this.syncControllerRegistry = syncControllerRegistry;
99 public void registerController() {
100 if ( syncControllerRegistry != null ) {
101 if ( syncControllerConfig.isEnabled()) {
102 syncControllerRegistry.registerSyncController(this);