2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.mso.apihandlerinfra.tenantisolation;
\r
23 import org.openecomp.mso.apihandlerinfra.Constants;
\r
24 import org.openecomp.mso.apihandlerinfra.tenantisolation.process.OperationalEnvironmentProcess;
\r
25 import org.openecomp.mso.apihandlerinfra.tenantisolationbeans.Action;
\r
26 import org.openecomp.mso.logger.MessageEnum;
\r
27 import org.openecomp.mso.logger.MsoLogger;
\r
28 import org.openecomp.mso.requestsdb.RequestsDBHelper;
\r
30 public class TenantIsolationRunnable implements Runnable {
\r
32 private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH);
\r
33 private OperationalEnvironmentProcessFactory factory = null;
\r
34 private Action action;
\r
35 private String operationalEnvType;
\r
36 private CloudOrchestrationRequest cor;
\r
37 private String requestId;
\r
38 protected RequestsDBHelper requestDb;
\r
42 msoLogger.debug ("Starting threadExecution in TenantIsolationRunnable for Action " + action.name() + " and OperationalEnvType: " + operationalEnvType);
\r
44 OperationalEnvironmentProcess isolation = getFactory().getOperationalEnvironmentProcess(action, operationalEnvType, cor, requestId);
\r
45 isolation.execute();
\r
46 } catch(Exception e) {
\r
47 msoLogger.debug ("Exception during Thread initiation: ", e);
\r
48 msoLogger.error (MessageEnum.APIH_GENERAL_EXCEPTION, Constants.MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.UnknownError, null, e);
\r
49 getRequestDb().updateInfraFailureCompletion(e.getMessage(), requestId, cor.getOperationalEnvironmentId());
\r
53 public Action getAction() {
\r
57 public void setAction(Action action) {
\r
58 this.action = action;
\r
61 public String getOperationalEnvType() {
\r
62 return operationalEnvType;
\r
65 public void setOperationalEnvType(String operationalEnvType) {
\r
66 this.operationalEnvType = operationalEnvType;
\r
69 public CloudOrchestrationRequest getCor() {
\r
73 public void setCor(CloudOrchestrationRequest cor) {
\r
77 public String getRequestId() {
\r
81 public void setRequestId(String requestId) {
\r
82 this.requestId = requestId;
\r
85 public OperationalEnvironmentProcessFactory getFactory() {
\r
86 if(factory == null) {
\r
87 factory = new OperationalEnvironmentProcessFactory();
\r
92 public void setFactory(OperationalEnvironmentProcessFactory factory) {
\r
93 this.factory = factory;
\r
96 protected RequestsDBHelper getRequestDb() {
\r
97 if(requestDb == null) {
\r
98 requestDb = new RequestsDBHelper();
\r
103 protected void setRequestsDBHelper(RequestsDBHelper helper) {
\r
104 this.requestDb = helper;
\r