Examples of GovernanceException


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

        } catch (RegistryException e) {
            String msg = "Error in getting the qualified name for the artifact. artifact id: " +
                    id + ", " + "path: " + path + ".";
            log.error(msg);
            throw new GovernanceException(msg, e);
        }
        // get the target namespace.
        String fileName = RegistryUtils.getResourceName(path);
        String namespaceURI =
                wsdlElement.getAttributeValue(new QName(WSDL_TARGET_NAMESPACE_ATTRIBUTE));
View Full Code Here

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

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

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

                    artifactResource.getProperty(GovernanceConstants.ARTIFACT_ID_PROP_KEY);
            if (GovernanceConstants.SERVICE_MEDIA_TYPE.equals(artifactResource.getMediaType())) {
                // it is a service
                byte[] contentBytes = (byte[]) artifactResource.getContent();
                if (contentBytes == null) {
                    throw new GovernanceException("Unable to read payload of governance artifact " +
                            "at path: " + artifactPath);
                }
                OMElement contentElement = buildOMElement(contentBytes);
                Service service = new Service(artifactId, contentElement);
                service.associateRegistry(registry);
                return service;
//            }
            /*else if (GovernanceConstants.PROCESS_MEDIA_TYPE.equals(
                    artifactResource.getMediaType())) {
                // it is a process
                byte[] contentBytes = (byte[]) artifactResource.getContent();
                if (contentBytes == null) {
                    throw new GovernanceException("Unable to read payload of governance artifact " +
                            "at path: " + artifactPath);
                }
                OMElement contentElement = buildOMElement(contentBytes);
                Process process = new Process(artifactId, contentElement);
                process.associateRegistry(registry);
                return process;
            } else if (GovernanceConstants.SLA_MEDIA_TYPE.equals(artifactResource.getMediaType())) {
                // it is a SLA
                byte[] contentBytes = (byte[]) artifactResource.getContent();
                if (contentBytes == null) {
                    throw new GovernanceException("Unable to read payload of governance artifact " +
                            "at path: " + artifactPath);
                }
                OMElement contentElement = buildOMElement(contentBytes);
                SLA sla = new SLA(artifactId, contentElement);
                sla.associateRegistry(registry);
                return sla;*/
            } else if (GovernanceConstants.WSDL_MEDIA_TYPE
                    .equals(artifactResource.getMediaType())) {
                return new Wsdl(artifactId, registry);
            } else if (GovernanceConstants.SCHEMA_MEDIA_TYPE
                    .equals(artifactResource.getMediaType())) {
                return new Schema(artifactId, registry);
            } else if (GovernanceConstants.POLICY_XML_MEDIA_TYPE
                    .equals(artifactResource.getMediaType())) {
                return new Policy(artifactId, registry);
            } else if (GovernanceConstants.ENDPOINT_MEDIA_TYPE
                    .equals(artifactResource.getMediaType())) {
                return new Endpoint(artifactId, registry);
            }
            /*else if (GovernanceConstants.PEOPLE_MEDIA_TYPE.
                    equals(artifactResource.getMediaType())) {
                // it is a peopleArtifact
                byte[] contentBytes = (byte[]) artifactResource.getContent();
                OMElement contentElement = null;
                if (contentBytes != null) {
                    contentElement = buildOMElement(contentBytes);
                }
                String peopleGroup = CommonUtil.getPeopleGroup(contentElement);
                PeopleArtifact peopleArtifact = null;
                switch (PeopleGroup.valueOf(peopleGroup.toUpperCase())) {
                    case ORGANIZATION:
                        peopleArtifact = new Organization(artifactId, contentElement);
                        break;
                    case DEPARTMENT:
                        peopleArtifact = new Department(artifactId, contentElement);
                        break;
                    case PROJECT_GROUP:
                        peopleArtifact = new ProjectGroup(artifactId, contentElement);
                        break;
                    case PERSON:
                        peopleArtifact = new Person(artifactId, contentElement);
                        break;
                    default:
                        assert false;
                }
                peopleArtifact.associateRegistry(registry);
                return peopleArtifact;
            }*/

        } catch (RegistryException e) {
            String msg =
                    "Error in retrieving governance artifact by path. path: " + artifactPath + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
        return null;
    }
View Full Code Here

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

        } catch (RegistryException e) {
            String msg =
                    "Error in adding an entry for the governance artifact. path: " + artifactPath +
                            ", uuid: " + artifactId + ".";
            log.error(msg);
            throw new GovernanceException(msg, e);
        }
    }
View Full Code Here

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

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

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

        try {
            parser = XMLInputFactory.newInstance().createXMLStreamReader(inputStream);
        } catch (XMLStreamException e) {
            String msg = "Error in initializing the parser to build the OMElement.";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }

        //create the builder
        StAXOMBuilder builder = new StAXOMBuilder(parser);
        //get the root element (in this case the envelope)
View Full Code Here

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

        try {
            return element.toStringWithConsume();
        } catch (XMLStreamException e) {
            String msg = "Error in serializing the OMElement.";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
    }
View Full Code Here

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

            parameter.put("query", sql);
            result = (String[]) registry.executeQuery(null, parameter).getContent();
        } catch (RegistryException e) {
            String msg = "Error in getting the result for media type: " + mediaType + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
        return result;
    }
View Full Code Here

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

            if (!registry.resourceExists(path)) {
                String msg =
                        "The artifact is not added to the registry. Please add the artifact " +
                                "before creating versions.";
                log.error(msg);
                throw new GovernanceException(msg);
            }
            registry.createVersion(path);
        } catch (RegistryException e) {
            String msg = "Error in creating a version for the artifact. id: " + id +
                    ", path: " + path + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
    }
View Full Code Here

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

            }
        } catch (RegistryException e) {
            String msg = "Error in getting dependencies from the artifact. id: " + id +
                    ", path: " + path + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
        return governanceArtifacts.toArray(new GovernanceArtifact[governanceArtifacts.size()]);
    }
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.