Example usage for javax.xml.stream XMLStreamException getMessage

List of usage examples for javax.xml.stream XMLStreamException getMessage

Introduction

In this page you can find the example usage for javax.xml.stream XMLStreamException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationWSWorkflowExecutor.java

@Override
public void cleanUpPendingTask(String workflowExtRef) throws WorkflowException {
    super.cleanUpPendingTask(workflowExtRef);
    String errorMsg = null;/*from ww w .j a va 2  s  .  c  o m*/

    try {
        String action = WorkflowConstants.DELETE_REGISTRATION_WS_ACTION;
        ServiceClient client = getClient(action);
        String payload = "  <p:CancelApplicationRegistrationWorkflowProcessRequest "
                + "   xmlns:p=\"http://workflow.application.apimgt.carbon.wso2.org\">\n"
                + "      <p:workflowRef>" + workflowExtRef + "</p:workflowRef>\n"
                + "   </p:CancelApplicationRegistrationWorkflowProcessRequest>";

        client.fireAndForget(AXIOMUtil.stringToOM(payload));
    } catch (AxisFault axisFault) {
        errorMsg = "Error sending out cancel pending registration approval process message. Cause: "
                + axisFault.getMessage();
        throw new WorkflowException(errorMsg, axisFault);
    } catch (XMLStreamException e) {
        errorMsg = "Error converting registration cleanup String to OMElement. Cause: " + e.getMessage();
        throw new WorkflowException(errorMsg, e);
    }
}

From source file:org.wso2.carbon.apimgt.impl.workflow.SubscriptionCreationWSWorkflowExecutor.java

@Override
public void cleanUpPendingTask(String workflowExtRef) throws WorkflowException {
    String errorMsg = null;/* w  ww . j  a  v  a  2 s. co  m*/
    super.cleanUpPendingTask(workflowExtRef);
    try {
        String action = WorkflowConstants.DELETE_SUBSCRIPTION_WS_ACTION;
        ServiceClient client = getClient(action);
        String payload = "<wor:CancelSubscriptionApprovalWorkflowProcessRequest "
                + "           xmlns:wor=\"http://workflow.subscription.apimgt.carbon.wso2.org\">\n"
                + "           <wor:workflowExtRef>" + workflowExtRef + "</wor:workflowExtRef>\n"
                + "        </wor:CancelSubscriptionApprovalWorkflowProcessRequest>";

        client.fireAndForget(AXIOMUtil.stringToOM(payload));
    } catch (AxisFault axisFault) {
        errorMsg = "Error sending out cancel pending subscription approval process message. cause: "
                + axisFault.getMessage();
        throw new WorkflowException(errorMsg, axisFault);
    } catch (XMLStreamException e) {
        errorMsg = "Error converting subscription cleanup String to OMElement. cause: " + e.getMessage();
        throw new WorkflowException(errorMsg, e);
    }
}

From source file:org.wso2.carbon.apimgt.impl.workflow.UserSignUpWSWorkflowExecutor.java

@Override
public void cleanUpPendingTask(String workflowExtRef) throws WorkflowException {
    String errorMsg;/*from   ww w  .j a va2s  .  c om*/

    super.cleanUpPendingTask(workflowExtRef);
    try {
        String action = WorkflowConstants.DELETE_USER_WS_ACTION;
        ServiceClient client = getClient(action);

        String payload = "<p:CancelUserSignupProcessRequest "
                + "        xmlns:p=\"http://workflow.registeruser.apimgt.carbon.wso2.org\">"
                + "           <p:workflowRef>" + workflowExtRef + "</p:workflowRef>"
                + "        </p:CancelUserSignupProcessRequest>";

        client.fireAndForget(AXIOMUtil.stringToOM(payload));
    } catch (AxisFault axisFault) {
        errorMsg = "Error sending out cancel pending user signup approval process message. Cause: "
                + axisFault.getMessage();
        throw new WorkflowException(errorMsg, axisFault);
    } catch (XMLStreamException e) {
        errorMsg = "Error converting cancel user signup String to OMElement. Cause: " + e.getMessage();
        throw new WorkflowException(errorMsg, e);
    }
}

From source file:org.wso2.carbon.appfactory.tenant.build.integration.utils.JenkinsConfig.java

