Examples of GovernanceException


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

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

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

     */
    public void addSLA(SLA sla) throws GovernanceException {
        if (sla.getQName() == null) {
            String msg = "Name is not set. It have to be set as an qname.";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        String slaName = sla.getQName().getLocalPart();
        sla.setAttributes(GovernanceConstants.SERVICE_NAME_ATTRIBUTE,
                new String[]{slaName});

        sla.associateRegistry(registry);
        boolean succeeded = false;
        try {
            registry.beginTransaction();
            String slaId = sla.getId();
            Resource slaResource = registry.newResource();
            slaResource.setMediaType(GovernanceConstants.SLA_MEDIA_TYPE);
            setContent(sla, slaResource);
            slaResource.setProperty(GovernanceConstants.ARTIFACT_ID_PROP_KEY, slaId);
            // the sla will not actually stored in the tmp path.
            String tmpPath = "/" + slaName;
            registry.put(tmpPath, slaResource);
            succeeded = true;
        } catch (RegistryException e) {
            String msg = "Failed to add artifact: artifact id: " + sla.getId() +
                    ", path: " + sla.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

            succeeded = true;
        } catch (RegistryException e) {
            String msg = "Error in updating the artifact, artifact id: " + sla.getId() +
                    ", artifact path: " + sla.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, slaId);
        if (artifact != null && !(artifact instanceof SLA)) {
            String msg = "The artifact request is not an SLA. id: " + slaId + ".";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        return (SLA) artifact;
    }
View Full Code Here

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

            }
        } catch (RegistryException e) {
            String msg = "Error in saving attributes for the artifact. id: " + sla.getId() +
                    ", path: " + sla.getPath() + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
    }
View Full Code Here

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

            wsdl.loadWsdlDetails();
            succeeded = true;
        } catch (RegistryException e) {
            String msg = "Error in adding the wsdl. wsdl id: " + wsdl.getId() + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } catch (MalformedURLException e) {
            String msg = "Malformed policy url provided. url: " + wsdl.getUrl() + ".";
            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 wsdlElement available. " +
                            "So no updates will be done. " + "wsdl id: " + wsdl.getId() +
                            ", wsdl path: " + wsdl.getPath() + ".";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        boolean succeeded = false;
        try {
            registry.beginTransaction();

            // getting the old wsdl.
            Wsdl oldWsdl = getWsdl(wsdl.getId());
            if (oldWsdl == null) {
                addWsdl(wsdl);
                return;
            }
            // we are expecting only the OMElement to be different.
            Resource wsdlResource = registry.newResource();
            wsdlResource.setMediaType(GovernanceConstants.WSDL_MEDIA_TYPE);

            // setting the wsdl content
            setContent(wsdl, wsdlResource);

            // remove the old wsdl resource.
            String tmpPath = oldWsdl.getPath();

            registry.put(tmpPath, wsdlResource);
            wsdl.updatePath();
            wsdl.loadWsdlDetails();
           
            succeeded = true;
        } catch (RegistryException e) {
            String msg =
                    "Error in updating the wsdl, wsdl id: " + wsdl.getId() + ", wsdl path: " +
                            wsdl.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, wsdlId);
        if (artifact != null && !(artifact instanceof Wsdl)) {
            String msg = "The artifact request is not a Wsdl. id: " + wsdlId + ".";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        return (Wsdl) artifact;
    }
View Full Code Here

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

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

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

    public void addService(Service service) throws GovernanceException {
        // adding the attributes for name, namespace + service
        if (service.getQName() == null) {
            String msg = "Name is not set. It have to be set as an qname.";
            log.error(msg);
            throw new GovernanceException(msg);
        }
        String serviceName = service.getQName().getLocalPart();
        service.setAttributes(GovernanceConstants.SERVICE_NAME_ATTRIBUTE,
                new String[]{serviceName});
        // namespace can be null
        String serviceNamespace = service.getQName().getNamespaceURI();
        service.setAttributes(GovernanceConstants.SERVICE_NAMESPACE_ATTRIBUTE,
                new String[]{serviceNamespace});
       
        service.associateRegistry(registry);
        boolean succeeded = false;
        try {
            registry.beginTransaction();
            String serviceId = service.getId();
            Resource serviceResource = registry.newResource();
            serviceResource.setMediaType(serviceMediaType);
            setContent(service, serviceResource);
            serviceResource.setProperty(GovernanceConstants.ARTIFACT_ID_PROP_KEY, serviceId);
            // the service will not actually stored in the tmp path.
            String tmpPath = "/" + serviceName;
            registry.put(tmpPath, serviceResource);
//            GovernanceUtils.writeOwnerAssociations(registry, service);
//            GovernanceUtils.writeConsumerAssociations(registry, service);
            succeeded = true;
        } catch (RegistryException e) {
            String msg = "Failed to add artifact: artifact id: " + service.getId() +
                    ", path: " + service.getPath() + ". " + e.getMessage();
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        } finally {
            if (succeeded) {
                try {
                    registry.commitTransaction();
                } catch (RegistryException e) {
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.