Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source.
   * Copyright 2010, Red Hat, Inc., and individual contributors
   * as indicated by the @author tags. See the copyright.txt file in the
   * distribution for a full listing of individual contributors.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
  * the License, or (at your option) any later version.
  *
  * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.jboss.as.connector.services.driver;
 
Metadata describing a JDBC driver that has been installed as a service in the runtime.

Author(s):
Brian Stansberry (c) 2011 Red Hat Inc.
 
 public final class InstalledDriver {
 
     private final String driverName;
     private final ModuleIdentifier moduleName;
     private final String deploymentUnitName;
     private final String driverClassName;
     private final String dataSourceClassName;
     private final String xaDataSourceClassName;
     private final int majorVersion;
     private final int minorVersion;
     private final boolean jdbcCompliant;

    
Creates a new InstalledDriver for a driver that was loaded from the module path.

Parameters:
driverName the symbolic name of the driver was loaded
moduleName the name of the module from which the driver was loaded
driverClassName the name of the java.sql.Driver implementation class
dataSourceClassName the name of the javax.sql.DataSource implementation class
xaDataSourceClassName the name of the javax.sql.XADataSource implementation class
majorVersion the driver major version
minorVersion the driver minor version
jdbcCompliant whether the driver is JDBC compliant
 
     public InstalledDriver(final String driverNamefinal ModuleIdentifier moduleNamefinal String driverClassName,
                            final String dataSourceClassNamefinal String xaDataSourceClassName,
                            final int majorVersionfinal int minorVersionfinal boolean jdbcCompliant) {
         this. = null;
         this. = moduleName;
         this. = driverName;
         this. = driverClassName;
         this. = dataSourceClassName;
         this. = xaDataSourceClassName;
         this. = majorVersion;
         this. = minorVersion;
         this. = jdbcCompliant;
     }

    
Creates a new InstalledDriver for a driver that was installed from a deployment.

Parameters:
deploymentUnitName the name of the deployment unit from which the driver was installed
driverClassName the name of the java.sql.Driver implementation class
dataSourceClassName the name of the javax.sql.DataSource implementation class
xaDataSourceClassName the name of the javax.sql.XADataSource implementation class
majorVersion the driver major version
minorVersion the driver minor version
jdbcCompliant whether the driver is JDBC compliant
 
     public InstalledDriver(final String deploymentUnitNamefinal String driverClassName,
                            final String dataSourceClassNamefinal String xaDataSourceClassName,
                            final int majorVersionfinal int minorVersionfinal boolean jdbcCompliant) {
         this. = deploymentUnitName;
         this. = null;
         this. = deploymentUnitName;
         this. = driverClassName;
         this. = dataSourceClassName;
         this. = xaDataSourceClassName;
         this. = majorVersion;
         this. = minorVersion;
         this. = jdbcCompliant;
 
    }

    
Gets the name of the module from which the driver was loaded, if it was loaded from the module path.

Returns:
the module name, or null if isFromDeployment() returns true
    public ModuleIdentifier getModuleName() {
        return ;
    }

    
Gets the name of the deployment unit from which the driver was loaded, if it was loaded from a deployment.

Returns:
the deployment unit name, or null if isFromDeployment() returns false
    public String getDeploymentUnitName() {
        return ;
    }

    
Gets the fully qualified class name of the driver's implementation of java.sql.Driver

Returns:
the class name. Will not be null
    public String getDriverClassName() {
        return ;
    }

    
Gets the driver's major version number.

Returns:
the major version number
    public int getMajorVersion() {
        return ;
    }

    
Gets the driver's minor version number.

Returns:
the minor version number
    public int getMinorVersion() {
        return ;
    }

    
Gets whether the driver is JDBC compliant.

Returns:
true if the driver is JDBC compliant; false if not
    public boolean isJdbcCompliant() {
        return ;
    }

    
Gets whether the driver was loaded from a deployment unit.

Returns:
true if the driver was loaded from a deployment unit; false if it was loaded from a module on the module path
    public boolean isFromDeployment() {
        return  != null;
    }
    @Override
    public boolean equals(Object o) {
        if (this == oreturn true;
        if (o == null || getClass() != o.getClass()) return false;
        InstalledDriver that = (InstalledDrivero;
        if ( != that.jdbcCompliantreturn false;
        if ( != that.majorVersionreturn false;
        if ( != that.minorVersionreturn false;
        if ( != null ? !.equals(that.dataSourceClassName) : that.dataSourceClassName != null)
            return false;
        if ( != null ? !.equals(that.deploymentUnitName) : that.deploymentUnitName != null)
            return false;
        if ( != null ? !.equals(that.driverClassName) : that.driverClassName != null)
            return false;
        if ( != null ? !.equals(that.driverName) : that.driverName != nullreturn false;
        if ( != null ? !.equals(that.moduleName) : that.moduleName != nullreturn false;
        if ( != null ? !.equals(that.xaDataSourceClassName) : that.xaDataSourceClassName != null)
            return false;
        return true;
    }
    @Override
    public int hashCode() {
        int result =  != null ? .hashCode() : 0;
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ;
        result = 31 * result + ;
        result = 31 * result + ( ? 1 : 0);
        return result;
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        if ( != null) {
            sb.append();
        } else {
            sb.append();
        }
        sb.append(':');
        sb.append();
        sb.append('#');
        sb.append();
        sb.append('#');
        sb.append();
        return sb.toString();
    }
    public String getDriverName() {
        return ;
    }
    public String getDataSourceClassName() {
        return ;
    }
    public String getXaDataSourceClassName() {
        return ;
    }
New to GrepCode? Check out our FAQ X