Package org.apache.tomcat.jakartaee
Class Migration
- java.lang.Object
-
- org.apache.tomcat.jakartaee.Migration
-
public class Migration extends java.lang.Object
The main class for the Migration tool.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Migration.MigrationZipArchiveEntry
static class
Migration.State
The tool state.
-
Field Summary
Fields Modifier and Type Field Description private boolean
converted
private java.util.List<Converter>
converters
private static java.util.Set<java.lang.String>
DEFAULT_EXCLUDES
private java.io.File
destination
private boolean
enableDefaultExcludes
private java.util.Set<java.lang.String>
excludes
private static org.apache.commons.compress.archivers.zip.ZipShort
EXTRA_FIELD_ZIP64
private static java.util.logging.Logger
logger
private boolean
matchExcludesAgainstPathName
private EESpecProfile
profile
private static StringManager
sm
private java.io.File
source
private Migration.State
state
private static long
ZIP64_THRESHOLD_LENGTH
private boolean
zipInMemory
-
Constructor Summary
Constructors Constructor Description Migration()
Construct a new migration tool instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addExclude(java.lang.String exclude)
Add specified resource exclusion.void
execute()
Execute migration operation.EESpecProfile
getEESpecProfile()
Get the Jakarta EE profile being used.boolean
hasConverted()
NOTE: this method is not to indicate that no changes were made, but that the source can be used and satisfy the selected profile.private boolean
isArchive(java.lang.String fileName)
private boolean
isExcluded(java.lang.String name)
private boolean
isSignatureFile(java.lang.String sourceName)
private void
migrateArchiveInMemory(java.io.InputStream src, java.io.OutputStream dest)
private void
migrateArchiveStreaming(java.io.InputStream src, java.io.OutputStream dest)
private void
migrateDirectory(java.io.File src, java.io.File dest)
private void
migrateFile(java.io.File src, java.io.File dest)
private void
migrateStream(java.lang.String name, java.io.InputStream src, java.io.OutputStream dest)
void
setDestination(java.io.File destination)
Set destination file.void
setEESpecProfile(EESpecProfile profile)
Set the Jakarta EE specifications that should be used.void
setEnableDefaultExcludes(boolean enableDefaultExcludes)
Enable the default exclusion list for the tool.void
setMatchExcludesAgainstPathName(boolean matchExcludesAgainstPathName)
Enable exclude matching against the path name.void
setSource(java.io.File source)
Set source file.void
setZipInMemory(boolean zipInMemory)
Buffer all conversion operations for compressed archives in memory.
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
sm
private static final StringManager sm
-
DEFAULT_EXCLUDES
private static final java.util.Set<java.lang.String> DEFAULT_EXCLUDES
-
EXTRA_FIELD_ZIP64
private static final org.apache.commons.compress.archivers.zip.ZipShort EXTRA_FIELD_ZIP64
-
ZIP64_THRESHOLD_LENGTH
private static final long ZIP64_THRESHOLD_LENGTH
- See Also:
- Constant Field Values
-
profile
private EESpecProfile profile
-
enableDefaultExcludes
private boolean enableDefaultExcludes
-
matchExcludesAgainstPathName
private boolean matchExcludesAgainstPathName
-
zipInMemory
private boolean zipInMemory
-
converted
private boolean converted
-
state
private Migration.State state
-
source
private java.io.File source
-
destination
private java.io.File destination
-
converters
private final java.util.List<Converter> converters
-
excludes
private final java.util.Set<java.lang.String> excludes
-
-
Method Detail
-
setEESpecProfile
public void setEESpecProfile(EESpecProfile profile)
Set the Jakarta EE specifications that should be used.- Parameters:
profile
- the Jakarta EE specification profile
-
getEESpecProfile
public EESpecProfile getEESpecProfile()
Get the Jakarta EE profile being used.- Returns:
- the profile
-
setEnableDefaultExcludes
public void setEnableDefaultExcludes(boolean enableDefaultExcludes)
Enable the default exclusion list for the tool.- Parameters:
enableDefaultExcludes
- true to enable the default
-
setMatchExcludesAgainstPathName
public void setMatchExcludesAgainstPathName(boolean matchExcludesAgainstPathName)
Enable exclude matching against the path name.- Parameters:
matchExcludesAgainstPathName
- true to match excludes against the path name instead of the file name
-
setZipInMemory
public void setZipInMemory(boolean zipInMemory)
Buffer all conversion operations for compressed archives in memory.- Parameters:
zipInMemory
- true to buffer in memory
-
addExclude
public void addExclude(java.lang.String exclude)
Add specified resource exclusion.- Parameters:
exclude
- the exclude to add
-
setSource
public void setSource(java.io.File source)
Set source file.- Parameters:
source
- the source file
-
setDestination
public void setDestination(java.io.File destination)
Set destination file.- Parameters:
destination
- the destination file
-
hasConverted
public boolean hasConverted()
NOTE: this method is not to indicate that no changes were made, but that the source can be used and satisfy the selected profile.- Returns:
- true if converted occurs
-
execute
public void execute() throws java.io.IOException
Execute migration operation.- Throws:
java.io.IOException
- when an exception occurs
-
migrateDirectory
private void migrateDirectory(java.io.File src, java.io.File dest) throws java.io.IOException
- Throws:
java.io.IOException
-
migrateFile
private void migrateFile(java.io.File src, java.io.File dest) throws java.io.IOException
- Throws:
java.io.IOException
-
migrateArchiveStreaming
private void migrateArchiveStreaming(java.io.InputStream src, java.io.OutputStream dest) throws java.io.IOException
- Throws:
java.io.IOException
-
migrateArchiveInMemory
private void migrateArchiveInMemory(java.io.InputStream src, java.io.OutputStream dest) throws java.io.IOException
- Throws:
java.io.IOException
-
isSignatureFile
private boolean isSignatureFile(java.lang.String sourceName)
-
migrateStream
private void migrateStream(java.lang.String name, java.io.InputStream src, java.io.OutputStream dest) throws java.io.IOException
- Throws:
java.io.IOException
-
isArchive
private boolean isArchive(java.lang.String fileName)
-
isExcluded
private boolean isExcluded(java.lang.String name)
-
-