public class ExportMigrationContextImpl extends MigrationContextImpl<ExportMigrationReportImpl> implements ExportMigrationContext, Closeable
CURRENT_VERSION, id, METADATA_DATE, METADATA_DDF_HOME, METADATA_DESCRIPTION, METADATA_EXTERNALS, METADATA_FILENAME, METADATA_FILES, METADATA_FOLDERS, METADATA_JAVA_PROPERTIES, METADATA_MIGRATABLES, METADATA_ORGANIZATION, METADATA_PRODUCT_BRANDING, METADATA_PRODUCT_VERSION, METADATA_SYSTEM_PROPERTIES, METADATA_TITLE, METADATA_VERSION, migratable, report| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Stream<ExportMigrationEntry> |
entries(Path path)
Recursively walks the provided path's tree to create or retrieve (if already created) entries
for all files found and returns existing or new migration entries for each one of them.
|
Stream<ExportMigrationEntry> |
entries(Path path,
PathMatcher filter)
Recursively walks the provided path's tree to create or retrieve (if already created) entries
for all files found that match the provided path filter and returns existing or new migration
entries for each one of them.
|
boolean |
equals(Object o)
The superclass implementation is sufficient for our needs.
|
ExportMigrationEntry |
getEntry(Path path)
Creates or retrieves (if already created) a migration entry to be exported by the corresponding
migratable corresponding to the specified path.
|
Optional<ExportMigrationEntry> |
getSystemPropertyReferencedEntry(String name)
Creates or retrieves (if already created) a migration entry referenced from the specified
system property to be exported by the corresponding migratable.
|
Optional<ExportMigrationEntry> |
getSystemPropertyReferencedEntry(String name,
BiPredicate<MigrationReport,String> validator)
Creates or retrieves (if already created) a migration entry referenced from the specified
system property to be exported by the corresponding migratable.
|
int |
hashCode()
The superclass implementation is sufficient for our needs.
|
getId, getReport, getVersion, processMetadataclone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetId, getReportpublic Optional<ExportMigrationEntry> getSystemPropertyReferencedEntry(String name)
ExportMigrationContextAn error will automatically be recorded with the associated migration report if the system property is not defined or its value is blank.
Note: The file referenced from the property is assumed to be relative to ${ddf.home} if not defined as absolute. All paths will automatically be relativized from ${ddf.home} if located underneath.
The entry returned would be an entry representing the file that was referenced by the specified system property value on the current system. For example:
If system properties defines the following mapping: javax.net.ssl.keyStore=etc/keystores/serverKeystore.jks
when the following code:
final Optional<ExportMigrationEntry> entry
= context.getSystemPropertyReferenceEntry("javax.net.ssl.keyStore");
would return an entry representing the local file etc/keystores/serverKeystore.jks
giving the migratable a chance to export it alongside the original system property
value so it can be later restored and the property value can be verified after the import
operation such that it would still be defined with the same value.
getSystemPropertyReferencedEntry in interface ExportMigrationContextname - the name of the system property referencing a migration entry to create or retrievepublic Optional<ExportMigrationEntry> getSystemPropertyReferencedEntry(String name, BiPredicate<MigrationReport,String> validator)
ExportMigrationContextThe provided predicate is always invoked (as long as the entry was not previously created)
to validate the property value which may be null if not defined. Returning
false will abort the process and yield an Optional.empty() being returned out of
this method. In such case, it is up to the validator to record any required errors or warnings.
Returning true from the predicate will allow for a new entry to be created for the
corresponding system property unless the property is not defined or its value is blank in which
case an error will be recorded and an Optional.empty() is returned from this method. In
other words:
false, no migration entry is created and no error
is recorded.
true and ...
Note: The file referenced from the property is assumed to be relative to ${ddf.home} if not defined as absolute. All paths will automatically be relativized from ${ddf.home} if located underneath.
getSystemPropertyReferencedEntry in interface ExportMigrationContextname - the name of the system property referencing a migration entry to create or retrievevalidator - a predicate to be invoked to validate the property value further which must
return true to have a migration entry created and returnedpublic ExportMigrationEntry getEntry(Path path)
ExportMigrationContextNote: The file referenced is assumed to be relative to ${ddf.home} if not defined as absolute. All paths will automatically be relativized from ${ddf.home} if located underneath.
getEntry in interface ExportMigrationContextpath - the path of the file to be exportedpublic Stream<ExportMigrationEntry> entries(Path path)
ExportMigrationContextNote: Files referenced are assumed to be relative to ${ddf.home} if not defined as absolute. All paths will automatically be relativized from ${ddf.home} if located underneath.
entries in interface ExportMigrationContextpath - the path to the directory to recursively walkpathpublic Stream<ExportMigrationEntry> entries(Path path, PathMatcher filter)
ExportMigrationContextNote: Files referenced are assumed to be relative to ${ddf.home} if not defined as absolute. All paths will automatically be relativized from ${ddf.home} if located underneath.
entries in interface ExportMigrationContextpath - the path to the directory to recursively walkfilter - the path filter to usepath which matches the given filterpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic boolean equals(Object o)
equals in class MigrationContextImpl<ExportMigrationReportImpl>o - the object to checkpublic int hashCode()
hashCode in class MigrationContextImpl<ExportMigrationReportImpl>This work is licensed under a Creative Commons Attribution 4.0 International License.