Example usage for javax.management JMException getCause

List of usage examples for javax.management JMException getCause

Introduction

In this page you can find the example usage for javax.management JMException getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:be.fgov.kszbcss.rhq.websphere.component.j2ee.ApplicationInfoQuery.java

public ApplicationInfo execute(Config config)
        throws JMException, ConnectorException, InterruptedException, ConfigQueryException {
    ApplicationDeploymentCO applicationDeployment = config.path(DeploymentCO.class, applicationName)
            .path(ApplicationDeploymentCO.class).resolveAtMostOne(false);
    if (applicationDeployment == null) {
        return null;
    } else {/*from   w  ww. jav  a2  s .co  m*/
        String dataId = applicationDeployment.getId();
        String baseURI = dataId.substring(0, dataId.indexOf('|'));
        List<ModuleInfo> moduleInfos = new ArrayList<ModuleInfo>();
        for (ModuleDeploymentCO module : applicationDeployment.getModules()) {
            String configDataType = module.getConfigObjectType();
            String uri = module.getUri();
            if (log.isDebugEnabled()) {
                log.debug("Processing module " + uri + ", type " + configDataType);
            }
            ModuleInfoFactory factory = ModuleInfoFactory.getInstance(configDataType);
            if (factory == null) {
                log.error("Unknown module type " + configDataType);
                continue;
            }
            String deploymentDescriptorURI = factory.locateDeploymentDescriptor(config, baseURI + "/" + uri);
            if (log.isDebugEnabled()) {
                log.debug("Loading deployment descriptor " + deploymentDescriptorURI);
            }
            moduleInfos.add(
                    factory.create(uri, config.extract(deploymentDescriptorURI), loadTargetMappings(module)));
        }
        byte[] deploymentDescriptor;
        try {
            deploymentDescriptor = config.extract(baseURI + "/META-INF/application.xml");
        } catch (JMException ex) {
            if (ex.getCause() instanceof DocumentNotFoundException) {
                deploymentDescriptor = null;
            } else {
                throw ex;
            }
        }
        return new ApplicationInfo(deploymentDescriptor, loadTargetMappings(applicationDeployment),
                moduleInfos.toArray(new ModuleInfo[moduleInfos.size()]));
    }
}