public class ImportMigrationContextImpl extends MigrationContextImpl<MigrationReport> implements ImportMigrationContext
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
Constructor and Description |
---|
ImportMigrationContextImpl(MigrationReport report,
MigrationZipFile zip)
Creates a new migration context for an import operation representing a system context.
|
ImportMigrationContextImpl(MigrationReport report,
MigrationZipFile zip,
Migratable migratable)
Creates a new migration context for an import operation.
|
ImportMigrationContextImpl(MigrationReport report,
MigrationZipFile zip,
String id)
Creates a new migration context for an import operation.
|
Modifier and Type | Method and Description |
---|---|
Stream<ImportMigrationEntry> |
entries()
Retrieves all exported migration entries.
|
Stream<ImportMigrationEntry> |
entries(Path path)
Retrieves all exported migration entries located underneath the provided relative path.
|
Stream<ImportMigrationEntry> |
entries(Path path,
PathMatcher filter)
Retrieves all exported migration entries located underneath the provided relative path that
matches the provided path filter.
|
boolean |
equals(Object o)
The superclass implementation is sufficient for our needs.
|
ImportMigrationEntry |
getEntry(Path path)
Retrieves a migration entry that was exported by the corresponding migratable with the given
path.
|
Optional<ImportMigrationEntry> |
getSystemPropertyReferencedEntry(String name)
Retrieves a migration entry referenced from a given system property that was exported by the
corresponding migratable.
|
int |
hashCode()
The superclass implementation is sufficient for our needs.
|
protected void |
processMetadata(Map<String,Object> metadata) |
getId, getReport, getVersion
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
getId, getReport
public ImportMigrationContextImpl(MigrationReport report, MigrationZipFile zip)
report
- the migration report where warnings and errors can be recordedzip
- the zip file associated with the importIllegalArgumentException
- if report
or zip
is null
IOError
- if unable to determine ${ddf.home}public ImportMigrationContextImpl(MigrationReport report, MigrationZipFile zip, String id)
report
- the migration report where warnings and errors can be recordedzip
- the zip file associated with the importid
- the migratable idIllegalArgumentException
- if report
, zip
, or id
is null
IOError
- if unable to determine ${ddf.home}public ImportMigrationContextImpl(MigrationReport report, MigrationZipFile zip, Migratable migratable)
report
- the migration report where warnings and errors can be recordedzip
- the zip file associated with the importmigratable
- the migratable this context is forIllegalArgumentException
- if report
, zip
or migratable
is null
IOError
- if unable to determine ${ddf.home}public Optional<ImportMigrationEntry> getSystemPropertyReferencedEntry(String name)
ImportMigrationContext
The entry returned would be an entry representing the file that was referenced by the specified system property value on the exported system. For example:
If system properties defined the following mapping: javax.net.ssl.keyStore=etc/keystores/serverKeystore.jks
then the following code:
final Optional<ImportMigrationEntry> entry = context.getSystemPropertyReferenceEntry("javax.net.ssl.keyStore");
would return an entry representing the exported file etc/keystores/serverKeystore.jks
allowing the migratable a chance to restore it in its original location and verifying
that the system property is still defined with the same value after the import operation has
completed.
getSystemPropertyReferencedEntry
in interface ImportMigrationContext
name
- the name of the system property referencing a migration entry to retrievepublic ImportMigrationEntry getEntry(Path path)
ImportMigrationContext
A "fake" entry will still be returned if the requested path was not exported. Errors will be
recorded when storing the file later using one of the restore()
methods or an
exception will be thrown out when attempting to retrieve the corresponding input stream.
getEntry
in interface ImportMigrationContext
path
- the path of the file that was exported (must be relative to ${ddf.home} to match an
exported entry otherwise an error or a warning will be recorded later when an attempt is
made to restored to returned migration entry)public Stream<ImportMigrationEntry> entries()
ImportMigrationContext
entries
in interface ImportMigrationContext
public Stream<ImportMigrationEntry> entries(Path path)
ImportMigrationContext
entries
in interface ImportMigrationContext
path
- the path to the directory for all recursively exported files (must be relative to
${ddf.home} otherwise no entries will be found)path
public Stream<ImportMigrationEntry> entries(Path path, PathMatcher filter)
ImportMigrationContext
entries
in interface ImportMigrationContext
path
- the path to the directory to recursively search for exported files that match the
given filter (must be relative to ${ddf.home} otherwise no entries will be found)filter
- the path filter to usepath
that matches the
given filterprotected void processMetadata(Map<String,Object> metadata)
processMetadata
in class MigrationContextImpl<MigrationReport>
public boolean equals(Object o)
equals
in class MigrationContextImpl<MigrationReport>
o
- the object to checkpublic int hashCode()
hashCode
in class MigrationContextImpl<MigrationReport>
This work is licensed under a Creative Commons Attribution 4.0 International License.