Package org.wso2.carbon.governance.api.exception

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


            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

            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

        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

            } 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

    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

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

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

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

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

        name = RegistryUtils.getResourceName(path);
View Full Code Here

TOP

Related Classes of org.wso2.carbon.governance.api.exception.GovernanceException

Copyright © 2018 www.massapicom. 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.