diff options
author | Ofir Sonsino <os0695@att.com> | 2018-01-31 17:19:00 +0200 |
---|---|---|
committer | Ofir Sonsino <os0695@att.com> | 2018-01-31 17:19:00 +0200 |
commit | 1cfb08779ea0e00be69e072a940b3063e049fe6b (patch) | |
tree | 6602a900387c8393ed0dcd81c0539381632903c6 /vid-app-common/src/main/java/org/openecomp/vid/scheduler | |
parent | 2f20b001b9243e0f8b44aecc768ec265fd538732 (diff) |
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d
Issue-ID: VID-86
Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/openecomp/vid/scheduler')
17 files changed, 0 insertions, 840 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObject.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObject.java deleted file mode 100644 index 57b36830..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObject.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.vid.scheduler; - - -public class RestObject<T> { - - private T t; - - private int statusCode= 0; - - public String uuid; - - public void set(T t) { this.t = t; } - - public T get() { return t; } - - public void setStatusCode(int v) { this.statusCode = v; } - - public int getStatusCode() { return this.statusCode; } - - public void setUUID(String uuid) { this.uuid = uuid; } - - public String getUUID() { return this.uuid; } -} - diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/GetTimeSlotsRestObject.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/GetTimeSlotsRestObject.java deleted file mode 100644 index 614b557a..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/GetTimeSlotsRestObject.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -public class GetTimeSlotsRestObject<T> extends org.openecomp.vid.scheduler.RestObject<T> { - - public String uuid; - - public void setUUID(String uuid) { this.uuid = uuid; } - - public String getUUID() { return this.uuid; } - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/PostCreateNewVnfRestObject.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/PostCreateNewVnfRestObject.java deleted file mode 100644 index 86cbab8a..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/PostCreateNewVnfRestObject.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -public class PostCreateNewVnfRestObject<T> extends RestObject<T> { - - public String uuid; - - public void setUUID(String uuid) { this.uuid = uuid; } - - public String getUUID() { return this.uuid; } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObject.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObject.java deleted file mode 100644 index 6fb56f67..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/PostSubmitVnfChangeRestObject.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.openecomp.vid.scheduler.RestObjects; - -public class PostSubmitVnfChangeRestObject<T> extends RestObject<T> { - - public String uuid; - - public void setUUID(String uuid) { this.uuid = uuid; } - - public String getUUID() { return this.uuid; } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/RestObject.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/RestObject.java deleted file mode 100644 index 2d0eec74..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/RestObjects/RestObject.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.vid.scheduler.RestObjects; - - -public class RestObject<T> { - - private T t; - - private int statusCode= 0; - - public void set(T t) { this.t = t; } - - public T get() { return t; } - - public void setStatusCode(int v) { this.statusCode = v; } - - public int getStatusCode() { return this.statusCode; } - -} - diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerProperties.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerProperties.java deleted file mode 100644 index 15855b7b..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerProperties.java +++ /dev/null @@ -1,24 +0,0 @@ -package org.openecomp.vid.scheduler; - -import org.openecomp.portalsdk.core.util.SystemProperties; - - -public class SchedulerProperties extends SystemProperties { - - public static final String SCHEDULER_USER_NAME_VAL = "scheduler.user.name"; - - public static final String SCHEDULER_PASSWORD_VAL = "scheduler.password"; - - public static final String SCHEDULER_SERVER_URL_VAL = "scheduler.server.url"; - - public static final String SCHEDULER_CREATE_NEW_VNF_CHANGE_INSTANCE_VAL = "scheduler.create.new.vnf.change.instance"; - - public static final String SCHEDULER_GET_TIME_SLOTS = "scheduler.get.time.slots"; - - public static final String SCHEDULER_SUBMIT_NEW_VNF_CHANGE = "scheduler.submit.new.vnf.change"; - - public static final String SCHEDULER_GET_SCHEDULES = "scheduler.get.schedules"; - - public static final String GET_VERSION_BY_INVARIANT_ID = "aai_get_version_by_invariant_id"; - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrapper.java deleted file mode 100644 index 5f148c06..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrapper.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.openecomp.vid.scheduler; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.apache.commons.lang.builder.ToStringBuilder; - -/** - * This wrapper encapsulates the Scheduler response - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "status", - "entity", - "uuid" -}) - -public class SchedulerResponseWrapper { - - @JsonProperty("status") - private int status; - - @JsonProperty("entity") - private String entity; - - @JsonProperty("uuid") - private String uuid; - - @JsonProperty("entity") - public String getEntity() { - return entity; - } - - @JsonProperty("status") - public int getStatus() { - return status; - } - - @JsonProperty("uuid") - public String getUuid() { - return uuid; - } - - @JsonProperty("status") - public void setStatus(int v) { - this.status = v; - } - - @JsonProperty("entity") - public void setEntity(String v) { - this.entity = v; - } - - @JsonProperty("uuid") - public void setUuid(String v) { - this.uuid = v; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - b.append(getStatus()).append(", \"entity\": \" " ).append(this.getEntity()).append("\" ,\"uuid\": \"" ).append(this.getUuid()).append("\"}"); - return (b.toString()); - } - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/GetTimeSlotsWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/GetTimeSlotsWrapper.java deleted file mode 100644 index e5001d41..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/GetTimeSlotsWrapper.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -public class GetTimeSlotsWrapper extends SchedulerResponseWrapper { - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapper.java deleted file mode 100644 index f1baeaf6..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostCreateNewVnfWrapper.java +++ /dev/null @@ -1,39 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "uuid" -}) -public class PostCreateNewVnfWrapper extends SchedulerResponseWrapper { - - @JsonProperty("uuid") - private String uuid; - - @JsonProperty("uuid") - public String getUuid() { - return uuid; - } - - @JsonProperty("uuid") - public void setUuid(String v) { - this.uuid = v; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - b.append(getStatus()).append(", \"entity\": \" " ).append(this.getEntity()).append("\" ,\"uuid\": \"" ).append(this.getUuid()).append("\"}"); - return (b.toString()); - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapper.java deleted file mode 100644 index 86e4c0a7..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/PostSubmitVnfChangeTimeSlotsWrapper.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -import org.apache.commons.lang.builder.ToStringBuilder; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; - -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "uuid" -}) -public class PostSubmitVnfChangeTimeSlotsWrapper extends SchedulerResponseWrapper { - @JsonProperty("uuid") - private String uuid; - - @JsonProperty("uuid") - public String getUuid() { - return uuid; - } - - @JsonProperty("uuid") - public void setUuid(String v) { - this.uuid = v; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - b.append(getStatus()).append(", \"entity\": \" " ).append(this.getEntity()).append("\" ,\"uuid\": \"" ).append(this.getUuid()).append("\"}"); - return (b.toString()); - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapper.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapper.java deleted file mode 100644 index 081ed3dc..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerResponseWrappers/SchedulerResponseWrapper.java +++ /dev/null @@ -1,57 +0,0 @@ -package org.openecomp.vid.scheduler.SchedulerResponseWrappers; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.apache.commons.lang.builder.ToStringBuilder; - -/** - * This wrapper encapsulates the Scheduler response - */ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "status", - "entity" -}) - -public class SchedulerResponseWrapper { - - @JsonProperty("status") - private int status; - - @JsonProperty("entity") - private String entity; - - @JsonProperty("entity") - public String getEntity() { - return entity; - } - - @JsonProperty("status") - public int getStatus() { - return status; - } - - @JsonProperty("status") - public void setStatus(int v) { - this.status = v; - } - - @JsonProperty("entity") - public void setEntity(String v) { - this.entity = v; - } - - @Override - public String toString() { - return ToStringBuilder.reflectionToString(this); - } - - public String getResponse () { - - StringBuilder b = new StringBuilder ("{ \"status\": "); - - b.append(getStatus()).append(", \"entity\": " ).append(this.getEntity()).append("}"); - return (b.toString()); - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInt.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInt.java deleted file mode 100644 index 32b3a9c8..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInt.java +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.vid.scheduler; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; - -public class SchedulerRestInt { - - /** The logger. */ - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerRestInterface.class); - - /** The Constant dateFormat. */ - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - /** The request date format. */ - public DateFormat requestDateFormat = new SimpleDateFormat("EEE, dd MMM YYYY HH:mm:ss z"); - - public SchedulerRestInt() { - requestDateFormat.setTimeZone(java.util.TimeZone.getTimeZone("GMT")); - } -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterface.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterface.java deleted file mode 100644 index 5f529f39..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterface.java +++ /dev/null @@ -1,208 +0,0 @@ -package org.openecomp.vid.scheduler; - -import java.util.Collections; -import javax.ws.rs.client.Client; -import javax.ws.rs.client.Entity; -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.MultivaluedHashMap; -import javax.ws.rs.core.Response; - -import org.apache.commons.codec.binary.Base64; -import org.eclipse.jetty.util.security.Password; -import org.json.simple.JSONObject; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.openecomp.vid.client.HttpBasicClient; -import org.openecomp.vid.client.HttpsBasicClient; -import org.openecomp.vid.scheduler.SchedulerProperties; -import org.openecomp.vid.scheduler.RestObjects.RestObject; -import org.springframework.stereotype.Service; - -@Service -public class SchedulerRestInterface implements SchedulerRestInterfaceIfc { - - private static Client client = null; - - private MultivaluedHashMap<String, Object> commonHeaders; - - /** The logger. */ - static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerRestInterface.class); - - public SchedulerRestInterface() { - super(); - } - - public void initRestClient() - { - System.out.println( "\t <== Starting to initialize rest client "); - - final String username; - final String password; - - /*Setting user name based on properties*/ - String retrievedUsername = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_USER_NAME_VAL); - if(retrievedUsername.isEmpty()) { - username = ""; - } else { - username = retrievedUsername; - } - - /*Setting password based on properties*/ - String retrievedPassword = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_PASSWORD_VAL); - if(retrievedPassword.isEmpty()) { - password = ""; - } else { - if (retrievedPassword.contains("OBF:")) { - password = Password.deobfuscate(retrievedPassword); - } else { - password = retrievedPassword; - } - } - - String authString = username + ":" + password; - - byte[] authEncBytes = Base64.encodeBase64(authString.getBytes()); - String authStringEnc = new String(authEncBytes); - - commonHeaders = new MultivaluedHashMap<String, Object> (); - commonHeaders.put("Authorization", Collections.singletonList((Object) ("Basic " + authStringEnc))); - - try { - if ( !username.isEmpty() ) { - - client = HttpsBasicClient.getClient(); - } - else { - - client = HttpBasicClient.getClient(); - } - } catch (Exception e) { - System.out.println( " <== Unable to initialize rest client "); - } - - System.out.println( "\t<== Client Initialized \n"); - } - - @SuppressWarnings("unchecked") - public <T> void Get (T t, String sourceId, String path, org.openecomp.vid.scheduler.RestObject<T> restObject ) throws Exception { - - String methodName = "Get"; - String url = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; - - - System.out.println( "<== URL FOR GET : " + url + "\n"); - - initRestClient(); - - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - .get(); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if (status == 200) { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - - } else { - throw new Exception(methodName + " with status="+ status + ", url= " + url ); - } - - return; - } - - @SuppressWarnings("unchecked") - public <T> void Post(T t, JSONObject requestDetails, String path, RestObject<T> restObject) throws Exception { - - String methodName = "Post"; - String url = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; - - System.out.println( "<== URL FOR POST : " + url + "\n"); - - try { - - initRestClient(); - - // Change the content length - final Response cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - .post(Entity.entity(requestDetails, MediaType.APPLICATION_JSON)); - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - - System.out.println("<== " + methodName + " : No response entity, this is probably ok, e=" + e.getMessage()); - } - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - if ( status >= 200 && status <= 299 ) { - - System.out.println( "<== " + methodName + " : REST api POST was successful!" + "\n"); - - } else { - System.out.println( "<== " + methodName + " : FAILED with http status : "+status+", url = " + url + "\n"); - } - - } catch (Exception e) - { - System.out.println( "<== " + methodName + " : with url="+url+ ", Exception: " + e.toString() + "\n"); - throw e; - } - } - - @Override - public void logRequest(JSONObject requestDetails) {} - - @SuppressWarnings("unchecked") - public <T> void Delete(T t, JSONObject requestDetails, String sourceID, String path, RestObject<T> restObject) { - - String url=""; - Response cres = null; - - try { - initRestClient(); - - url = SystemProperties.getProperty(SchedulerProperties.SCHEDULER_SERVER_URL_VAL) + path; - - cres = client.target(url) - .request() - .accept("application/json") - .headers(commonHeaders) - //.entity(r) - .build("DELETE", Entity.entity(requestDetails, MediaType.APPLICATION_JSON)).invoke(); - // .method("DELETE", Entity.entity(r, MediaType.APPLICATION_JSON)); - //.delete(Entity.entity(r, MediaType.APPLICATION_JSON)); - - int status = cres.getStatus(); - restObject.setStatusCode (status); - - try { - t = (T) cres.readEntity(t.getClass()); - restObject.set(t); - } - catch ( Exception e ) { - } - - } - catch (Exception e) - { - throw e; - } - } - - public <T> T getInstance(Class<T> clazz) throws IllegalAccessException, InstantiationException - { - return clazz.newInstance(); - } - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceFactory.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceFactory.java deleted file mode 100644 index bf7bd889..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceFactory.java +++ /dev/null @@ -1,15 +0,0 @@ - -package org.openecomp.vid.scheduler; - -public class SchedulerRestInterfaceFactory { - - - public static SchedulerRestInterfaceIfc getInstance () { - SchedulerRestInterfaceIfc obj = null; - - obj = new SchedulerRestInterface(); - - return ( obj ); - } - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceIfc.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceIfc.java deleted file mode 100644 index 839ab348..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerRestInterfaceIfc.java +++ /dev/null @@ -1,21 +0,0 @@ - -package org.openecomp.vid.scheduler; - -import org.json.simple.JSONObject; -import org.openecomp.vid.scheduler.RestObjects.RestObject; -import org.springframework.stereotype.Service; - -@Service -public interface SchedulerRestInterfaceIfc { - - public void initRestClient(); - - public <T> void Get (T t, String sourceId, String path, org.openecomp.vid.scheduler.RestObject<T> restObject ) throws Exception; - - public <T> void Delete(T t, JSONObject requestDetails, String sourceID, String path, RestObject<T> restObject) - throws Exception; - - public <T> void Post(T t, JSONObject r, String path, RestObject<T> restObject) throws Exception; - - public void logRequest(JSONObject requestDetails); -}
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerUtil.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerUtil.java deleted file mode 100644 index f82f474f..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/SchedulerUtil.java +++ /dev/null @@ -1,100 +0,0 @@ -package org.openecomp.vid.scheduler; - -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Date; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.vid.scheduler.SchedulerResponseWrappers.GetTimeSlotsWrapper; -import org.openecomp.vid.scheduler.SchedulerResponseWrappers.PostCreateNewVnfWrapper; -import org.openecomp.vid.scheduler.SchedulerResponseWrappers.PostSubmitVnfChangeTimeSlotsWrapper; -import org.openecomp.vid.scheduler.SchedulerUtil; -import org.openecomp.vid.scheduler.RestObjects.GetTimeSlotsRestObject; -import org.openecomp.vid.scheduler.RestObjects.PostCreateNewVnfRestObject; -import org.openecomp.vid.scheduler.RestObjects.PostSubmitVnfChangeRestObject; - -import com.fasterxml.jackson.databind.ObjectMapper; - -public class SchedulerUtil { - - private static EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(SchedulerUtil.class); - - final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS"); - - public static GetTimeSlotsWrapper getTimeSlotsWrapResponse (GetTimeSlotsRestObject<String> rs) { - - String resp_str = ""; - int status = 0; - - if ( rs != null ) { - resp_str = rs.get(); - status = rs.getStatusCode(); - } - - GetTimeSlotsWrapper w = new GetTimeSlotsWrapper(); - - w.setEntity(resp_str); - w.setStatus (status); - - return (w); - } - - public static PostSubmitVnfChangeTimeSlotsWrapper postSubmitNewVnfWrapResponse (PostSubmitVnfChangeRestObject<String> rs) { - - String resp_str = ""; - int status = 0; - String uuid = ""; - - if ( rs != null ) { - resp_str = rs.get(); - status = rs.getStatusCode(); - uuid = rs.getUUID(); - } - - PostSubmitVnfChangeTimeSlotsWrapper w = new PostSubmitVnfChangeTimeSlotsWrapper(); - - w.setEntity(resp_str); - w.setStatus (status); - w.setUuid(uuid); - - return (w); - } - - public static PostCreateNewVnfWrapper postCreateNewVnfWrapResponse (PostCreateNewVnfRestObject<String> rs) { - - String resp_str = ""; - int status = 0; - String uuid = ""; - - if ( rs != null ) { - resp_str = rs.get(); - status = rs.getStatusCode(); - uuid = rs.getUUID(); - } - - PostCreateNewVnfWrapper w = new PostCreateNewVnfWrapper(); - - w.setEntity(resp_str); - w.setStatus (status); - w.setUuid(uuid); - - return (w); - } - - public static <T> String convertPojoToString ( T t ) throws com.fasterxml.jackson.core.JsonProcessingException { - - String methodName = "convertPojoToString"; - ObjectMapper mapper = new ObjectMapper(); - String r_json_str = ""; - if ( t != null ) { - try { - r_json_str = mapper.writeValueAsString(t); - } - catch ( com.fasterxml.jackson.core.JsonProcessingException j ) { - logger.debug(EELFLoggerDelegate.debugLogger,dateFormat.format(new Date()) + "<== " + methodName + " Unable to parse object as json"); - } - } - return (r_json_str); - } - -} diff --git a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/rest/RequestDetails.java b/vid-app-common/src/main/java/org/openecomp/vid/scheduler/rest/RequestDetails.java deleted file mode 100644 index 746fd9b2..00000000 --- a/vid-app-common/src/main/java/org/openecomp/vid/scheduler/rest/RequestDetails.java +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * VID - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.vid.scheduler.rest; - -import java.util.HashMap; -import java.util.Map; -import java.util.List; -//import javax.annotation.Generated; - -import org.openecomp.vid.domain.mso.CloudConfiguration; -import org.openecomp.vid.domain.mso.ModelInfo; -import org.openecomp.vid.domain.mso.RequestInfo; -import org.openecomp.vid.domain.mso.RequestParameters; -import org.openecomp.vid.domain.mso.SubscriberInfo; -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import org.apache.commons.lang.builder.EqualsBuilder; -import org.apache.commons.lang.builder.HashCodeBuilder; -import org.apache.commons.lang.builder.ToStringBuilder; - -/* - * "domain" : "ChangeManagement", - "scheduleId" : "3569b875-d40e-4adb-a288-a74f4b59ec1c", - "scheduleName" : "VnfUpgrade/DWF", - "userId" : "jf9860@att.com", - "domainData" : { - "WorkflowName" : "HEAT Stack Software Update for vNFs" - }, - "status" : "PendingOptimization", - "schedulingInfo" : { - "scheduleId" : "ChangeManagement.3569b875-d40e-4adb-a288-a74f4b59ec1c", - "normalDurationInSecs" : 60, - "AdditionalDurationInSecs" : 0, - "concurrencyLimit" : 10, - "policyId" : ["SNIRO.TimeLimitAndVerticalTopology"], - "groups" : [{ - "groupId" : " group1", - "node" : ["satmo415vbc", "satmo455vbc"], - "changeWindows" : [{ - "startTime" : "2017-02-15T01:00:00Z", - "finishTime" : "2017-02-15T02:00:00Z" - } - ] - }, { - "groupId" : " group2", - "node" : ["satmo555vbc"], - "changeWindows" : [{ - "startTime" : "2017-02-15T01:00:00Z", - "finishTime" : "2017-02-15T02:00:00Z" - }, { - "startTime" : "2017-02-15T05:00:00Z", - "finishTime" : "2017-02-15T05:30:00Z" - } - ] - } - ] -*/ -@JsonInclude(JsonInclude.Include.NON_NULL) -@JsonPropertyOrder({ - "domain", - "scheduleId", - "scheduleName", - "userId", - "domainData", - "status", - "schcedulingInfo" -}) -public class RequestDetails { - - @JsonProperty("domain") - private String domain; - - - - @JsonProperty("domain") - public String getDomain() { - return domain; - } - - @JsonProperty("domain") - public void setDomain(String domain) { - this.domain = domain; - } -} |