/**
 * Loads the content of default setting.xml file.
 * More information about settings.xml can be found at :
 * http://maven.apache.org/settings.html
 * @return {@link OMElement} representing the content
 *//* w  ww  . jav a  2 s . com*/
public OMElement loadMavenSettingsFileContent() {

    InputStream jobConfigTemplateInputStream = this.getClass()
            .getResourceAsStream(File.separatorChar + MAVEN_SETTINGS_FILE_TEMPLATE);
    if (jobConfigTemplateInputStream != null) {

        try {
            StAXOMBuilder builder = new StAXOMBuilder(jobConfigTemplateInputStream);
            OMElement mavenSettingsTemplate = builder.getDocumentElement();
            return mavenSettingsTemplate;
        } catch (XMLStreamException e) {
            throw new RuntimeException(e.getMessage(), e);
        }

    } else {
        throw new NullPointerException(
                "Class loader is unable to find the maven settings configuration template");
    }

}

From source file:org.wso2.carbon.appfactory.tenant.build.integration.utils.JenkinsConfig.java

/**
 * Returns the configurations of maven plugin in jenkins.
 * /*  w ww  . ja  v  a  2  s.com*/
 * @return {@link OMElement} representing the file content
 */
public OMElement getGlobalMavenConfigFileContent() {

    InputStream globalMavenConfigTemplateInputStream = this.getClass()
            .getResourceAsStream(File.separatorChar + GLOBAL_MAVEN_CONFIG_FILE);
    if (globalMavenConfigTemplateInputStream != null) {

        try {
            StAXOMBuilder builder = new StAXOMBuilder(globalMavenConfigTemplateInputStream);
            OMElement globalMavenConfigTemplate = builder.getDocumentElement();

            return globalMavenConfigTemplate;

        } catch (XMLStreamException e) {
            throw new RuntimeException(e.getMessage(), e);
        }

    } else {
        throw new NullPointerException(
                "Class loader is unable to find the maven settings configuration template");
    }

}

From source file:org.wso2.carbon.application.deployer.synapse.SynapseAppDeployer.java

/**
 * Add the local entry//from  ww w  .jav  a2s.c  o m
 *
 * @param ele
 * @param axisConfig AxisConfiguration of the current tenant
 * */
private boolean addEntry(String ele, AxisConfiguration axisConfig) {
    final Lock lock = getLock(axisConfig);
    try {
        lock.lock();
        OMElement elem;
        try {
            elem = LocalEntryUtil.nonCoalescingStringToOm(ele);
        } catch (XMLStreamException e) {
            log.error("Error while converting the file content : " + e.getMessage());
            return false;
        }

        if (elem.getQName().getLocalPart().equals(XMLConfigConstants.ENTRY_ELT.getLocalPart())) {

            String entryKey = elem.getAttributeValue(new QName("key"));
            entryKey = entryKey.trim();
            SynapseConfiguration synapseConfiguration = getSynapseConfiguration(axisConfig);
            if (log.isDebugEnabled()) {
                log.debug("Adding local entry with key : " + entryKey);
            }
            if (synapseConfiguration.getLocalRegistry().containsKey(entryKey)) {
                log.error("An Entry with key " + entryKey + " is already used within the configuration");
            } else {
                Entry entry = EntryFactory.createEntry(elem, synapseConfiguration.getProperties());
                entry.setFileName(ServiceBusUtils.generateFileName(entry.getKey()));
                synapseConfiguration.addEntry(entryKey, entry);
                MediationPersistenceManager pm = ServiceBusUtils.getMediationPersistenceManager(axisConfig);
                pm.saveItem(entry.getKey(), ServiceBusConstants.ITEM_TYPE_ENTRY);
            }
            if (log.isDebugEnabled()) {
                log.debug("Local registry entry : " + entryKey + " added to the configuration");
            }
            return true;
        } else {
            log.warn("Error adding local entry. Invalid definition");
        }
    } catch (SynapseException syne) {
        log.error("Unable to add local entry ", syne);
    } catch (OMException e) {
        log.error("Unable to add local entry. Invalid XML ", e);
    } catch (Exception e) {
        log.error("Unable to add local entry. Invalid XML ", e);
    } finally {
        lock.unlock();
    }
    return false;
}

