public class DerbyDistribution extends java.lang.Object implements java.lang.Comparable<DerbyDistribution>
Implementation note: For simplicity distributions off the classes
directory have been forbidden. The main reason for this is that it is
sometimes a hard requirement that you must include only a single JAR from a
distribution on the classpath. One such example is the compatibility test,
where you need the testing code from one distribution and the client driver
from another. While it is possible to support such a configuration running
off the classes
-directory in many scenarios, it complicates
the creation and handling of classpath string. Generating the JARs when
testing on trunk seems like an acceptable price to pay.
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
derbyClientJarPath
Path to derbyclient.jar.
|
private java.lang.String |
derbyEngineJarPath
Path to derby.jar.
|
private java.lang.String |
derbyNetJarPath
Path to derbynet.jar.
|
private java.lang.String |
derbyRunJarPath
Path to derbyrun.jar (may be
null ). |
private static java.io.File[] |
EMPTY_FILE_ARRAY |
static java.lang.String |
JAR_CLIENT |
static java.lang.String |
JAR_ENGINE |
static java.lang.String |
JAR_NET |
static java.lang.String |
JAR_RUN |
static java.lang.String |
JAR_TESTING |
private java.lang.String |
productionClasspath
Production classpath, i.e. all JAR files found except for
derbyTesting.jar.
|
private static java.lang.String[] |
REQUIRED_JARS |
private java.lang.String |
testingClasspath
Testing classpath, i.e. path to derbyTesting.jar.
|
private DerbyVersion |
version
The version of the Derby distribution, i.e. 10.8.1.2.
|
Modifier | Constructor and Description |
---|---|
private |
DerbyDistribution(DerbyVersion version,
java.io.File[] productionJars,
java.io.File[] testingJars)
Derives the information for a Derby distribution.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DerbyDistribution o)
Orders this distribution and the other distribution based on the version.
|
private static java.lang.String |
constructJarClasspath(java.io.File[] jars)
Merges a list of JAR files into a classpath string.
|
java.lang.String |
getDerbyClientJarPath()
Returns the path to
derbyclient.jar . |
java.lang.String |
getDerbyEngineJarPath()
Returns the path to
derby.jar . |
java.lang.String |
getDerbyNetJarPath()
Returns the path to
derbynet.jar . |
java.lang.String |
getDerbyRunJarPath()
Returns the path to
derbyrun.jar . |
java.lang.String |
getFullClassPath()
Returns a classpath with all production and testing JARs.
|
static java.io.File[] |
getJars(java.io.File libDir) |
private java.lang.String |
getPath(java.io.File root,
java.lang.String jar)
Returns the absolute path to the JAR if it exists, otherwise null.
|
java.lang.String |
getProductionClasspath()
Returns a classpath with all production JARs.
|
private static java.io.File[] |
getProductionJars(java.io.File libDir)
Helper method extracting Derby production JARs from a directory.
|
java.lang.String |
getServerClasspath()
Returns a classpath with the network server production JARs.
|
java.lang.String |
getTestingClasspath()
Returns a classpath with all testing JARs.
|
private static java.io.File[] |
getTestingJars(java.io.File libDir)
Helper method extracting Derby testing JARs from a directory.
|
DerbyVersion |
getVersion()
Returns the version of this distribution.
|
boolean |
hasDerbyRunJar()
Tells if this distribution has a
derbyrun.jar . |
private static boolean |
hasRequiredJars(java.util.List jars) |
private static boolean |
isTestingJar(java.lang.String name)
Tells if the given file is a Derby testing JAR.
|
static DerbyDistribution |
newInstance(DerbyVersion version,
java.io.File baseDir)
Returns a distribution with the specified version, based on the given
library directory.
|
static DerbyDistribution |
newInstance(DerbyVersion version,
java.io.File baseDir,
java.io.File testDir)
Returns a distribution with the specified version, based on the given
library and testing directories.
|
private static java.io.File[] EMPTY_FILE_ARRAY
public static final java.lang.String JAR_RUN
public static final java.lang.String JAR_CLIENT
public static final java.lang.String JAR_ENGINE
public static final java.lang.String JAR_NET
public static final java.lang.String JAR_TESTING
private static final java.lang.String[] REQUIRED_JARS
private final DerbyVersion version
private final java.lang.String derbyRunJarPath
null
).private final java.lang.String derbyClientJarPath
private final java.lang.String derbyEngineJarPath
private final java.lang.String derbyNetJarPath
private final java.lang.String productionClasspath
private final java.lang.String testingClasspath
private DerbyDistribution(DerbyVersion version, java.io.File[] productionJars, java.io.File[] testingJars)
java.lang.NullPointerException
- if version is null
newInstance(DerbyVersion, File)
private java.lang.String getPath(java.io.File root, java.lang.String jar)
public boolean hasDerbyRunJar()
derbyrun.jar
.public java.lang.String getDerbyRunJarPath()
derbyrun.jar
.null
if this distribution doesn't come with
derbyrun.jar
.hasDerbyRunJar()
public java.lang.String getDerbyClientJarPath()
derbyclient.jar
.public java.lang.String getDerbyEngineJarPath()
derby.jar
.public java.lang.String getDerbyNetJarPath()
derbynet.jar
.public java.lang.String getServerClasspath()
public java.lang.String getProductionClasspath()
public java.lang.String getTestingClasspath()
public java.lang.String getFullClassPath()
public DerbyVersion getVersion()
public int compareTo(DerbyDistribution o)
compareTo
in interface java.lang.Comparable<DerbyDistribution>
o
- the other distribution1
if this version is newer, 0
if both
distributions have the same version, and -1
if the other
version is newer.private static boolean hasRequiredJars(java.util.List jars)
private static java.io.File[] getProductionJars(java.io.File libDir)
libDir
- directoryprivate static java.io.File[] getTestingJars(java.io.File libDir)
libDir
- directorypublic static java.io.File[] getJars(java.io.File libDir)
private static boolean isTestingJar(java.lang.String name)
name
- name of the filetrue
if a testing JAR, false
otherwiseprivate static java.lang.String constructJarClasspath(java.io.File[] jars)
jars
- JAR files to mergepublic static DerbyDistribution newInstance(DerbyVersion version, java.io.File baseDir)
Returns a distribution with the specified version, based on the given library directory.
It is the responsibility of the caller to ensure that the specified version matches the JARs in the given directory.
version
- the version of the distributionbaseDir
- the base dir for the distribution, holding the Derby JARsnull
if
the specified directory doesn't contain a valid distribution.java.lang.IllegalArgumentException
- if version
is null
public static DerbyDistribution newInstance(DerbyVersion version, java.io.File baseDir, java.io.File testDir)
Returns a distribution with the specified version, based on the given library and testing directories.
It is the responsibility of the caller to ensure that the specified version matches the JARs in the given directories.
version
- the version of the distributionbaseDir
- the directory holding the production JARstestDir
- the directory holding the testing JARnull
if
the specified directories don't make up a valid distribution.java.lang.IllegalArgumentException
- if version
is null
Apache Derby V10.13 Internals - Copyright © 2004,2016 The Apache Software Foundation. All Rights Reserved.