public abstract class ImportMigrationPropertyReferencedEntryImpl extends ImportMigrationEntryImpl
restoredMETADATA_CHECKSUM, METADATA_FILES, METADATA_FILTERED, METADATA_FOLDER, METADATA_LAST_MODIFIED, METADATA_NAME, METADATA_PROPERTY, METADATA_REFERENCE, METADATA_SOFTLINK| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(MigrationEntry me) |
boolean |
equals(Object o)
The superclass implementation is sufficient for our needs.
|
protected Optional<InputStream> |
getInputStream(boolean checkAccess) |
long |
getLastModifiedTime()
Gets the last modification time of the entry.
|
Optional<ImportMigrationEntry> |
getPropertyReferencedEntry(String name)
Retrieves a migration entry referenced from a property value defined in the properties file
associated with this migration entry.
|
int |
hashCode()
The superclass implementation is sufficient for our needs.
|
boolean |
isDirectory()
Tests whether this entry represents a directory.
|
boolean |
isFile()
Tests whether this entry represents a file.
|
boolean |
restore(BiThrowingConsumer<MigrationReport,Optional<InputStream>,IOException> consumer)
Restores this required entry's content appropriately based on this entry's path which can
include sub-directories using the specified consumer.
|
boolean |
restore(boolean required)
Restores this entry's content underneath the distribution root directory based on this entry's
path which can include sub-directories.
|
boolean |
restore(boolean required,
PathMatcher filter)
Restores all entries that recursively match the provided path filter underneath the
distribution root directory based on this entry's path which can include sub-directories.
|
protected abstract void |
verifyPropertyAfterCompletion()
Called after the referenced migration entry is restored to register code to be invoked after
the migration operation completion to verify if the property value references the referenced
migration entry.
|
getAbsolutePath, getContext, getFile, getInputStream, getName, getPath, getReport, toDebugStringgetId, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitrestore, restoregetIdpublic long getLastModifiedTime()
MigrationEntrygetLastModifiedTime in interface MigrationEntrygetLastModifiedTime in class ImportMigrationEntryImplpublic boolean isFile()
MigrationEntryisFile in interface MigrationEntryisFile in class ImportMigrationEntryImpltrue if and only if the entry represents a file; false
otherwisepublic boolean isDirectory()
MigrationEntryisDirectory in interface MigrationEntryisDirectory in class ImportMigrationEntryImpltrue if and only if the entry represents a directory; false
otherwisepublic boolean restore(boolean required)
ImportMigrationEntryThis entry's sub-directories (if any) will be created if they don't already exist. The destination file will be overwritten if it already exists.
All errors and warnings are automatically recorded with the associated migration report.
Errors can be reported in two ways:
MigrationException
(e.g. failure to write to the exported file)
false
is returned from this method. This allows for the accumulation of as many issues
as possible to report to the user before aborting the operation.
Note: If this entry represents a directory which had been completely exported using
ExportMigrationEntry.store() or ExportMigrationEntry.store(boolean) then in
addition to restoring all entries recursively, calling this method will also remove any
existing files or directories that were not on the original system.
Note: Calling restore() twice will not restore the entry two times. The
second time it is called, the same result will be returned as the first time no matter which
restore() method was called.
restore in interface ImportMigrationEntryrestore in class ImportMigrationEntryImplrequired - true if the file or directory is required to exist in the export
and if it doesn't an error should be recorded; false if the file or directory
is optional and may not be exported in which case calling this method will do nothingtrue if no errors were recorded as a result of processing this command;
false otherwisepublic boolean restore(boolean required,
PathMatcher filter)
ImportMigrationEntryrequired
parameter is interpreted for recording errors and deciding what to return.
This entry's sub-directories (if any) will be created if they don't already exist. The destination file will be overwritten if it already exists.
All errors and warnings are automatically recorded with the associated migration report.
Errors can be reported in two ways:
MigrationException
(e.g. failure to write to the exported file)
false
is returned from this method. This allows for the accumulation of as many issues
as possible to report to the user before aborting the operation.
Note: Calling restore() twice will not restore the entry two times. The
second time it is called, the same result will be returned as the first time no matter which
restore() method was called.
restore in interface ImportMigrationEntryrestore in class ImportMigrationEntryImplrequired - true if the file or directory is required to exist in the export
and if it doesn't an error should be recorded; false if the file or directory
is optional and may not be exported in which case calling this method will do nothingfilter - the path filter to usetrue if no errors were recorded as a result of processing this command;
false otherwisepublic boolean restore(BiThrowingConsumer<MigrationReport,Optional<InputStream>,IOException> consumer)
ImportMigrationEntryAll errors and warnings are automatically recorded with the associated migration report including those thrown by the consumer logic.
Errors can be reported in two ways:
MigrationException
(e.g. failure to read from the exported file)
false
is returned from this method. This allows for the accumulation of as many issues
as possible to report to the user before aborting the operation.
Note: The input stream will automatically be closed (if not closed already) when the operation completes successfully or not.
restore in interface ImportMigrationEntryrestore in class ImportMigrationEntryImplconsumer - a consumer capable of importing the content of this entry from a provided input
stream which might be empty if the entry was not exported or if the entry represents a
directory (otherwise an error will automatically be recorded)true if no errors were recorded as a result of processing this command;
false otherwisepublic Optional<ImportMigrationEntry> getPropertyReferencedEntry(String name)
ImportMigrationEntryThe entry returned would be an entry representing the file that was referenced by the specified property value in the java properties file represented by this entry on the exported system. For example:
If the properties file (e.g. etc/ws-security/server/encryption.properties) represented by this entry defined the following mapping: org.apache.ws.security.crypto.merlin.x509crl.file=etc/certs/demoCA/crl/crl.pem
then the following code:
final ImportMigrationEntry entry
= context.getEntry("etc/ws-security/server/encryption.properties");
final Optional<ImportMigrationEntry> entry2
= entry.getPropertyReferenceEntry("org.apache.ws.security.crypto.merlin.x509crl.file");
would return an entry representing the exported file etc/certs/demoCA/crl/crl.pem
allowing the migratable a chance to restore it in its original location and verifying
that the property in the local etc/ws-security/server/encryption.properties file is still
defined with the same value after the import operation has completed.
getPropertyReferencedEntry in interface ImportMigrationEntrygetPropertyReferencedEntry in class ImportMigrationEntryImplname - the name of the property that contains the reference to a migration entryname in
the properties file referenced by this entry or empty if it was not exportedpublic int hashCode()
ImportMigrationEntryImplhashCode in class ImportMigrationEntryImplpublic boolean equals(@Nullable Object o)
ImportMigrationEntryImplequals in class ImportMigrationEntryImplo - the object to checkpublic int compareTo(@Nullable MigrationEntry me)
compareTo in interface Comparable<MigrationEntry>compareTo in class MigrationEntryImplprotected Optional<InputStream> getInputStream(boolean checkAccess) throws IOException
getInputStream in class ImportMigrationEntryImplIOExceptionprotected abstract void verifyPropertyAfterCompletion()
This work is licensed under a Creative Commons Attribution 4.0 International License.