Package org.wso2.carbon.registry.core.exceptions

Examples of org.wso2.carbon.registry.core.exceptions.RegistryException


        if (registry != null) {
            Resource resource = registry.newResource();
            resource.setContent(resourceContent.getBytes());
            registry.put(resourcePath, resource);
        } else {
            throw new RegistryException("Registry Instance Cannot Be Obtained");
        }
    }
View Full Code Here


            }
            return null;
        } catch (RegistryException e) {
            String msg = "Cannot Retrieve The Database Instance List From Registry";
            log.error(msg, e);
            throw new RegistryException(msg, e);
        } catch (XMLStreamException e) {
            String msg = "";
            log.error(msg, e);
            throw new XMLStreamException(msg, e);
        }
View Full Code Here

            }
            return null;                           
        } catch (RegistryException e) {
            String msg = "";
            log.error(msg, e);
            throw new RegistryException(msg, e);
        } catch (XMLStreamException e) {
            String msg = "";
            log.error(msg, e);
            throw new XMLStreamException(msg, e);
        }
View Full Code Here

                    return userInfo;
                }
            }
            return new DatabaseUserInfo();
        } catch (RegistryException e) {
            throw new RegistryException("Error while retrieving the userlist from the registry", e);
        } catch (XMLStreamException e) {
            throw new XMLStreamException("", e);
        }
    }
View Full Code Here

    public ConnectionDAO(int tenantId) throws RegistryException {
        try {
            this.tenantData = new TenantDBData(tenantId);
        } catch (RegistryException e) {
            String msg = "Cannot Load Tenant Data";
            throw new RegistryException(msg, e);
        }
    }
