Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 
 package org.jboss.as.connector.subsystems.datasources;
 
import static org.jboss.as.connector.subsystems.datasources.Constants.DEPLOYMENT_NAME;
import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_CLASS_NAME;
import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_MAJOR_VERSION;
import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_MINOR_VERSION;
import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_MODULE_NAME;
import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_NAME;
import static org.jboss.as.connector.subsystems.datasources.Constants.DRIVER_XA_DATASOURCE_CLASS_NAME;
import static org.jboss.as.connector.subsystems.datasources.Constants.JDBC_COMPLIANT;
import static org.jboss.as.connector.subsystems.datasources.Constants.JDBC_DRIVER_NAME;
import static org.jboss.as.connector.subsystems.datasources.Constants.MODULE_SLOT;

Reads the "installed-drivers" attribute.

Author(s):
Brian Stansberry (c) 2011 Red Hat Inc.
    private final ParametersValidator validator = new ParametersValidator();
    }
    @Override
    public void execute(final OperationContext contextfinal ModelNode operationthrows OperationFailedException {
        .validate(operation);
        final String name = operation.require(.getName()).asString();
        if (context.getType() == ..) {
            context.addStep(new OperationStepHandler() {
                @Override
                public void execute(final OperationContext contextfinal ModelNode operationthrows OperationFailedException {
                    ServiceController<?> sc = context.getServiceRegistry(false).getRequiredService(
                            .);
                    DriverRegistry driverRegistry = DriverRegistry.class.cast(sc.getValue());
                    ModelNode result = new ModelNode();
                    InstalledDriver driver = driverRegistry.getInstalledDriver(name);
                    ModelNode driverNode = new ModelNode();
                    driverNode.get(.getName()).set(driver.getDriverName());
                    if (driver.isFromDeployment()) {
                        driverNode.get().set(driver.getDriverName());
                        driverNode.get(.getName());
                        driverNode.get();
                        driverNode.get(.getName());
                    } else {
                        driverNode.get();
                        driverNode.get(.getName()).set(driver.getModuleName().getName());
                        driverNode.get().set(driver.getModuleName() != null ? driver.getModuleName().getSlot() : "");
                        driverNode.get(.getName()).set(driver.getXaDataSourceClassName());
                    }
                    driverNode.get(.getName()).set(driver.getDriverClassName());
                    driverNode.get(.getName()).set(driver.getMajorVersion());
                    driverNode.get(.getName()).set(driver.getMinorVersion());
                    driverNode.get().set(driver.isJdbcCompliant());
                    result.add(driverNode);
                    context.getResult().set(result);
                    context.completeStep();
                }
            }, ..);
        }
        context.completeStep();
    }
New to GrepCode? Check out our FAQ X