001/*
002 * ModeShape (http://www.modeshape.org)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.modeshape.jdbc;
017
018/**
019 * Information about the driver.
020 */
021public final class DriverInfo {
022
023    private final String name;
024    private final String vendorName;
025    private final String vendorUrl;
026    private final String version;
027    private final int majorVersion;
028    private final int minorVersion;
029
030    public DriverInfo( String name,
031                       String vendorName,
032                       String vendorUrl,
033                       String version ) {
034        this.name = name;
035        this.vendorName = vendorName;
036        this.vendorUrl = vendorUrl;
037        this.version = version;
038        String[] coords = getVersion().split("[.-]");
039        this.majorVersion = coords.length > 0 && coords[0] != null ? Integer.parseInt(coords[0]) : 0;
040        this.minorVersion = coords.length > 1 && coords[1] != null ? Integer.parseInt(coords[1]) : 0;
041    }
042
043    public String getVendorName() {
044        return vendorName;
045    }
046
047    public String getVendorUrl() {
048        return vendorUrl;
049    }
050
051    public String getVersion() {
052        return version;
053    }
054
055    public int getMajorVersion() {
056        return majorVersion;
057    }
058
059    public int getMinorVersion() {
060        return minorVersion;
061    }
062
063    public String getName() {
064        return name;
065    }
066}