diff options
author | Pamela Dragosh <pdragosh@research.att.com> | 2017-02-14 19:41:00 -0500 |
---|---|---|
committer | Pamela Dragosh <pdragosh@research.att.com> | 2017-02-14 19:41:32 -0500 |
commit | 91d04c64771832a0b8815ffbe1f0f9920320d94d (patch) | |
tree | fb02d5e1c84a3d91def9a7ee95bc87f9c046cc96 /PolicyEngineUtils/src/main/java/org/openecomp/policy/api | |
parent | b9d4caa40ef8e3566ac475968bce17b9b64b6939 (diff) |
Initial OpenECOMP policy/engine commit
Change-Id: I7dbff37733b661643dd4d1caefa3d7dccc361b6e
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'PolicyEngineUtils/src/main/java/org/openecomp/policy/api')
6 files changed, 296 insertions, 0 deletions
diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/LoadedPolicy.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/LoadedPolicy.java new file mode 100644 index 000000000..574580bac --- /dev/null +++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/LoadedPolicy.java @@ -0,0 +1,57 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineUtils + * ================================================================================ + * 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.api; + +import java.util.Map; +/** + * <code>LoadedPolicy</code> defines the Policy that has been Loaded into the PDP. + * + * @version 0.2 + */ +public interface LoadedPolicy { + /** + * Gets the <code>String</code> format of the Policy Name that has been Loaded into the PDP. + * + * @return <code>String</code> format of Policy Name + */ + public String getPolicyName(); + + /** + * Gets the <code>String</code> format of the Policy Version that has been Loaded into the PDP. + * + * @return <code>String</code> format of the Policy Version. + */ + public String getVersionNo(); + + /** + * Gets the <code>Map</code> of <code>String,String</code> format of the Matches if the policy Loaded is of Config Type. + * + * @return the <code>Map</code> of <code>String,String</code> format of the matches in the policy. + */ + public Map<String, String> getMatches(); + + /** + * Gets the <code>UpdateType</code> of {@link org.openecomp.policy.api.UpdateType} received. + * + * @return <code>UpdateType</code> associated with this <code>PDPNotification</code> + */ + public UpdateType getUpdateType(); +} diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/NotificationHandler.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/NotificationHandler.java new file mode 100644 index 000000000..9661b72f1 --- /dev/null +++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/NotificationHandler.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineUtils + * ================================================================================ + * 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.api; +/** + * Defines the methods which need to run when an Event or Notification is received. + * + * @version 0.1 + */ +public interface NotificationHandler { + /** + * <code>notificationReceived</code> method will be triggered automatically whenever a Notification is received by the PEP. + * + * @param notification <code>PDPNotification</code> of {@link org.openecomp.policy.api.PDPNotification} is the object that has information of the notification. + */ + public void notificationReceived(PDPNotification notification); +} diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/NotificationType.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/NotificationType.java new file mode 100644 index 000000000..8bd5bc8db --- /dev/null +++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/NotificationType.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineUtils + * ================================================================================ + * 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.api; + +/** + * Enumeration of the Update Type that has occurred in the <code>PDPNotification</code> of + * {@link org.openecomp.policy.api.PDPNotification} + * + * @version 0.1 + */ +public enum NotificationType { + /** + * Indicates that a policy has been updated + */ + UPDATE("update"), + /** + * Indicates that a policy has been removed + */ + REMOVE("remove"), + /** + * Indicates that both update and removal of policy events has occurred. + */ + BOTH("both") + ; + + private String name; + + private NotificationType(String name){ + this.name = name; + } + + /** + * Returns the <code>String</code> format of the Type for this <code>UpdateType</code> + * @return the <code>String</code> Type of <code>UpdateType</code> + */ + @Override + public String toString(){ + return this.name; + } +} diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/PDPNotification.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/PDPNotification.java new file mode 100644 index 000000000..18da617cf --- /dev/null +++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/PDPNotification.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineUtils + * ================================================================================ + * 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.api; + +import java.util.Collection; + +/** + * Defines the <code>Notification</code> event sent from PDP to Client PEP. + * + * @version 0.2 + */ +public interface PDPNotification { + /** + * Gets the <code>Collection</code> of {@link org.openecomp.policy.api.RemovedPolicy} objects received. + * + * @return the <code>Collection</code> which consists of <code>RemovedPolicy</code> objects. + */ + public Collection<RemovedPolicy> getRemovedPolicies(); + + /** + * Gets the <code>Collection</code> of {@link org.openecomp.policy.api.LoadedPolicy} objects receieved. + * + * @return the <code>Collection</code> which consists of <code>UpdatedPolicy</code> objects. + */ + public Collection<LoadedPolicy> getLoadedPolicies(); + + /** + * Gets the <code>NotificationType</code> of {@link org.openecomp.policy.api.NotificationType} received. + * + * @return <code>NotificationType</code> associated with this <code>PDPNotification</code> + */ + public NotificationType getNotificationType(); + +} diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/RemovedPolicy.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/RemovedPolicy.java new file mode 100644 index 000000000..b94fdce42 --- /dev/null +++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/RemovedPolicy.java @@ -0,0 +1,41 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineUtils + * ================================================================================ + * 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.api; +/** + * <code>RemovedPolicy</code> defines the Policy that has been removed + * + * @version 0.1 + */ +public interface RemovedPolicy { + /** + * Gets the <code>String</code> format of the Policy Name that has been removed. + * + * @return <code>String</code> format of Policy Name + */ + public String getPolicyName(); + + /** + * Gets the <code>String</code> format of the Policy Version that has been removed. + * + * @return <code>String</code> format of Policy Version + */ + public String getVersionNo(); +} diff --git a/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/UpdateType.java b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/UpdateType.java new file mode 100644 index 000000000..d48121b69 --- /dev/null +++ b/PolicyEngineUtils/src/main/java/org/openecomp/policy/api/UpdateType.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * PolicyEngineUtils + * ================================================================================ + * 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.api; + +/** + * Enumeration of the Update Type that has occurred in the <code>UpdatedPolicy</code> of + * {@link org.openecomp.policy.api.LoadedPolicy} + * + * @version 0.1 + */ +public enum UpdateType { + /** + * Indicates that a policy has been updated + */ + UPDATE("update"), + /** + * Indicates that a policy is new + */ + NEW("new") + ; + + private String name; + + private UpdateType(String name){ + this.name = name; + } + + /** + * Returns the <code>String</code> format of the Type for this <code>UpdateType</code> + * @return the <code>String</code> Type of <code>UpdateType</code> + */ + @Override + public String toString(){ + return this.name; + } +} |