public abstract class IUpgrader
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private java.lang.String |
bundleLocation |
private java.io.File |
dest |
private java.util.Map<java.lang.String,java.lang.String> |
files |
private java.lang.String |
marker |
private net.ssehub.easy.basics.progress.ProgressObserver |
observer |
private static java.lang.String |
PROTOCOL_FILE |
private static java.lang.String |
PROTOCOL_REFERENCE |
private java.net.URI |
source |
private long |
timeStamp |
| Modifier | Constructor and Description |
|---|---|
protected |
IUpgrader(java.net.URI source,
java.lang.String dest,
java.util.Map<java.lang.String,java.lang.String> files,
java.lang.String marker,
net.ssehub.easy.basics.progress.ProgressObserver observer)
Creates an upgrader instance.
|
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> |
allFileMappings()
Returns an iterator over all known file mappings.
|
static java.io.File |
bundleLocationToFile(java.lang.String location)
Converts a bundle location to a file.
|
protected void |
copy(java.io.File source,
java.io.File target)
Copies
source to target. |
protected abstract boolean |
doUpgrade(ReasoningResult result)
Performs the upgrade operations.
|
protected void |
error(ReasoningResult result,
java.io.IOException ex)
Adds an I/O error to
result. |
protected java.lang.String |
getMappedFile(java.lang.String input)
Returns a mapped file name.
|
protected java.lang.String |
getMarker()
Returns the marker file.
|
protected net.ssehub.easy.basics.progress.ProgressObserver |
getObserver()
Returns the progress observer instance.
|
protected java.net.URI |
getSource()
Returns the source URI.
|
protected java.io.File |
obtainTargetFile(java.lang.String targetName)
Obtains a file descriptor for
targetName and cares
for uniquely renaming existing files. |
static java.lang.String |
toBundleLocation(java.io.File file)
Returns a pseudo bundle location derived from file.
|
ReasoningResult |
upgrade()
Executes the upgrade.
|
private static final java.lang.String PROTOCOL_REFERENCE
private static final java.lang.String PROTOCOL_FILE
private java.net.URI source
private java.lang.String bundleLocation
private java.io.File dest
private java.util.Map<java.lang.String,java.lang.String> files
private java.lang.String marker
private net.ssehub.easy.basics.progress.ProgressObserver observer
private long timeStamp
protected IUpgrader(java.net.URI source,
java.lang.String dest,
java.util.Map<java.lang.String,java.lang.String> files,
java.lang.String marker,
net.ssehub.easy.basics.progress.ProgressObserver observer)
source - the source containing the files to upgradedest - the destination bundle locationfiles - the file mapping describing the upgrademarker - an optional marker file within dest (may be null)observer - a progress observer, use ProgressObserver.NO_OBSERVER if no observer shall be informedpublic static java.lang.String toBundleLocation(java.io.File file)
throws java.net.MalformedURLException
file - the file to be convertedjava.net.MalformedURLException - in case of translation problemspublic static java.io.File bundleLocationToFile(java.lang.String location)
location - the locationpublic ReasoningResult upgrade()
doUpgrade(ReasoningResult)protected abstract boolean doUpgrade(ReasoningResult result)
result - the reasoning result to be modified as a side effecttrue if performed, false if nodeprotected java.net.URI getSource()
protected java.lang.String getMappedFile(java.lang.String input)
input - the input file nameinput is not mappedprotected java.lang.String getMarker()
protected net.ssehub.easy.basics.progress.ProgressObserver getObserver()
protected java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> allFileMappings()
protected java.io.File obtainTargetFile(java.lang.String targetName)
targetName and cares
for uniquely renaming existing files.targetName - the target name (within dest)targetNameprotected void error(ReasoningResult result, java.io.IOException ex)
result.result - the reasoning result to be modified as a side effectex - the exception denoting the errorprotected void copy(java.io.File source,
java.io.File target)
throws java.io.IOException
source to target.source - the source filetarget - the target filejava.io.IOException - in case of any I/O problemsCopyright © 2009 - 2018 SSE. All Rights Reserved.