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

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


            }
        } catch (RegistryException e) {
            String msg =
                    "Error in getting attached schemas from the artifact at path: " + path + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
        return schemas.toArray(new Schema[schemas.size()]);
    }
View Full Code Here


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

                        GovernanceConstants.GOVERNANCE_ARTIFACT_INDEX_PATH);
            } else {
                String msg = "The artifact index doesn't exist. artifact index path: " +
                        GovernanceConstants.GOVERNANCE_ARTIFACT_INDEX_PATH + ".";
                log.error(msg);
                throw new GovernanceException(msg);
            }
            String path = resource.getProperty(artifactId);
            if (registry.resourceExists(path)) {
                registry.delete(path);
            }
            resource.removeProperty(artifactId);
            governanceSystemRegistry.put(
                    GovernanceConstants.GOVERNANCE_ARTIFACT_INDEX_PATH, resource);
        } catch (RegistryException e) {
            String msg = "Error in deleting the the artifact id:" + artifactId + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
    }
View Full Code Here

            }
        } catch (RegistryException e) {
            String msg =
                    "Error in getting attached endpoints from the artifact at path: " + path + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
        return endpoints.toArray(new Endpoint[endpoints.size()]);
    }
View Full Code Here

        } catch (RegistryException e) {
            String msg = "Error in getting the artifact id to path map: " +
                    GovernanceConstants.GOVERNANCE_ARTIFACT_INDEX_PATH +
                    ", artifact id:" + artifactId + ".";
            log.error(msg, e);
            throw new GovernanceException(msg, e);
        }
    }
View Full Code Here

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

            // getting the old schema.
            Schema oldSchema = getSchema(schema.getId());
            if (oldSchema == null) {
                addSchema(schema);
                return;
            }
            // we are expecting only the OMElement to be different.
            Resource schemaResource = registry.newResource();
            schemaResource.setMediaType(GovernanceConstants.SCHEMA_MEDIA_TYPE);

            // setting the schema content
            setContent(schema, schemaResource);

            registry.put(oldSchema.getPath(), schemaResource);
            schema.updatePath();
            schema.loadSchemaDetails();

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

        } 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

        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

                    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

        } 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

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.