Examples of GovernanceException


Examples of org.wso2.carbon.governance.api.exception.GovernanceException

        } catch (RegistryException e) {
            String msg =
                    "Add endpoint failed: endpoint id: " + endpoint.getId() + ", path: " +
                            endpoint.getPath() + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } finally {
            if (succeeded) {
                try {
                    registry.commitTransaction();
                } catch (RegistryException e) {
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

            String msg =
                    "Updates are only accepted if the url is available. " +
                            "So no updates will be done. " + "endpoint id: " + endpoint.getId() +
                            ", endpoint path: " + endpoint.getPath() + ".";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        boolean succeeded = false;
        try {
            registry.beginTransaction();

            // getting the old endpoint.
            Endpoint oldEndpoint = getEndpoint(endpoint.getId());
            if (oldEndpoint != null) {
                // we are expecting only the OMElement to be different.
                String oldPath = oldEndpoint.getPath();
                registry.delete(oldPath);
            }
           
            addEndpoint(endpoint);
            succeeded = true;
        } catch (RegistryException e) {
            String msg =
                    "Error in updating the endpoint, endpoint id: " + endpoint.getId() +
                            ", endpoint path: " + endpoint.getPath() + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } finally {
            if (succeeded) {
                try {
                    registry.commitTransaction();
                } catch (RegistryException e) {
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

        GovernanceArtifact artifact =
                GovernanceUtils.retrieveGovernanceArtifactById(registry, endpointId);
        if (artifact != null && !(artifact instanceof Endpoint)) {
            String msg = "The artifact request is not an endpoint. id: " + endpointId + ".";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        return (Endpoint) artifact;
    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

        } catch (RegistryException e) {
            String msg =
                    "Error in setting the resource content for endpoint. path: " +
                            endpoint.getPath() + ", " + "id: " + endpoint.getId() + ".";
            log.error(msg);
            throw new GovernanceException(msg, e);
        }
        // and set all the attributes as properties.
        String[] attributeKeys = endpoint.getAttributeKeys();
        if (attributeKeys != null) {
            Properties properties = new Properties();
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

        } catch (RegistryException e) {
            String msg =
                    "Error in retrieving the endpoint resource. url:" + url + ", path:" + path +
                            ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
        String artifactId = r.getProperty(GovernanceConstants.ARTIFACT_ID_PROP_KEY);
        if (artifactId != null) {
            return getEndpoint(artifactId);
        }
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

                                break;
                            }
                        } catch (Exception e) {
                            String msg = "Error in performing the regular expression matches for: " +
                                    referenceValue + ".";
                            throw new GovernanceException(msg, e);
                        }
                    }
                    if (satisfied) {
                        break;
                    }
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

        } catch (RegistryException e) {
            String msg =
                    "Error in getting the content for the artifact. artifact id: " + id + ", " +
                            "path: " + path + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }

        // and then iterate all the properties and add.
        Properties properties = resource.getProperties();
        if (properties != null) {
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

            policy.loadPolicyDetails();
            succeeded = true;
        } catch (RegistryException e) {
            String msg = "Error in adding the Policy. policy id: " + policy.getId() + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } catch (MalformedURLException e) {
            String msg = "Malformed policy url provided. url: " + url + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } finally {
            if (succeeded) {
                try {
                    registry.commitTransaction();
                } catch (RegistryException e) {
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

            String msg =
                    "Updates are only accepted if the policy content is available. " +
                            "So no updates will be done. " + "policy id: " + policy.getId() +
                            ", policy path: " + policy.getPath() + ".";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        boolean succeeded = false;
        String url = policy.getUrl();
        try {
            registry.beginTransaction();

            // getting the old policy.
            Policy oldPolicy = getPolicy(policy.getId());
            if (oldPolicy == null) {
                addPolicy(policy);
                return;
            }
            Resource policyResource = registry.newResource();
            policyResource.setMediaType(GovernanceConstants.POLICY_XML_MEDIA_TYPE);

            // setting the policy content
            setContent(policy, policyResource);

            // remove the old policy resource.
            registry.delete(oldPolicy.getPath());

            String tmpPath;
            if (policy.getQName() != null) {
                tmpPath = "/" + policy.getQName().getLocalPart();
            } else if (url != null) {
                tmpPath = RegistryUtils.getResourceName(new URL(url).getFile().replace("~", ""));
            } else {
                String msg =
                        "Error in identifying the name for the policy. State the name for the policy.";
                log.error(msg);
                throw new GovernanceException(msg);
            }
            registry.put(tmpPath, policyResource);
            policy.updatePath();

            succeeded = true;
        } catch (RegistryException e) {
            String msg =
                    "Error in updating the policy, policy id: " + policy.getId() +
                            ", policy path: " + policy.getPath() + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } catch (MalformedURLException e) {
            String msg = "Malformed url found, url " + url + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } finally {
            if (succeeded) {
                try {
                    registry.commitTransaction();
                } catch (RegistryException e) {
View Full Code Here

Examples of org.wso2.carbon.governance.api.exception.GovernanceException

        GovernanceArtifact artifact =
                GovernanceUtils.retrieveGovernanceArtifactById(registry, policyId);
        if (artifact != null && !(artifact instanceof Policy)) {
            String msg = "The artifact request is not a policy. id: " + policyId + ".";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        return (Policy) artifact;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.