diff options
author | Gao, Chenfei (cg287m) <cgao@research.att.com> | 2017-06-22 14:48:41 -0400 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2017-06-29 12:50:23 -0400 |
commit | 68377161605e39c8c74ea77d0b504177480788f3 (patch) | |
tree | fb0fb8a27178da607866e1850f73ac056e046ee8 /appc/src | |
parent | f0c29b57e132e6335f0fa7bbad885d403e4c85df (diff) |
[POLICY-22] Reorganizing drools-apps
Change-Id: I5f9bb3908f8d55c466dd847ae5e01a424e9ba364
Signed-off-by: Gao, Chenfei (cg287m) <chenfei.gao11@gmail.com>
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'appc/src')
8 files changed, 0 insertions, 734 deletions
diff --git a/appc/src/main/java/org/openecomp/policy/appc/CommonHeader.java b/appc/src/main/java/org/openecomp/policy/appc/CommonHeader.java deleted file mode 100644 index dd743099c..000000000 --- a/appc/src/main/java/org/openecomp/policy/appc/CommonHeader.java +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.policy.appc; - -import java.io.Serializable; -import java.time.Instant; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; -import java.util.UUID; - -public class CommonHeader implements Serializable { - - private static final long serialVersionUID = -3581658269910980336L; - - public Instant TimeStamp = Instant.now(); - public String APIver = "1.01"; - public String OriginatorID; - public UUID RequestID; - public String SubRequestID; - public Collection<String> RequestTrack = new ArrayList<String>(); - public Collection<Map<String, String>> Flags = new ArrayList<Map<String, String>>(); - - public CommonHeader() { - - } - - public CommonHeader(CommonHeader commonHeader) { - this.OriginatorID = commonHeader.OriginatorID; - this.RequestID = commonHeader.RequestID; - this.SubRequestID = commonHeader.SubRequestID; - if (commonHeader.RequestTrack != null) { - this.RequestTrack.addAll(commonHeader.RequestTrack); - } - if (commonHeader.Flags != null) { - this.Flags.addAll(commonHeader.Flags); - } - } - - @Override - public String toString() { - return "CommonHeader [TimeStamp=" + TimeStamp + ", APIver=" + APIver + ", OriginatorID=" + OriginatorID - + ", RequestID=" + RequestID + ", SubrequestID=" + SubRequestID + ", RequestTrack=" + RequestTrack - + ", Flags=" + Flags + "]"; - } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((APIver == null) ? 0 : APIver.hashCode()); - result = prime * result + ((Flags == null) ? 0 : Flags.hashCode()); - result = prime * result + ((OriginatorID == null) ? 0 : OriginatorID.hashCode()); - result = prime * result + ((RequestID == null) ? 0 : RequestID.hashCode()); - result = prime * result + ((RequestTrack == null) ? 0 : RequestTrack.hashCode()); - result = prime * result + ((SubRequestID == null) ? 0 : SubRequestID.hashCode()); - result = prime * result + ((TimeStamp == null) ? 0 : TimeStamp.hashCode()); - return result; - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - CommonHeader other = (CommonHeader) obj; - if (APIver == null) { - if (other.APIver != null) - return false; - } else if (!APIver.equals(other.APIver)) - return false; - if (Flags == null) { - if (other.Flags != null) - return false; - } else if (!Flags.equals(other.Flags)) - return false; - if (OriginatorID == null) { - if (other.OriginatorID != null) - return false; - } else if (!OriginatorID.equals(other.OriginatorID)) - return false; - if (RequestID == null) { - if (other.RequestID != null) - return false; - } else if (!RequestID.equals(other.RequestID)) - return false; - if (RequestTrack == null) { - if (other.RequestTrack != null) - return false; - } else if (!RequestTrack.equals(other.RequestTrack)) - return false; - if (SubRequestID == null) { - if (other.SubRequestID != null) - return false; - } else if (!SubRequestID.equals(other.SubRequestID)) - return false; - if (TimeStamp == null) { - if (other.TimeStamp != null) - return false; - } else if (!TimeStamp.equals(other.TimeStamp)) - return false; - return true; - } - -} diff --git a/appc/src/main/java/org/openecomp/policy/appc/Request.java b/appc/src/main/java/org/openecomp/policy/appc/Request.java deleted file mode 100644 index 933692378..000000000 --- a/appc/src/main/java/org/openecomp/policy/appc/Request.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.policy.appc; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -public class Request implements Serializable{ - - private static final long serialVersionUID = -3912323643990646431L; - - public CommonHeader CommonHeader; - public String Action; - public String TargetID; - public String ObjectID; - public Map<String, Object> Payload = new HashMap<String, Object>(); - - public Request() { - - } - - public CommonHeader getCommonHeader() { - return CommonHeader; - } - - public Map<String, Object> getPayload() { - return Payload; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((Action == null) ? 0 : Action.hashCode()); - result = prime * result + ((CommonHeader == null) ? 0 : CommonHeader.hashCode()); - result = prime * result + ((ObjectID == null) ? 0 : ObjectID.hashCode()); - result = prime * result + ((Payload == null) ? 0 : Payload.hashCode()); - result = prime * result + ((TargetID == null) ? 0 : TargetID.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Request other = (Request) obj; - if (Action == null) { - if (other.Action != null) - return false; - } else if (!Action.equals(other.Action)) - return false; - if (CommonHeader == null) { - if (other.CommonHeader != null) - return false; - } else if (!CommonHeader.equals(other.CommonHeader)) - return false; - if (ObjectID == null) { - if (other.ObjectID != null) - return false; - } else if (!ObjectID.equals(other.ObjectID)) - return false; - if (Payload == null) { - if (other.Payload != null) - return false; - } else if (!Payload.equals(other.Payload)) - return false; - if (TargetID == null) { - if (other.TargetID != null) - return false; - } else if (!TargetID.equals(other.TargetID)) - return false; - return true; - } - - @Override - public String toString() { - return "Request [CommonHeader=" + CommonHeader + ", Action=" + Action + ", TargetID=" + TargetID + ", ObjectID=" - + ObjectID + ", Payload=" + Payload + "]"; - } - -} diff --git a/appc/src/main/java/org/openecomp/policy/appc/Response.java b/appc/src/main/java/org/openecomp/policy/appc/Response.java deleted file mode 100644 index a093f35a1..000000000 --- a/appc/src/main/java/org/openecomp/policy/appc/Response.java +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.policy.appc; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -public class Response implements Serializable { - - private static final long serialVersionUID = 434953706339865151L; - - public CommonHeader CommonHeader; - public ResponseStatus Status = new ResponseStatus(); - public Map<String, Object> Payload = new HashMap<String, Object>(); - - public Response() { - - } - - public Response(Request request) { - this.CommonHeader = new CommonHeader(request.CommonHeader); - if (request.Payload != null) { - this.Payload.putAll(request.Payload); - } - } - - public CommonHeader getCommonHeader() { - return CommonHeader; - } - - public void setCommonHeader(CommonHeader commonHeader) { - CommonHeader = commonHeader; - } - - public ResponseStatus getStatus() { - return Status; - } - - public void setStatus(ResponseStatus status) { - Status = status; - } - - public Map<String, Object> getPayload() { - return Payload; - } - - public void setPayload(Map<String, Object> payload) { - Payload = payload; - } - - @Override - public String toString() { - return "Response [CommonHeader=" + CommonHeader + ", Status=" + Status + ", Payload=" + Payload + "]"; - } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((CommonHeader == null) ? 0 : CommonHeader.hashCode()); - result = prime * result + ((Payload == null) ? 0 : Payload.hashCode()); - result = prime * result + ((Status == null) ? 0 : Status.hashCode()); - return result; - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Response other = (Response) obj; - if (CommonHeader == null) { - if (other.CommonHeader != null) - return false; - } else if (!CommonHeader.equals(other.CommonHeader)) - return false; - if (Payload == null) { - if (other.Payload != null) - return false; - } else if (!Payload.equals(other.Payload)) - return false; - if (Status == null) { - if (other.Status != null) - return false; - } else if (!Status.equals(other.Status)) - return false; - return true; - } - - - -} diff --git a/appc/src/main/java/org/openecomp/policy/appc/ResponseCode.java b/appc/src/main/java/org/openecomp/policy/appc/ResponseCode.java deleted file mode 100644 index 11c5539b1..000000000 --- a/appc/src/main/java/org/openecomp/policy/appc/ResponseCode.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.policy.appc; - -public enum ResponseCode { - ACCEPT(100), - ERROR(200), - REJECT(300), - SUCCESS(400), - FAILURE(500) - ; - - private Integer code; - - private ResponseCode(int code) { - this.code = code; - } - - public int getValue() { - return this.code; - } - - public String toString() { - return Integer.toString(this.code); - } - - public static ResponseCode toResponseCode(int code) { - if (code == ACCEPT.code) { - return ACCEPT; - } - if (code == ERROR.code) { - return ERROR; - } - if (code == REJECT.code) { - return REJECT; - } - if (code == SUCCESS.code) { - return SUCCESS; - } - if (code == FAILURE.code) { - return FAILURE; - } - return null; - } -} diff --git a/appc/src/main/java/org/openecomp/policy/appc/ResponseStatus.java b/appc/src/main/java/org/openecomp/policy/appc/ResponseStatus.java deleted file mode 100644 index f8adb21da..000000000 --- a/appc/src/main/java/org/openecomp/policy/appc/ResponseStatus.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.policy.appc; - -import java.io.Serializable; - -public class ResponseStatus implements Serializable { - - private static final long serialVersionUID = 2421770469587860452L; - - public int Code; - public String Value; - public String Description; - - @Override - public String toString() { - return "ResponseStatus [Code=" + Code + ", Value=" + Value + ", Description=" + Description + "]"; - } - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + Code; - result = prime * result + ((Description == null) ? 0 : Description.hashCode()); - result = prime * result + ((Value == null) ? 0 : Value.hashCode()); - return result; - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ResponseStatus other = (ResponseStatus) obj; - if (Code != other.Code) - return false; - if (Description == null) { - if (other.Description != null) - return false; - } else if (!Description.equals(other.Description)) - return false; - if (Value == null) { - if (other.Value != null) - return false; - } else if (!Value.equals(other.Value)) - return false; - return true; - } - -} diff --git a/appc/src/main/java/org/openecomp/policy/appc/ResponseValue.java b/appc/src/main/java/org/openecomp/policy/appc/ResponseValue.java deleted file mode 100644 index 18a1c2953..000000000 --- a/appc/src/main/java/org/openecomp/policy/appc/ResponseValue.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.policy.appc; - -public enum ResponseValue { - ACCEPT("ACCEPT"), - ERROR("ERROR"), - REJECT("REJECT"), - SUCCESS("SUCCESS"), - FAILURE("FAILURE") - ; - - private String value; - - private ResponseValue(String value) { - this.value = value; - } - - public String toString() { - return this.value; - } - - public static ResponseValue toResponseValue(String value) { - if (value.toString().equals(ACCEPT.toString())) { - return ACCEPT; - } - if (value.toString().equals(ERROR.toString())) { - return ERROR; - } - if (value.toString().equals(REJECT.toString())) { - return REJECT; - } - if (value.toString().equals(SUCCESS.toString())) { - return SUCCESS; - } - if (value.toString().equals(FAILURE.toString())) { - return FAILURE; - } - - return null; - } - -} diff --git a/appc/src/main/java/org/openecomp/policy/appc/util/Serialization.java b/appc/src/main/java/org/openecomp/policy/appc/util/Serialization.java deleted file mode 100644 index b1b3ad8aa..000000000 --- a/appc/src/main/java/org/openecomp/policy/appc/util/Serialization.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * appc - * ================================================================================ - * 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.policy.appc.util; - -import java.lang.reflect.Type; -import java.time.Instant; -import java.time.ZonedDateTime; -import java.time.format.DateTimeFormatter; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.google.gson.JsonDeserializationContext; -import com.google.gson.JsonDeserializer; -import com.google.gson.JsonElement; -import com.google.gson.JsonParseException; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSerializationContext; -import com.google.gson.JsonSerializer; - -public final class Serialization { - - public static DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSSxxx"); - - public static class gsonUTCAdapter implements JsonSerializer<ZonedDateTime>, JsonDeserializer<ZonedDateTime> { - - public ZonedDateTime deserialize(JsonElement element, Type type, JsonDeserializationContext context) - throws JsonParseException { - try { - return ZonedDateTime.parse(element.getAsString(), format); - } catch (Exception e) { - System.err.println(e); - } - return null; - } - - public JsonElement serialize(ZonedDateTime datetime, Type type, JsonSerializationContext context) { - return new JsonPrimitive(datetime.format(format)); - } - } - public static class gsonInstantAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> { - - @Override - public Instant deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - return Instant.ofEpochMilli(json.getAsLong()); - } - - @Override - public JsonElement serialize(Instant src, Type typeOfSrc, JsonSerializationContext context) { - return new JsonPrimitive(src.toEpochMilli()); - } - - } - - public static final Gson gsonPretty = new GsonBuilder() - .disableHtmlEscaping() - .setPrettyPrinting() - .registerTypeAdapter(ZonedDateTime.class, new gsonUTCAdapter()) - .registerTypeAdapter(Instant.class, new gsonInstantAdapter()) -// .registerTypeAdapter(CommonHeader1607.class, new gsonCommonHeaderInstance()) -// .registerTypeAdapter(ResponseStatus1607.class, new gsonResponseStatus()) - .create(); - -} diff --git a/appc/src/main/resources/definitions.yaml b/appc/src/main/resources/definitions.yaml deleted file mode 100644 index 680a9929c..000000000 --- a/appc/src/main/resources/definitions.yaml +++ /dev/null @@ -1,118 +0,0 @@ -### -# ============LICENSE_START======================================================= -# appc -# ================================================================================ -# 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========================================================= -### - -Request: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - value: '1.01' - OriginatorID: - type: string - RequestID: - type: string - pattern: "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$" - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Action: - type: string - enum: - - Audit - - ActionStatus - - BlockAudits - - Configure - - HealthCheck - - Install - - LiveUpgrade - - Migrate - - ModifyConfig - - Query - - Rebuild - - Reconfigure - - Restart - - Rollback - - Scale - - Start - - Stop - - Sync - - Terminate - - Test - - Upgrade - TargetID: - type: string - ObjectID: - type: string - Payload: - type: object - required: - - CommonHeader - - Action - - TargetID -Response: - type: object - properties: - CommonHeader: - type: object - properties: - TimeStamp: - type: string - APIver: - type: string - OriginatorID: - type: string - RequestID: - type: string - SubRequestID: - type: string - Flags: - type: object - required: - - TimeStamp - - APIver - - OriginatorID - - RequestID - Status: - type: object - properties: - Code: - type: integer - Value: - type: string - required: - - Code - - Value - Payload: - type: object - required: - - CommonHeader - - Status - |