Class PolicyManager
java.lang.Object
org.wso2.carbon.governance.api.policies.PolicyManager
This provides the management functionality for policy artifacts stored on the
registry.
-
Constructor Summary
ConstructorsConstructorDescriptionPolicyManager(org.wso2.carbon.registry.core.Registry registry) Constructor accepting an instance of the registry to use. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given policy artifact to the registry.Policy[]findPolicies(PolicyFilter criteria) Finds all policy artifacts matching the given filter criteria.Policy[]Finds all policy artifacts on the registry.Fetches the given policy artifact on the registry.newPolicy(byte[] content) Create a new Schema based on content either embedded or passed to a service.Create a new Schema based on content either embedded or passed to a service.Creates a new policy artifact from the given URL.voidremovePolicy(String policyId) Removes the given policy artifact from the registry.protected voidsetContent(Policy policy, org.wso2.carbon.registry.core.Resource policyResource) Sets content of the given policy artifact to the given resource on the registry.voidupdatePolicy(Policy policy) Updates the given policy artifact on the registry.
-
Constructor Details
-
PolicyManager
public PolicyManager(org.wso2.carbon.registry.core.Registry registry) Constructor accepting an instance of the registry to use.- Parameters:
registry- the instance of the registry.
-
-
Method Details
-
newPolicy
public Policy newPolicy(byte[] content) throws org.wso2.carbon.registry.core.exceptions.RegistryException Create a new Schema based on content either embedded or passed to a service.- Parameters:
content- the schema content- Returns:
- the artifact added.
- Throws:
GovernanceException- if the operation failed.org.wso2.carbon.registry.core.exceptions.RegistryException
-
newPolicy
public Policy newPolicy(byte[] content, String name) throws org.wso2.carbon.registry.core.exceptions.RegistryException Create a new Schema based on content either embedded or passed to a service.- Parameters:
content- the schema contentname- the schema name- Returns:
- the artifact added.
- Throws:
GovernanceException- if the operation failed.org.wso2.carbon.registry.core.exceptions.RegistryException
-
newPolicy
Creates a new policy artifact from the given URL.- Parameters:
url- the given URL.- Returns:
- the artifact added.
- Throws:
GovernanceException- if the operation failed.
-
addPolicy
Adds the given policy artifact to the registry. Please do not use this method to update an existing artifact use the update method instead. If this method is used to update an existing artifact, all existing properties (such as lifecycle details) will be removed from the existing artifact.- Parameters:
policy- the policy artifact.- Throws:
GovernanceException- if the operation failed.
-
updatePolicy
Updates the given policy artifact on the registry.- Parameters:
policy- the policy artifact.- Throws:
GovernanceException- if the operation failed.
-
getPolicy
Fetches the given policy artifact on the registry.- Parameters:
policyId- the identifier of the policy artifact.- Returns:
- the policy artifact.
- Throws:
GovernanceException- if the operation failed.
-
removePolicy
Removes the given policy artifact from the registry.- Parameters:
policyId- the identifier of the policy artifact.- Throws:
GovernanceException- if the operation failed.
-
setContent
protected void setContent(Policy policy, org.wso2.carbon.registry.core.Resource policyResource) throws GovernanceException Sets content of the given policy artifact to the given resource on the registry.- Parameters:
policy- the policy artifact.policyResource- the content resource.- Throws:
GovernanceException- if the operation failed.
-
findPolicies
Finds all policy artifacts matching the given filter criteria.- Parameters:
criteria- the filter criteria to be matched.- Returns:
- the policy artifacts that match.
- Throws:
GovernanceException- if the operation failed.
-
getAllPolicies
Finds all policy artifacts on the registry.- Returns:
- all policy artifacts on the registry.
- Throws:
GovernanceException- if the operation failed.
-