Example usage for javax.enterprise.deploy.shared ModuleType RAR

List of usage examples for javax.enterprise.deploy.shared ModuleType RAR

Introduction

In this page you can find the example usage for javax.enterprise.deploy.shared ModuleType RAR.

Prototype

ModuleType RAR

To view the source code for javax.enterprise.deploy.shared ModuleType RAR.

Click Source Link

Document

The module is an Connector archive.

Usage

From source file:org.apache.geronimo.console.databasemanager.wizard.DatabasePoolPortlet.java

private void delete(PortletRequest request, ActionResponse response, PoolData data) {
    // check to make sure the abstract name does not begin with 'org.apache.geronimo.configs'
    // if it does not - then delete it -- otherwise it is a system database
    if (data.getAbstractName() != null) {
        boolean isSystemDatabasePool = (data.getAbstractName().indexOf("org.apache.geronimo.configs") == 0);

        if (!isSystemDatabasePool) {
            DeploymentManager mgr = ManagementHelper.getManagementHelper(request).getDeploymentManager();
            try {
                // retrieve all running modules
                TargetModuleID[] runningIds = mgr.getRunningModules(ModuleType.RAR, mgr.getTargets());

                // index of module to keep
                int index = -1;

                // only keep module id that is associated with selected DB pool
                for (int i = 0; i < runningIds.length; i++) {
                    if (data.getAbstractName().contains(runningIds[i].getModuleID())) {
                        index = i;/* w  w w  .  j  a v a2s.c o  m*/
                        break;
                    }
                }
                TargetModuleID[] ids = { runningIds[index] };

                // undeploy the db pool
                ProgressObject po = mgr.undeploy(ids);
                waitForProgress(po);

                if (po.getDeploymentStatus().isCompleted()) {
                    log.info("Undeployment completed successfully!");
                }
            } catch (Exception e) {
                log.error("Undeployment unsuccessful!");
            } finally {
                if (mgr != null)
                    mgr.release();
            }
        }
    }
}