diff options
Diffstat (limited to 'ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap')
5 files changed, 155 insertions, 114 deletions
diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/ONAPPapEngineFactory.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/ONAPPapEngineFactory.java index eacbeb216..a78dc3250 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/ONAPPapEngineFactory.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/ONAPPapEngineFactory.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017,2019 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. @@ -20,39 +20,40 @@ package org.onap.policy.xacml.api.pap; -import java.util.Properties; - import com.att.research.xacml.api.pap.PAPException; import com.att.research.xacml.util.FactoryException; import com.att.research.xacml.util.FactoryFinder; -public abstract class ONAPPapEngineFactory{ - - /** - * Creates a new <code>PAPEngineFactory</code> instance using the given class name and the default thread class loader. - * - * @param factoryClassName the <code>String</code> name of the factory class to instantiate - * @return an instance of an object that extends <code>ONAPPapEngineFactory</code> to use in creating <code>PAPPolicyEngine</code> objects. - */ - public static ONAPPapEngineFactory newInstance(String factoryClassName) throws FactoryException { - return FactoryFinder.newInstance(factoryClassName, ONAPPapEngineFactory.class, null, true); - } - - /** - * Creates a new <code>PAPPolicyEngine</code> based on the configured <code>ONAPPapEngineFactory</code>. - * - * @return a new <code>PAPPolicyEngine</code> - * @throws PAPException - */ - public abstract PAPPolicyEngine newEngine() throws FactoryException, PAPException; - - /** - * Creates a new <code>PAPPolicyEngine</code> based on the configured <code>ONAPPapEngineFactory</code>. - * - * @return a new <code>PAPPolicyEngine</code> - * @throws PAPException - */ - public abstract PAPPolicyEngine newEngine(Properties properties) throws FactoryException, PAPException; +import java.util.Properties; +public abstract class ONAPPapEngineFactory { + + /** + * Creates a new <code>PAPEngineFactory</code> instance using the given class name and the default thread class + * loader. + * + * @param factoryClassName the <code>String</code> name of the factory class to instantiate + * @return an instance of an object that extends <code>ONAPPapEngineFactory</code> to use in creating + * <code>PAPPolicyEngine</code> objects. + */ + public static ONAPPapEngineFactory newInstance(String factoryClassName) throws FactoryException { + return FactoryFinder.newInstance(factoryClassName, ONAPPapEngineFactory.class, null, true); + } + + /** + * Creates a new <code>PAPPolicyEngine</code> based on the configured <code>ONAPPapEngineFactory</code>. + * + * @return a new <code>PAPPolicyEngine</code> + * @throws PAPException PAPException + */ + public abstract PAPPolicyEngine newEngine() throws FactoryException, PAPException; + + /** + * Creates a new <code>PAPPolicyEngine</code> based on the configured <code>ONAPPapEngineFactory</code>. + * + * @return a new <code>PAPPolicyEngine</code> + * @throws PAPException PAPException + */ + public abstract PAPPolicyEngine newEngine(Properties properties) throws FactoryException, PAPException; } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java index 4539b4225..5879c098c 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPAPPolicy.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 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. @@ -17,73 +17,115 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.onap.policy.xacml.api.pap; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonSubTypes.Type; +import com.fasterxml.jackson.annotation.JsonTypeInfo; + import java.net.URI; import java.util.List; import java.util.Map; import org.onap.policy.xacml.std.pap.StdPAPPolicy; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonSubTypes.Type; - /* * The following allows us to use Jackson to convert sub-types of this type into JSON and back to objects. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "PAPPolicyType") -@JsonSubTypes({ - @Type(value = StdPAPPolicy.class, name = "StdPAPPolicy") }) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "PAPPolicyType") +@JsonSubTypes({@Type(value = StdPAPPolicy.class, name = "StdPAPPolicy")}) public interface OnapPAPPolicy { - - public String getPolicyName(); - public String getOldPolicyFileName(); - public String getPolicyDescription(); - public String getOnapName(); - public String getConfigName(); - public Map<String, String> getDynamicFieldConfigAttributes(); - public Map<String, String> getTreatments(); - public Map<String, String> getDynamicSettingsMap(); - public List<String> getDynamicRuleAlgorithmLabels(); - public List<String> getDynamicRuleAlgorithmCombo(); - public List<String> getDynamicRuleAlgorithmField1(); - public List<String> getDynamicRuleAlgorithmField2(); - public List<Object> getDynamicVariableList(); - public List<String> getDataTypeList(); - public String getConfigBodyData(); - public String getPolicyID(); - public String getRuleID(); - public String getConfigType(); - public Boolean isEditPolicy(); - public Boolean isDraft(); - public String getVersion(); - public String getDomainDir(); - public String getConfigPolicyType(); - public String getJsonBody(); - public Integer getHighestVersion(); - public URI getLocation(); - public String getActionPerformer(); - public String getActionAttribute(); - public String getActionBody(); - public Map<String, String> getDropDownMap(); - public String getActionDictHeader(); - public String getActionDictType(); - public String getActionDictUrl(); - public String getActionDictMethod(); - public String getServiceType(); - public String getUuid(); - public String getMsLocation(); - public String getPriority(); + + public String getPolicyName(); + + public String getOldPolicyFileName(); + + public String getPolicyDescription(); + + public String getOnapName(); + + public String getConfigName(); + + public Map<String, String> getDynamicFieldConfigAttributes(); + + public Map<String, String> getTreatments(); + + public Map<String, String> getDynamicSettingsMap(); + + public List<String> getDynamicRuleAlgorithmLabels(); + + public List<String> getDynamicRuleAlgorithmCombo(); + + public List<String> getDynamicRuleAlgorithmField1(); + + public List<String> getDynamicRuleAlgorithmField2(); + + public List<Object> getDynamicVariableList(); + + public List<String> getDataTypeList(); + + public String getConfigBodyData(); + + public String getPolicyID(); + + public String getRuleID(); + + public String getConfigType(); + + public Boolean isEditPolicy(); + + public Boolean isDraft(); + + public String getVersion(); + + public String getDomainDir(); + + public String getConfigPolicyType(); + + public String getJsonBody(); + + public Integer getHighestVersion(); + + public URI getLocation(); + + public String getActionPerformer(); + + public String getActionAttribute(); + + public String getActionBody(); + + public Map<String, String> getDropDownMap(); + + public String getActionDictHeader(); + + public String getActionDictType(); + + public String getActionDictUrl(); + + public String getActionDictMethod(); + + public String getServiceType(); + + public String getUuid(); + + public String getMsLocation(); + + public String getPriority(); + public String getDeleteCondition(); + public String getDictionaryType(); + public String getDictionary(); + public String getDictionaryFields(); - public String getRiskLevel(); - public String getGuard(); - public String getRiskType(); - public String getTTLDate(); + + public String getRiskLevel(); + + public String getGuard(); + + public String getRiskType(); + + public String getTTLDate(); } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDP.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDP.java index 65db0b980..6224e38cd 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDP.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDP.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 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. @@ -17,28 +17,25 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.policy.xacml.api.pap; -import org.onap.policy.xacml.std.pap.StdPDP; +package org.onap.policy.xacml.api.pap; import com.att.research.xacml.api.pap.PDP; import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonSubTypes.Type; import com.fasterxml.jackson.annotation.JsonTypeInfo; +import org.onap.policy.xacml.std.pap.StdPDP; + /* * The following allows us to use Jackson to convert sub-types of this type into JSON and back to objects. */ -@JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - include = JsonTypeInfo.As.PROPERTY, - property = "PDPType") -@JsonSubTypes({ - @Type(value = StdPDP.class, name = "StdPDP") }) +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "PDPType") +@JsonSubTypes({@Type(value = StdPDP.class, name = "StdPDP")}) public interface OnapPDP extends PDP { - public Integer getJmxPort(); - - public void setJmxPort(Integer jmxport); - + public Integer getJmxPort(); + + public void setJmxPort(Integer jmxport); + } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDPGroup.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDPGroup.java index 7d3ad0c63..77561652a 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDPGroup.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/OnapPDPGroup.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-XACML * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * Copyright (C) 2017, 2019 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. @@ -20,16 +20,16 @@ package org.onap.policy.xacml.api.pap; -import java.util.Set; - import com.att.research.xacml.api.pap.PDPGroup; import com.att.research.xacml.api.pap.PDPPolicy; +import java.util.Set; + public interface OnapPDPGroup extends PDPGroup { - public Set<OnapPDP> getOnapPdps(); - - public Set<PDPPolicy> getSelectedPolicies(); - - public String getOperation(); + public Set<OnapPDP> getOnapPdps(); + + public Set<PDPPolicy> getSelectedPolicies(); + + public String getOperation(); } diff --git a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/PAPPolicyEngine.java b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/PAPPolicyEngine.java index cae7456bc..62255ff8f 100644 --- a/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/PAPPolicyEngine.java +++ b/ONAP-XACML/src/main/java/org/onap/policy/xacml/api/pap/PAPPolicyEngine.java @@ -23,6 +23,7 @@ package org.onap.policy.xacml.api.pap; import com.att.research.xacml.api.pap.PAPException; import com.att.research.xacml.api.pap.PDPPolicy; import com.att.research.xacml.api.pap.PDPStatus; + import java.io.InputStream; import java.util.Set; @@ -60,7 +61,7 @@ public interface PAPPolicyEngine { throws PAPException; // copy the given policy file into the group's directory, but do not include the policy in the group's policy set - public void copyPolicy(PDPPolicy policy, OnapPDPGroup group) throws PAPException; + public void copyPolicy(PDPPolicy policy, OnapPDPGroup group, String userId) throws PAPException; public void removePolicy(PDPPolicy policy, OnapPDPGroup group) throws PAPException; |