Example usage for javax.xml.xpath XPathExpressionException getStackTrace

List of usage examples for javax.xml.xpath XPathExpressionException getStackTrace

Introduction

In this page you can find the example usage for javax.xml.xpath XPathExpressionException getStackTrace.

Prototype

public StackTraceElement[] getStackTrace() 

Source Link

Document

Provides programmatic access to the stack trace information printed by #printStackTrace() .

Usage

From source file:org.wso2.carbon.automation.engine.context.DefaultInstance.java

public String getTenantDomain(boolean isTenantAdmin, boolean isClustered) throws XPathExpressionException {
    String tenantDomain = null;// w w w .  j  a v a  2 s  . c om

    try {
        if (isTenantAdmin) {
            tenantDomain = getConfigurationValue(ContextXpathConstants.USER_MANAGEMENT_SUPER_TENANT_DOMAIN);
        } else {
            tenantDomain = getConfigurationValue(ContextXpathConstants.TENANT_DOMAIN);
        }
    } catch (XPathExpressionException e) {
        log.error("Error while reading the super Tenant:", e);
        throw new XPathExpressionException(
                "Error While Reading default Tenant Domain:- " + e.getStackTrace().toString());

    }
    return tenantDomain;
}

From source file:org.wso2.carbon.automation.engine.context.DefaultInstance.java

public String getUserKey(String tenantDomain, boolean isAdminUser) throws XPathExpressionException {
    String tenantKey = null;//  w  w w.java2s .  com
    String adminUserReplacement = ContextXpathConstants.ADMIN;
    try {

        if (!isAdminUser) {
            adminUserReplacement = ContextXpathConstants.USERS;
        }
        if (tenantDomain.equals(getConfigurationValue(ContextXpathConstants.SUPER_TENANT_DOMAIN))) {

            tenantKey = getConfigurationValue(String
                    .format(ContextXpathConstants.USER_MANAGEMENT_SUPER_TENANT_USER_KEY, adminUserReplacement));
        } else {
            tenantKey = getConfigurationValue(String.format(
                    ContextXpathConstants.USER_MANAGEMENT_TENANT_USER_KEY, tenantDomain, adminUserReplacement));
        }
    } catch (XPathExpressionException e) {
        log.error("Error while reading the Tenant:" + e.getMessage());
        throw new XPathExpressionException(
                "Error While Reading default User Key:- " + e.getStackTrace().toString());
    }
    return tenantKey;
}

From source file:org.wso2.carbon.automation.engine.context.DefaultInstance.java

public String getDefaultManager(String productGroup) throws XPathExpressionException {
    String managerNode = null;/*  w w  w  .ja v  a2s .  co  m*/
    try {
        boolean isClustered = Boolean.parseBoolean(getConfigurationValue(
                String.format(ContextXpathConstants.PRODUCT_GROUP_CLUSTERING_ENABLED, productGroup)));
        String xpathNodeType = ContextXpathConstants.PRODUCT_GROUP_INSTANCE_TYPE;
        NodeList lbWorkerManagerList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.lb_worker_manager));
        NodeList lbManagerNodeList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.lb_manager));
        NodeList managerNodeList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.manager));
        NodeList standAloneNodeList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.standalone));

        if (isClustered) {
            if (lbWorkerManagerList.getLength() >= 1) {
                managerNode = lbWorkerManagerList.item(0).getAttributes()
                        .getNamedItem(ContextXpathConstants.NAME).getTextContent();
            } else if (lbManagerNodeList.getLength() >= 1) {
                managerNode = lbManagerNodeList.item(0).getAttributes().getNamedItem(ContextXpathConstants.NAME)
                        .getTextContent();
            } else if (managerNodeList.getLength() >= 1) {
                managerNode = managerNodeList.item(0).getAttributes().getNamedItem(ContextXpathConstants.NAME)
                        .getTextContent();
            } else {
                managerNode = standAloneNodeList.item(0).getAttributes()
                        .getNamedItem(ContextXpathConstants.NAME).getTextContent();
            }
        } else {
            managerNode = standAloneNodeList.item(0).getAttributes().getNamedItem(ContextXpathConstants.NAME)
                    .getTextContent();
        }

    } catch (XPathExpressionException e) {
        log.error("Error while reading the default Manager:" + e.getMessage());
        throw new XPathExpressionException(
                "Error While Reading default Tenant Domain:- " + e.getStackTrace().toString());
    }
    return managerNode;
}

From source file:org.wso2.carbon.automation.engine.context.DefaultInstance.java

public String getDefaultWorker(String productGroup) throws XPathExpressionException {
    String workerNode = null;//  ww  w.  j  a  v a2  s.  c  o m
    try {
        boolean isClustered = Boolean.parseBoolean(getConfigurationValue(
                String.format(ContextXpathConstants.PRODUCT_GROUP_CLUSTERING_ENABLED, productGroup)));
        String xpathNodeType = ContextXpathConstants.PRODUCT_GROUP_INSTANCE_TYPE;
        NodeList lbWorkerManagerList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.lb_worker_manager));
        NodeList lbWorkerNodeList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.lb_worker));
        NodeList workerNodeList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.worker));
        NodeList standAloneNodeList = getConfigurationNodeList(
                String.format(xpathNodeType, productGroup, InstanceType.standalone));

        if (isClustered) {
            if (lbWorkerManagerList.getLength() >= 1) {
                workerNode = lbWorkerManagerList.item(0).getAttributes()
                        .getNamedItem(ContextXpathConstants.NAME).getTextContent();
            } else if (lbWorkerNodeList.getLength() >= 1) {
                workerNode = lbWorkerNodeList.item(0).getAttributes().getNamedItem(ContextXpathConstants.NAME)
                        .getTextContent();
            } else if (workerNodeList.getLength() >= 1) {
                workerNode = workerNodeList.item(0).getAttributes().getNamedItem(ContextXpathConstants.NAME)
                        .getTextContent();
            } else {
                workerNode = standAloneNodeList.item(0).getAttributes().getNamedItem(ContextXpathConstants.NAME)
                        .getTextContent();
            }
        } else {
            workerNode = standAloneNodeList.item(0).getAttributes().getNamedItem(ContextXpathConstants.NAME)
                    .getTextContent();
        }
    } catch (XPathExpressionException e) {
        log.error("Error while reading the default worker:" + e.getMessage());
        throw new XPathExpressionException(
                "Error While Reading default Tenant Domain:- " + e.getStackTrace().toString());
    }
    return workerNode;
}