public class AggregateChangeLogGenerator extends Object
<include>
elements inside it referencing other Liquibase
changelog fragments.
This class is chiefly for use by a LiquibaseChangeLogArtifactsProcessor
.
Constructor and Description |
---|
AggregateChangeLogGenerator()
Creates a new
AggregateChangeLogGenerator . |
Modifier and Type | Method and Description |
---|---|
File |
generate(Collection<? extends URL> resources)
Generates a Liquibase changelog file that, from a high level,
logically contains the Liquibase changelog fragments reachable
from the supplied
URL s. |
protected File |
generateEmptyAggregateChangeLogFile()
Generates an empty (temporary)
File that will eventually
contain Liquibase changelog contents. |
File |
getAggregateChangeLogFile()
Returns a
File that either does house or will house
Liquibase changelog contents. |
String |
getCharacterSet() |
String |
getDatabaseChangeLogXsdVersion()
Returns the version of the Liquibase changelog file that will be
generated.
|
Properties |
getProperties()
Returns a
Properties object representing any custom
properties that are to be converted to Liquibase changelog
parameters. |
protected URL |
getResource(String name)
Loads a notional resource with the given
name from the
classpath. |
String |
getTemplate()
Returns the source code of an MVEL
template that represents the skeleton of a Liquibase
changelog into which will be placed
<include> elements. |
void |
setAggregateChangeLogFile(File file)
Installs a
File representing the path to a file that will
be erased and that will eventually contain Liquibase changelog
contents. |
void |
setCharacterSet(String characterSet) |
void |
setDatabaseChangeLogXsdVersion(String version)
Sets the version of the Liquibase changelog file that will be
generated.
|
void |
setProperties(Properties properties)
Installs a
Properties object that represents custom
properties that are to be converted to Liquibase changelog
parameters. |
void |
setTemplate(String template)
Sets the source code of an MVEL template that will be used to
produce a Liquibase changelog.
|
public AggregateChangeLogGenerator()
AggregateChangeLogGenerator
.public String getDatabaseChangeLogXsdVersion()
This method may return null
in which case "3.3
" will be used internally instead.
By default, "3.3
" is returned, and this default value
will change when Liquibase is updated and this project is updated
to depend on it.
null
setDatabaseChangeLogXsdVersion(String)
public void setDatabaseChangeLogXsdVersion(String version)
version
- the new version; may be null
getDatabaseChangeLogXsdVersion()
protected URL getResource(String name)
name
from the
classpath.
The default implementation invokes the ClassLoader.getResource(String)
method on the supplied String
using, in order:
ClassLoader
ClassLoader
The first of these ClassLoader
s to return a non-null
value will have its result returned. Otherwise, the return
value of ClassLoader.getSystemResource(String)
is
returned.
name
- the name of the resource to load; may be null
in which case null
will be returnednull
ClassLoader.getResource(String)
public Properties getProperties()
Properties
object representing any custom
properties that are to be converted to Liquibase changelog
parameters.
This method may return null
.
Properties
object representing custom
properties, or null
setProperties(Properties)
public void setProperties(Properties properties)
Properties
object that represents custom
properties that are to be converted to Liquibase changelog
parameters.properties
- the Properties
to be installed; may be
null
getProperties()
public String getCharacterSet()
public void setCharacterSet(String characterSet)
public String getTemplate()
<include>
elements.
This method will not return null
and overrides of it
must not either.
null
String
containing the source
code of an MVEL
templatepublic void setTemplate(String template)
template
- the new source code; must not be null
IllegalArgumentException
- if template
is null
getTemplate()
public File getAggregateChangeLogFile()
File
that either does house or will house
Liquibase changelog contents.
This method may return null
.
This method may generate such a file.
File
representing the aggregate changelog, or
null
generateEmptyAggregateChangeLogFile()
public void setAggregateChangeLogFile(File file)
File
representing the path to a file that will
be erased and that will eventually contain Liquibase changelog
contents.file
- a path to a file that will be used as the Liquibase
changelog file generated by this AggregateChangeLogGenerator
; may be null
protected File generateEmptyAggregateChangeLogFile() throws IOException
File
that will eventually
contain Liquibase changelog contents.
This implementation calls File.createTempFile(String,
String)
with changelog
and .tmp.xml
as its
arguments, instructs the File
so created to be
deleted when the Java Virtual
Machine exits and returns the result.
null
File
IOException
- if an error occurspublic File generate(Collection<? extends URL> resources) throws IOException
URL
s.
This method never returns null
.
resources
- a Collection
of URL
s, each
element of which resolves to a Liquibase changelog file; may be
null
or empty in whihc
case a generally useless changelog will be generatednull
File
representing the path to
the generated fileIOException
- if an error occursIllegalStateException
- if somehow the File
into
which content will be poured is null
getAggregateChangeLogFile()
,
generateEmptyAggregateChangeLogFile()
Copyright © 2014–2015, Laird Nelson. All rights reserved.