View Full Code Here

        } catch (SQLException e) {
            String msg = "Unable To Create Database For Tenant " + tenantDomain;
            throw new SQLException(msg, e);
        } catch (RegistryException e) {
            String msg = "Cannot Retrieve Instance List";
            throw new RegistryException(msg, e);
        } catch (XMLStreamException e) {
            throw new XMLStreamException(e);
        } catch (ClassNotFoundException e) {
            String msg = "Driver class not found";
            log.error(msg, e);
View Full Code Here

            return true;
        } catch (SQLException e) {
            throw new SQLException(e);
        } catch (RegistryException e) {
            String msg = "Error While Retrieving Resource From The Registry";
            throw new RegistryException(msg, e);
        } finally {
            if (ps != null) {
                ps.close();
            }
            ConnectionHandler.closeConnection();
View Full Code Here

                log.debug("Database User " + userInfo.getUsername() + "Dropped");
            }
        } catch (SQLException e) {
            throw new SQLException(e);
        } catch (RegistryException e) {
            throw new RegistryException("Error while attempting to read the database information " +
                    "from the registry", e);
        } catch (XMLStreamException e) {
            throw new XMLStreamException(e);
        } catch (ClassNotFoundException e) {
            throw new ClassNotFoundException("Driver class not found", e);
View Full Code Here

                    users.add(user);
                }
            }
            return users;
        } catch (RegistryException e) {
            throw new RegistryException("Error while attempting to read the user list from " +
                    "the registry", e);
        } catch (SQLException e) {
            throw new SQLException(e);
        } catch (XMLStreamException e) {
            throw new XMLStreamException(e);
View Full Code Here

                    OMElement itemEl = (OMElement)checkListIterator.next();
                    if (itemEl.getQName().equals(new QName("checkitem"))) {
                        List<String> items = new ArrayList<String>();
                        String itemName = itemEl.getText();
                        if (itemName == null)
                            throw new RegistryException("Checklist items should have a name!");
                        items.add("status:" + name);
                        items.add("name:" + itemName);
                        items.add("value:false");

                        if (itemEl.getAttribute(new QName("order")) != null) {
                            items.add("order:" + itemEl.getAttributeValue(new QName("order")));
                        }
                        else {
                            items.add("order:" + checklistItemOrder);
                        }

                        String resourcePropertyNameForItem
                                = "registry.custom_lifecycle.checklist.option" + propertyOrder + ".item";

                        resource.setProperty(resourcePropertyNameForItem, items);
                        checklistItemOrder++;
                        propertyOrder++;
                    } else if (itemEl.getQName().equals(new QName("js"))) {
                        Iterator scriptElementIterator = itemEl.getChildElements();
                        while (scriptElementIterator.hasNext()) {
                            OMElement scriptItemEl = (OMElement)scriptElementIterator.next();
                            if (scriptItemEl.getQName().equals(new QName("console"))) {
                                StringBuffer lifecycleScript = new StringBuffer();
                                String lifecycleScriptCommand = "";
                                Iterator consoleScriptElementIterator = scriptItemEl.getChildElements();
                                while (consoleScriptElementIterator.hasNext()) {
                                    OMElement consoleScriptItemEl = (OMElement)consoleScriptElementIterator.next();
                                    if (consoleScriptItemEl.getQName().equals(new QName("script"))) {
                                        lifecycleScript.append(consoleScriptItemEl.toString()).append("\n");
                                    }
                                }
                                if (scriptItemEl.getAttribute(new QName("demoteFunction")) != null) {
                                    lifecycleScriptCommand =
                                            scriptItemEl.getAttributeValue(new QName("demoteFunction"));
                                    List<String> items = new ArrayList<String>();
                                    items.add(lifecycleScript.toString());
                                    items.add(lifecycleScriptCommand);
                                    String resourcePropertyNameForItem =
                                            "registry.custom_lifecycle.checklist.js.script.console." +
                                                    name + "." + DEMOTE;
                                    resource.setProperty(resourcePropertyNameForItem, items);
                                }
                                if (scriptItemEl.getAttribute(new QName("promoteFunction")) != null) {
                                    lifecycleScriptCommand =
                                            scriptItemEl.getAttributeValue(new QName("promoteFunction"));
                                    List<String> items = new ArrayList<String>();
                                    items.add(lifecycleScript.toString());
                                    items.add(lifecycleScriptCommand);
                                    String resourcePropertyNameForItem =
                                            "registry.custom_lifecycle.checklist.js.script.console." +
                                                    name + "." + PROMOTE;
                                    resource.setProperty(resourcePropertyNameForItem, items);
                                }
                            } else if (scriptItemEl.getQName().equals(new QName("server"))) {
                                String lifecycleScript = "";
                                String lifecycleScriptCommand = "";
                                Iterator serverScriptElementIterator = scriptItemEl.getChildElements();
                                if (serverScriptElementIterator.hasNext()) {
                                    OMElement serverScriptItemEl = (OMElement)serverScriptElementIterator.next();
                                    if (serverScriptItemEl.getQName().equals(new QName("script"))) {
                                        lifecycleScript += serverScriptItemEl.toString();
                                        lifecycleScript = lifecycleScript.trim();
                                    }
                                }
                                if (scriptItemEl.getAttribute(new QName("demoteFunction")) != null) {
                                    lifecycleScriptCommand =
                                            scriptItemEl.getAttributeValue(new QName("demoteFunction"));
                                    List<String> items = new ArrayList<String>();
                                    items.add(lifecycleScript);
                                    items.add(lifecycleScriptCommand);
                                    String resourcePropertyNameForItem =
                                            "registry.custom_lifecycle.checklist.js.script.server." +
                                                    name + "." + DEMOTE;
                                    resource.setProperty(resourcePropertyNameForItem, items);
                                }
                                if (scriptItemEl.getAttribute(new QName("promoteFunction")) != null) {
                                    lifecycleScriptCommand =
                                            scriptItemEl.getAttributeValue(new QName("promoteFunction"));
                                    List<String> items = new ArrayList<String>();
                                    items.add(lifecycleScript);
                                    items.add(lifecycleScriptCommand);
                                    String resourcePropertyNameForItem =
                                            "registry.custom_lifecycle.checklist.js.script.server." +
                                                    name + "." + PROMOTE;
                                    resource.setProperty(resourcePropertyNameForItem, items);
                                }
                            }
                        }
                    }
                }
            }
        }
        catch (XMLStreamException e) {
            throw new RegistryException("Resource does not contain valid XML configuration: " + e.toString());
        }

        resource.setProperty(stateProperty, states.get(0));
        resource.setProperty(lifecycleProperty, aspectName);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.exceptions.RegistryException

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.