@ParametersAreNonnullByDefault public final class Migrator<T> extends Object
Modifier and Type | Method and Description |
---|---|
static Migrator<DataMapper> |
fromMapper(DataMapper mapper)
Creates a
Migrator that reads a DataMapper . |
static Migrator<InputStream> |
fromXmi(File file)
Creates a
Migrator that reads a XMI file. |
static Migrator<InputStream> |
fromXmi(InputStream stream)
Creates a
Migrator that reads XMI content from an InputStream . |
void |
migrate()
Runs the migration.
|
Migrator<T> |
toMapper(DataMapper mapper)
Specifies the
mapper where to write the data. |
Migrator<T> |
toXmi(File file)
Specifies the XMI
file where to write the data. |
Migrator<T> |
toXmi(File file,
boolean useCompression)
Specifies the XMI
file where to write the data. |
Migrator<T> |
toXmi(OutputStream stream)
Specifies the
stream where to write the data. |
Migrator<T> |
with(EventListener listener)
Adds a pre/post-processing feature.
|
Migrator<T> |
withCounter()
Counts the number of processed events (elements, attributes, references).
|
Migrator<T> |
withLogger()
Logs each event when they occur.
|
Migrator<T> |
withLogger(Level level)
Logs each event when they occur.
|
Migrator<T> |
withProgress()
Displays the progress of the migration at regular intervals.
|
Migrator<T> |
withTimer()
Displays the amount of time spent during the migration.
|
@Nonnull public static Migrator<InputStream> fromXmi(File file) throws IOException
Migrator
that reads a XMI file. The file can be compressed.file
- the XMI file to readIOException
- if an I/O error occurs during the creation@Nonnull public static Migrator<InputStream> fromXmi(InputStream stream) throws IOException
Migrator
that reads XMI content from an InputStream
. The content can be compressed.stream
- the stream of the XMI content to readIOException
- if an I/O error occurs during the creation@Nonnull public static Migrator<DataMapper> fromMapper(DataMapper mapper)
Migrator
that reads a DataMapper
.mapper
- the mapper to read@Nonnull public Migrator<T> toMapper(DataMapper mapper)
mapper
where to write the data.mapper
- the mapper where to write@Nonnull public Migrator<T> toXmi(File file) throws IOException
file
where to write the data.file
- the file where to writeIOException
- if an I/O error occurs during the creationtoXmi(File, boolean)
@Nonnull public Migrator<T> toXmi(File file, boolean useCompression) throws IOException
file
where to write the data.file
- the file where to writeuseCompression
- true
if the XMI file must be compressedIOException
- if an I/O error occurs during the creation@Nonnull public Migrator<T> toXmi(@WillNotClose OutputStream stream) throws IOException
stream
where to write the data.stream
- the file where to writeIOException
- if an I/O error occurs when writing@Nonnull public Migrator<T> with(EventListener listener)
listener
- the listener to add@Nonnull public Migrator<T> withLogger()
@Nonnull public Migrator<T> withLogger(Level level)
level
- the logging level to use@Nonnull public Migrator<T> withCounter()
@Nonnull public Migrator<T> withTimer()
@Nonnull public Migrator<T> withProgress()
WARNING: This feature can only be used when reading a file or a stream.
public void migrate() throws IOException
IOException
- if an I/O error occurs when migratingCopyright © 2013–2019 Atlanmod. All rights reserved.