From source file:org.wso2.carbon.application.deployer.synapse.SynapseAppDeployer.java

/**
 * Remove the local entry/*from w  w w .j  a  v a 2  s.c  o m*/
 *
 * @param ele
 * @param axisConfig AxisConfiguration of the current tenant
 * */
public boolean deleteEntry(String ele, AxisConfiguration axisConfig) {

    final Lock lock = getLock(axisConfig);
    String entryKey = null;
    try {
        lock.lock();
        OMElement elem;
        try {
            elem = LocalEntryUtil.nonCoalescingStringToOm(ele);
        } catch (XMLStreamException e) {
            log.error("Error while converting the file content : " + e.getMessage());
            return false;
        }

        if (elem.getQName().getLocalPart().equals(XMLConfigConstants.ENTRY_ELT.getLocalPart())) {

            entryKey = elem.getAttributeValue(new QName("key"));
            entryKey = entryKey.trim();
            log.debug("Adding local entry with key : " + entryKey);

            SynapseConfiguration synapseConfiguration = getSynapseConfiguration(axisConfig);
            Entry entry = synapseConfiguration.getDefinedEntries().get(entryKey);
            if (entry != null) {
                synapseConfiguration.removeEntry(entryKey);
                MediationPersistenceManager pm = ServiceBusUtils.getMediationPersistenceManager(axisConfig);
                pm.deleteItem(entryKey, entry.getFileName(), ServiceBusConstants.ITEM_TYPE_ENTRY);
                if (log.isDebugEnabled()) {
                    log.debug("Deleted local entry with key : " + entryKey);
                }
                return true;
            } else {
                log.warn("No entry exists by the key : " + entryKey);
                return false;
            }
        }
    } catch (SynapseException syne) {
        log.error("Unable to delete the local entry : " + entryKey, syne);
    } catch (Exception e) {
        log.error("Unable to delete the local entry : " + entryKey, e);
    } finally {
        lock.unlock();
    }
    return false;
}

From source file:org.wso2.carbon.appmgt.mobile.utils.MobileConfigurations.java

private MobileConfigurations() {
    XMLStreamReader parser = null;
    try {//from  ww  w.  ja v a  2 s. co m
        parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(CONFIG_FILE_PATH));
    } catch (XMLStreamException e) {
        log.error("XML Parsing issue :" + e.getMessage());
    } catch (FileNotFoundException e) {
        log.error("App Manager XML not found :" + e.getMessage());
    }
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    documentElement = builder.getDocumentElement();
    mobileConfElement = new QName("MobileAppsConfiguration");

}

From source file:org.wso2.carbon.appmgt.services.api.v1.apps.common.ServicesApiConfigurations.java

private ServicesApiConfigurations() {
    XMLStreamReader parser = null;
    try {//from w ww  .  ja  v  a  2 s  .c om
        parser = XMLInputFactory.newInstance().createXMLStreamReader(new FileInputStream(CONFIG_FILE_PATH));
    } catch (XMLStreamException e) {
        log.error("XML Parsing issue :" + e.getMessage());
    } catch (FileNotFoundException e) {
        log.error("App Manager XML not found :" + e.getMessage());
    }
    StAXOMBuilder builder = new StAXOMBuilder(parser);
    documentElement = builder.getDocumentElement();
    mobileConfElement = new QName("ServicesAPI");

}

From source file:org.wso2.carbon.connector.FileAppend.java

/**
 * Generate the result/*from  w w  w. ja v a 2s . c o m*/
 *
 * @param messageContext The message context that is generated for processing the file
 * @param resultStatus   true/false
 */
private void generateResult(MessageContext messageContext, boolean resultStatus) {
    ResultPayloadCreate resultPayload = new ResultPayloadCreate();
    String response = FileConstants.START_TAG + resultStatus + FileConstants.END_TAG;
    OMElement element;
    try {
        element = resultPayload.performSearchMessages(response);
        resultPayload.preparePayload(messageContext, element);
    } catch (XMLStreamException e) {
        handleException(e.getMessage(), e, messageContext);
    } catch (IOException e) {
        handleException(e.getMessage(), e, messageContext);
    } catch (JSONException e) {
        handleException(e.getMessage(), e, messageContext);
    }
}