From 025301d08b061482c1f046d562bf017c8cbcfe8d Mon Sep 17 00:00:00 2001 From: ChrisC Date: Tue, 31 Jan 2017 11:40:03 +0100 Subject: Initial OpenECOMP MSO commit Change-Id: Ia6a7574859480717402cc2f22534d9973a78fa6d Signed-off-by: ChrisC --- .../adapters/requestsdb/HealthCheckHandler.java | 60 +++++ .../adapters/requestsdb/MsoRequestsDbAdapter.java | 58 +++++ .../requestsdb/MsoRequestsDbAdapterImpl.java | 246 +++++++++++++++++++++ .../mso/adapters/requestsdb/RequestStatusType.java | 69 ++++++ .../mso/adapters/requestsdb/ResponseStatus.java | 33 +++ .../openecomp/mso/adapters/requestsdb/Status.java | 40 ++++ .../exceptions/MsoRequestsDbException.java | 62 ++++++ .../exceptions/MsoRequestsDbExceptionBean.java | 48 ++++ .../src/main/java/resources/application.properties | 28 +++ 9 files changed, 644 insertions(+) create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/RequestStatusType.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/ResponseStatus.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/Status.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java create mode 100644 adapters/mso-requests-db-adapter/src/main/java/resources/application.properties (limited to 'adapters/mso-requests-db-adapter/src/main/java') diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java new file mode 100644 index 0000000000..22fcdda416 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/HealthCheckHandler.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.mso.adapters.requestsdb; + + +import javax.ws.rs.GET; +import javax.ws.rs.HEAD; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.QueryParam; +import javax.ws.rs.core.Response; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.HealthCheckUtils; +import org.openecomp.mso.utils.UUIDChecker; + + +@Path("/") + public class HealthCheckHandler { + + private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA); + + @HEAD + @GET + @Path("/healthcheck") + @Produces("text/html") + public Response healthcheck (@QueryParam("requestId") String requestId) { + long startTime = System.currentTimeMillis (); + MsoLogger.setServiceName ("Healthcheck"); + UUIDChecker.verifyOldUUID(requestId, msoLogger); + HealthCheckUtils healthCheck = new HealthCheckUtils (); + if (!healthCheck.siteStatusCheck(msoLogger, startTime)) { + return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE; + } + + if (!healthCheck.requestDBCheck (msoLogger, startTime)) { + return HealthCheckUtils.NOT_STARTED_RESPONSE; + } + msoLogger.debug("healthcheck - Successful"); + return HealthCheckUtils.HEALTH_CHECK_RESPONSE; + } + +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java new file mode 100644 index 0000000000..5b4009fb77 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapter.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.mso.adapters.requestsdb; + +import javax.jws.WebMethod; +import javax.jws.WebParam; +import javax.jws.WebService; +import javax.xml.bind.annotation.XmlElement; + +import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException; +import org.openecomp.mso.requestsdb.InfraActiveRequests; +import org.openecomp.mso.requestsdb.SiteStatus; + +/** + * MSO Request DB Adapter Web Service + */ +@WebService(name = "RequestsDbAdapter", targetNamespace = "http://com.att.mso/requestsdb") +public interface MsoRequestsDbAdapter { + + @WebMethod + public void updateInfraRequest (@WebParam(name = "requestId") @XmlElement(required = true) String requestId, + @WebParam(name = "lastModifiedBy") @XmlElement(required = true) String lastModifiedBy, + @WebParam(name = "statusMessage") @XmlElement(required = false) String statusMessage, + @WebParam(name = "responseBody") @XmlElement(required = false) String responseBody, + @WebParam(name = "requestStatus") @XmlElement(required = false) RequestStatusType requestStatus, + @WebParam(name = "progress") @XmlElement(required = false) String progress, + @WebParam(name = "vnfOutputs") @XmlElement(required = false) String vnfOutputs, + @WebParam(name = "serviceInstanceId") @XmlElement(required = false) String serviceInstanceId, + @WebParam(name = "networkId") @XmlElement(required = false) String networkId, + @WebParam(name = "vnfId") @XmlElement(required = false) String vnfId, + @WebParam(name = "vfModuleId") @XmlElement(required = false) String vfModuleId, + @WebParam(name = "volumeGroupId") @XmlElement(required = false) String volumeGroupId) throws MsoRequestsDbException; + + @WebMethod + public InfraActiveRequests getInfraRequest (@WebParam(name="requestId") @XmlElement(required = true) String requestId) throws MsoRequestsDbException; + + @WebMethod + public boolean getSiteStatus (@WebParam(name="siteName") @XmlElement(required = true) String siteName); + +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java new file mode 100644 index 0000000000..e1b752af24 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/MsoRequestsDbAdapterImpl.java @@ -0,0 +1,246 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.mso.adapters.requestsdb; + +import java.sql.Timestamp; +import java.util.List; + +import javax.jws.WebService; + +import org.openecomp.mso.requestsdb.SiteStatus; +import org.openecomp.mso.utils.UUIDChecker; +import org.hibernate.HibernateException; +import org.hibernate.Query; +import org.hibernate.Session; + +import org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbException; +import org.openecomp.mso.logger.MessageEnum; +import org.openecomp.mso.logger.MsoLogger; +import org.openecomp.mso.requestsdb.HibernateUtil; +import org.openecomp.mso.requestsdb.InfraActiveRequests; + +@WebService(serviceName = "RequestsDbAdapter", endpointInterface = "org.openecomp.mso.adapters.requestsdb.MsoRequestsDbAdapter", targetNamespace = "http://com.att.mso/requestsdb") +public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter { + + private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + + @Override + public void updateInfraRequest (String requestId, + String lastModifiedBy, + String statusMessage, + String responseBody, + RequestStatusType requestStatus, + String progress, + String vnfOutputs, + String serviceInstanceId, + String networkId, + String vnfId, + String vfModuleId, + String volumeGroupId) throws MsoRequestsDbException { + MsoLogger.setLogContext (requestId, null); + Session session = HibernateUtil.getSessionFactory ().openSession (); + int result = 0; + long startTime = System.currentTimeMillis (); + try { + session.beginTransaction (); + String queryString = "update InfraActiveRequests set "; + if (statusMessage != null) { + queryString += "statusMessage = :statusMessage, "; + } + if (responseBody != null) { + queryString += "responseBody = :responseBody, "; + } + if (requestStatus != null) { + queryString += "requestStatus = :requestStatus, "; + } + if (progress != null) { + queryString += "progress = :progress, "; + } + if (vnfOutputs != null) { + queryString += "vnfOutputs = :vnfOutputs, "; + } + if (serviceInstanceId != null) { + queryString += "serviceInstanceId = :serviceInstanceId, "; + } + if (networkId != null) { + queryString += "networkId = :networkId, "; + } + if (vnfId != null) { + queryString += "vnfId = :vnfId, "; + } + if (vfModuleId != null) { + queryString += "vfModuleId = :vfModuleId, "; + } + if (volumeGroupId != null) { + queryString += "volumeGroupId = :volumeGroupId, "; + } + if (requestStatus == RequestStatusType.COMPLETE || requestStatus == RequestStatusType.FAILED) { + queryString += "endTime = :endTime, "; + } else { + queryString += "modifyTime = :modifyTime, "; + } + queryString += "lastModifiedBy = :lastModifiedBy where requestId = :requestId OR clientRequestId = :requestId"; + + LOGGER.debug("Executing update: " + queryString); + + Query query = session.createQuery (queryString); + query.setParameter ("requestId", requestId); + if (statusMessage != null) { + query.setParameter ("statusMessage", statusMessage); + LOGGER.debug ("StatusMessage in updateInfraRequest is set to: " + statusMessage); + } + if (responseBody != null) { + query.setParameter ("responseBody", responseBody); + LOGGER.debug ("ResponseBody in updateInfraRequest is set to: " + responseBody); + } + if (requestStatus != null) { + query.setParameter ("requestStatus", requestStatus.toString ()); + LOGGER.debug ("RequestStatus in updateInfraRequest is set to: " + requestStatus.toString()); + } + + if (progress != null) { + query.setParameter ("progress", Long.parseLong (progress)); + LOGGER.debug ("Progress in updateInfraRequest is set to: " + progress); + } + if (vnfOutputs != null) { + query.setParameter ("vnfOutputs", vnfOutputs); + LOGGER.debug ("VnfOutputs in updateInfraRequest is set to: " + vnfOutputs); + } + if (serviceInstanceId != null) { + query.setParameter ("serviceInstanceId", serviceInstanceId); + LOGGER.debug ("ServiceInstanceId in updateInfraRequest is set to: " + serviceInstanceId); + } + if (networkId != null) { + query.setParameter ("networkId", networkId); + LOGGER.debug ("NetworkId in updateInfraRequest is set to: " + networkId); + } + if (vnfId != null) { + query.setParameter ("vnfId", vnfId); + LOGGER.debug ("VnfId in updateInfraRequest is set to: " + vnfId); + } + if (vfModuleId != null) { + query.setParameter ("vfModuleId", vfModuleId); + LOGGER.debug ("vfModuleId in updateInfraRequest is set to: " + vfModuleId); + } + if (volumeGroupId != null) { + query.setParameter ("volumeGroupId", volumeGroupId); + LOGGER.debug ("VolumeGroupId in updateInfraRequest is set to: " + volumeGroupId); + } + Timestamp nowTimeStamp = new Timestamp (System.currentTimeMillis ()); + if (requestStatus == RequestStatusType.COMPLETE || requestStatus == RequestStatusType.FAILED) { + query.setParameter ("endTime", nowTimeStamp); + LOGGER.debug ("EndTime in updateInfraRequest is set to: " + nowTimeStamp); + } else { + query.setParameter ("modifyTime", nowTimeStamp); + LOGGER.debug ("ModifyTime in updateInfraRequest is set to: " + nowTimeStamp); + } + query.setParameter ("lastModifiedBy", lastModifiedBy); + LOGGER.debug ("LastModifiedBy in updateInfraRequest is set to: " + lastModifiedBy); + result = query.executeUpdate (); + checkIfExists (result, requestId, startTime); + session.getTransaction ().commit (); + } catch (HibernateException e) { + String error = "Unable to update MSO Requests DB: " + e.getMessage (); + LOGGER.error (MessageEnum.RA_CANT_UPDATE_REQUEST, "infra request parameters", requestId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); + throw new MsoRequestsDbException (error, e); + } finally { + if (session != null && session.isOpen ()) { + session.close (); + } + } + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + } + + + private void checkIfExists (int result, String requestId, long startTime) throws MsoRequestsDbException { + if (result == 0) { + String error = "Request ID does not exist in MSO Requests DB: " + requestId; + LOGGER.error (MessageEnum.RA_DB_REQUEST_NOT_EXIST, requestId, "", "", MsoLogger.ErrorCode.DataError, error); + throw new MsoRequestsDbException (error); + } + } + + + @Override + public InfraActiveRequests getInfraRequest (String requestId) throws MsoRequestsDbException { + long startTime = System.currentTimeMillis (); + MsoLogger.setLogContext (requestId, null); + Session session = HibernateUtil.getSessionFactory ().openSession (); + + LOGGER.debug ("Call to MSO Infra RequestsDb adapter get method with request Id: " + requestId); + + InfraActiveRequests request = null; + try { + session.beginTransaction (); + Query query = session.createQuery ("FROM InfraActiveRequests where requestId = :requestId OR clientRequestId = :requestId"); + query.setParameter ("requestId", requestId); + request = (InfraActiveRequests) query.uniqueResult(); + } catch (HibernateException e) { + String error = "Unable to retrieve MSO Infra Requests DB for Request ID " + + requestId; + LOGGER.error (MessageEnum.RA_DB_REQUEST_NOT_EXIST, "Get Infra request", requestId, "", "", MsoLogger.ErrorCode.BusinessProcesssError, "HibernateException - " + error, e); + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, error); + throw new MsoRequestsDbException (error, e); + } finally { + if (session != null && session.isOpen ()) { + session.close (); + } + } + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + return request; + } + + + /** + * Get SiteStatus by SiteName. + * + * @param siteName The unique name of the site + * @return Status of that site + */ + public boolean getSiteStatus (String siteName) { + UUIDChecker.generateUUID (LOGGER); + Session session = HibernateUtil.getSessionFactory ().openSession (); + + long startTime = System.currentTimeMillis (); + SiteStatus siteStatus = null; + LOGGER.debug ("Request database - get Site Status with Site name:" + siteName); + try { + String hql = "FROM SiteStatus WHERE siteName = :site_name"; + Query query = session.createQuery (hql); + query.setParameter ("site_name", siteName); + + siteStatus = (SiteStatus) query.uniqueResult (); + } finally { + if (session != null && session.isOpen ()) { + session.close (); + } + } + if (siteStatus == null) { + // if not exist in DB, it means the site is not disabled, thus return true + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + return true; + } else { + LOGGER.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful"); + return siteStatus.getStatus(); + } + } +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/RequestStatusType.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/RequestStatusType.java new file mode 100644 index 0000000000..706142f366 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/RequestStatusType.java @@ -0,0 +1,69 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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========================================================= + */ + +// +// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 +// See http://java.sun.com/xml/jaxb +// Any modifications to this file will be lost upon recompilation of the source schema. +// Generated on: 2015.07.24 at 11:49:17 AM EDT +// + + +package org.openecomp.mso.adapters.requestsdb; + + + +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlType; + + +/** + *

Java class for request-status-type. + * + *

The following schema fragment specifies the expected content contained within this class. + *

+ *

+ * <simpleType name="request-status-type">
+ *   <restriction base="{http://www.w3.org/2001/XMLSchema}string">
+ *     <enumeration value="COMPLETE"/>
+ *     <enumeration value="FAILED"/>
+ *     <enumeration value="IN_PROGRESS"/>
+ *   </restriction>
+ * </simpleType>
+ * 
+ * + */ +@XmlType(name = "request-status-type") +@XmlEnum +public enum RequestStatusType { + + COMPLETE, + FAILED, + IN_PROGRESS; + + public String value() { + return name(); + } + + public static RequestStatusType fromValue(String v) { + return valueOf(v); + } + +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/ResponseStatus.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/ResponseStatus.java new file mode 100644 index 0000000000..5b943e2aec --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/ResponseStatus.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.mso.adapters.requestsdb; + + + +/* + * Enum for Status values returned by API Handler to Tail-F +*/ +public enum ResponseStatus { + SENDING_FINAL_NOTIFY, + SUCCESS, + FAILED, + TIMEOUT +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/Status.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/Status.java new file mode 100644 index 0000000000..0b4db4bbc3 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/Status.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.mso.adapters.requestsdb; + + +/* + * Enum for Status values returned by API Handler to Tail-F +*/ +public enum Status { + PENDING, INPROGRESS, COMPLETED, FAILED, TIMEOUT; + + public boolean isFinished () { + switch (this) { + case COMPLETED: + case FAILED: + case TIMEOUT: + return true; + default: + return false; + } + } +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java new file mode 100644 index 0000000000..8e4fcf4083 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbException.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.mso.adapters.requestsdb.exceptions; + + + +import javax.xml.ws.WebFault; + +/** + * This class simply extends Exception (without addition additional functionality) + * to provide an identifier for RequestsDB related exceptions on create, delete, query. + * + * + */ +@WebFault (name="MsoRequestsDbException", faultBean="org.openecomp.mso.adapters.requestsdb.exceptions.MsoRequestsDbExceptionBean", targetNamespace="http://com.att.mso/requestsdb") +public class MsoRequestsDbException extends Exception { + + private static final long serialVersionUID = 1L; + + private MsoRequestsDbExceptionBean faultInfo; + + public MsoRequestsDbException (String msg) { + super(msg); + faultInfo = new MsoRequestsDbExceptionBean (msg); + } + + public MsoRequestsDbException (Throwable e) { + super(e); + faultInfo = new MsoRequestsDbExceptionBean (e.getMessage()); + } + + public MsoRequestsDbException (String msg, Throwable e) { + super (msg, e); + faultInfo = new MsoRequestsDbExceptionBean (msg); + } + + public MsoRequestsDbExceptionBean getFaultInfo() { + return faultInfo; + } + + public void setFaultInfo(MsoRequestsDbExceptionBean faultInfo) { + this.faultInfo = faultInfo; + } +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java new file mode 100644 index 0000000000..8701e5b06e --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/org/openecomp/mso/adapters/requestsdb/exceptions/MsoRequestsDbExceptionBean.java @@ -0,0 +1,48 @@ +/*- + * ============LICENSE_START======================================================= + * OPENECOMP - MSO + * ================================================================================ + * 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.mso.adapters.requestsdb.exceptions; + + +import java.io.Serializable; + +/** + * Jax-WS Fault Bean for MsoRequestsDB Exception + */ +public class MsoRequestsDbExceptionBean implements Serializable { + + private static final long serialVersionUID = 1360000062602372639L; + + private String message; + + public MsoRequestsDbExceptionBean () {} + + public MsoRequestsDbExceptionBean (String message) { + this.message = message; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/adapters/mso-requests-db-adapter/src/main/java/resources/application.properties b/adapters/mso-requests-db-adapter/src/main/java/resources/application.properties new file mode 100644 index 0000000000..c9345389c9 --- /dev/null +++ b/adapters/mso-requests-db-adapter/src/main/java/resources/application.properties @@ -0,0 +1,28 @@ +### +# ============LICENSE_START======================================================= +# ECOMP MSO +# ================================================================================ +# 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========================================================= +### + + +# -- welcome -- +welcomeTitle=JSF Blank Application + +welcomeHeading=Welcome! + +welcomeMessage=This is a JSF blank application. \ + You can find the application.properties file with this message in the src/resources folder. -- cgit 1.2.3-korg