diff options
author | jhh <jorge.hernandez-herrero@att.com> | 2020-01-30 18:57:13 -0600 |
---|---|---|
committer | jhh <jorge.hernandez-herrero@att.com> | 2020-02-04 00:26:57 -0600 |
commit | baa4e928207f5930fcd620bddddcd493aa7a4122 (patch) | |
tree | b4832c661bc05bcb457e65a73c06f0a960ac7632 /feature-lifecycle/src/main/java | |
parent | a54a2373f1b48cdb64d4920ec57ffeab4f228814 (diff) |
domain native and operational policies support
- moved DomainMaker to policy-utils/ project.
- support for native drools and controller drools policy types.
Issue-ID: POLICY-2345
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Change-Id: I46b9816eadceb7ef280e0e6789f07b4d4ca51519
Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
Diffstat (limited to 'feature-lifecycle/src/main/java')
12 files changed, 519 insertions, 0 deletions
diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/DroolsPolicy.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/DroolsPolicy.java new file mode 100644 index 00000000..a0234661 --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/DroolsPolicy.java @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; +import lombok.experimental.SuperBuilder; + +@Data +@SuperBuilder +public abstract class DroolsPolicy { + @SerializedName("type") + protected String type; + + @SerializedName("type_version") + protected String typeVersion; + + @SerializedName("version") + protected String version; + + @SerializedName("name") + protected String name; + + @SerializedName("metadata") + protected Metadata metadata; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/Metadata.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/Metadata.java new file mode 100644 index 00000000..fd68e5b5 --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/Metadata.java @@ -0,0 +1,40 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Builder; +import lombok.Data; + +/** + * Metadata in Native Drools Policies. + */ + +@Data +@Builder +public class Metadata implements Serializable { + + private static final long serialVersionUID = -1027974819756498893L; + + @SerializedName("policy-id") + protected String policyId; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerCustomSerializer.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerCustomSerializer.java new file mode 100644 index 00000000..bda7748d --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerCustomSerializer.java @@ -0,0 +1,39 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.controller; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.SuperBuilder; + + +@Data +@SuperBuilder +public class ControllerCustomSerializer implements Serializable { + private static final long serialVersionUID = 1505345574249332514L; + + @SerializedName("customSerializerClass") + protected String customSerializerClass; + + @SerializedName("jsonParser") + protected String jsonParser; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java new file mode 100644 index 00000000..0d5a363e --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java @@ -0,0 +1,41 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.controller; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.SuperBuilder; +import org.onap.policy.drools.domain.models.DroolsPolicy; + +/** + * Controller Policy model root object. + */ + +@Data +@SuperBuilder +public class ControllerPolicy extends DroolsPolicy implements Serializable { + + private static final long serialVersionUID = -8171337852833516581L; + + @SerializedName("properties") + protected ControllerProperties properties; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerProperties.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerProperties.java new file mode 100644 index 00000000..0ed6d33c --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerProperties.java @@ -0,0 +1,52 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.controller; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import java.util.Map; +import lombok.Data; +import lombok.experimental.SuperBuilder; + + +/** + * Controller Domain Policy. + */ + +@Data +@SuperBuilder +public class ControllerProperties implements Serializable { + private static final long serialVersionUID = 1259434187110418986L; + + @SerializedName("controllerName") + protected String controllerName; + + @SerializedName("sourceTopics") + protected List<ControllerSourceTopic> sourceTopics; + + @SerializedName("sinkTopics") + protected List<ControllerSinkTopic> sinkTopics; + + @SerializedName("customConfig") + protected Map<String, String> customConfig; + +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSerialization.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSerialization.java new file mode 100644 index 00000000..77a5e93d --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSerialization.java @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.controller; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.SuperBuilder; + + +@Data +@SuperBuilder +public class ControllerSerialization implements Serializable { + + @SerializedName("eventClass") + public String eventClass; + + @SerializedName("eventFilter") + public String eventFilter; + + @SerializedName("customSerializer") + public ControllerCustomSerializer customSerializer; + +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java new file mode 100644 index 00000000..acb4fb01 --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java @@ -0,0 +1,45 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.controller; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; +import lombok.experimental.SuperBuilder; + + +/** + * Sink Topic. + */ + +@Data +@SuperBuilder +public class ControllerSinkTopic implements Serializable { + private static final long serialVersionUID = 8770353732981476267L; + + @SerializedName("topicName") + protected String topicName; + + @SerializedName("serialization") + protected List<ControllerSerialization> serialization; + +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java new file mode 100644 index 00000000..69d57bc6 --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java @@ -0,0 +1,44 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.controller; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import java.util.List; +import lombok.Data; +import lombok.experimental.SuperBuilder; + + +/** + * Source Topics. + */ + +@Data +@SuperBuilder +public class ControllerSourceTopic implements Serializable { + private static final long serialVersionUID = -1732598566914643612L; + + @SerializedName("topicName") + protected String topicName; + + @SerializedName("serialization") + protected List<ControllerSerialization> serialization; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsController.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsController.java new file mode 100644 index 00000000..0af96331 --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsController.java @@ -0,0 +1,43 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.nativ.rules; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Builder; +import lombok.Data; + +/** + * Controller Model in Native Drools Policies. + */ + +@Data +@Builder +public class NativeDroolsController implements Serializable { + + private static final long serialVersionUID = -2070515139072136869L; + + @SerializedName("name") + protected String name; + + @SerializedName("version") + protected String version; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsPolicy.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsPolicy.java new file mode 100644 index 00000000..fce6ca1a --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsPolicy.java @@ -0,0 +1,41 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.nativ.rules; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Data; +import lombok.experimental.SuperBuilder; +import org.onap.policy.drools.domain.models.DroolsPolicy; + +/** + * Native Drools Policy model root object. + */ + +@Data +@SuperBuilder +public class NativeDroolsPolicy extends DroolsPolicy implements Serializable { + + private static final long serialVersionUID = -8171337852833516581L; + + @SerializedName("properties") + protected NativeDroolsProperties properties; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsProperties.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsProperties.java new file mode 100644 index 00000000..dfd25ca7 --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsProperties.java @@ -0,0 +1,42 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.nativ.rules; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Builder; +import lombok.Data; + +/** + * Properties in Native Drools Policies. + */ + +@Data +@Builder +public class NativeDroolsProperties implements Serializable { + private static final long serialVersionUID = 2360030332628276427L; + + @SerializedName("rulesArtifact") + protected NativeDroolsRulesArtifact rulesArtifact; + + @SerializedName("controller") + protected NativeDroolsController controller; +} diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsRulesArtifact.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsRulesArtifact.java new file mode 100644 index 00000000..8ca33865 --- /dev/null +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/domain/models/nativ/rules/NativeDroolsRulesArtifact.java @@ -0,0 +1,46 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2020 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.policy.drools.domain.models.nativ.rules; + +import com.google.gson.annotations.SerializedName; +import java.io.Serializable; +import lombok.Builder; +import lombok.Data; + +/** + * Rules Artifact in Native Drools Policies. + */ + +@Data +@Builder +public class NativeDroolsRulesArtifact implements Serializable { + + private static final long serialVersionUID = -3519759514319217518L; + + @SerializedName("groupId") + protected String groupId; + + @SerializedName("artifactId") + protected String artifactId; + + @SerializedName("version") + protected String version; +} |