public abstract class AbstractFileRepo extends java.lang.Object implements FileRepo
Modifier and Type | Field and Description |
---|---|
protected static java.nio.file.PathMatcher |
CLASS_MATCHER
This matcher matches *.class files.
|
protected static java.nio.file.PathMatcher |
JAVA_MATCHER
This matcher matches *.java files.
|
protected static java.nio.file.PathMatcher |
KEY_MATCHER
A matcher matches *.key and *.proof files.
|
protected static java.net.URL |
REDUX_URL
The URL to KeY's built-in Java classes (used to prevent these classes from getting copied).
|
protected static java.net.URL |
RULES_URL
The URL to KeY's built-in rules (used to prevent built-in rules from getting copied).
|
protected static java.nio.file.PathMatcher |
ZIP_MATCHER
This matcher matches *.zip and *.jar files.
|
Constructor and Description |
---|
AbstractFileRepo() |
Modifier and Type | Method and Description |
---|---|
protected java.io.InputStream |
adaptFileRefs(java.nio.file.Path p)
Rewrites the file references inside of .key/.proof files such that the point correctly to
the copied files in the ZIP file.
|
protected void |
addFile(java.nio.file.Path p)
Adds the given file to the list of files to save.
|
protected static void |
createDirsAndCopy(java.nio.file.Path source,
java.nio.file.Path target)
Copyies the file at source path to the target path
and creates parent directories if required.
|
protected void |
dispose()
Clears all data in the FileRepo and marks it as disposed.
|
protected java.nio.file.Path |
getBaseDir() |
protected java.nio.file.Path |
getBootclasspath() |
protected java.util.List<java.nio.file.Path> |
getClasspath() |
java.io.InputStream |
getInputStream(java.nio.file.Path path)
Provides access to a file on disk.
|
java.io.InputStream |
getInputStream(RuleSource ruleSource)
Provides access to the InputStream of a RuleSource.
|
protected abstract java.io.InputStream |
getInputStreamInternal(java.nio.file.Path p)
Can be used to get a direct InputStream to a file stored in the FileRepo.
|
protected java.nio.file.Path |
getJavaPath() |
protected java.util.Set<Proof> |
getRegisteredProofs() |
protected abstract java.nio.file.Path |
getSaveName(java.nio.file.Path path)
Return the save name for a given file.
|
protected boolean |
isDisposed() |
protected boolean |
isInBootClassPath(java.nio.file.Path path)
Checks if the given path is inside the boot class path
|
protected boolean |
isInJavaPath(java.nio.file.Path path)
Checks if the given path is inside the Java path
|
protected static boolean |
isInternalFile(java.nio.file.Path path)
Tests if the given path references an internal file in KeY, i.e.
|
protected static boolean |
isInternalResource(java.net.URL url)
Tests if the given URL references an internal resource of KeY, i.e.
|
void |
proofDisposed(ProofDisposedEvent e)
When a
Proof was disposed via Proof.dispose() . |
void |
proofDisposing(ProofDisposedEvent e)
When a
Proof is going to be disposed. |
void |
registerProof(Proof proof)
Register the proof in the FileRepo.
|
void |
saveProof(java.nio.file.Path savePath)
Stores all files stored in the FileRepo in a consistent package as a ZIP archive at the given
target path.
|
void |
setBaseDir(java.nio.file.Path path)
Sets the base directory of the proof, i.e.
|
void |
setBootClassPath(java.io.File path)
Sets the bootclasspath (containing available classes from the Java Class Library).
|
void |
setClassPath(java.util.List<java.io.File> paths)
Sets the classpath.
|
void |
setJavaPath(java.lang.String path)
Sets the java path (where the source files are located).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createOutputStream, getInputStream
protected static final java.net.URL RULES_URL
protected static final java.net.URL REDUX_URL
protected static final java.nio.file.PathMatcher JAVA_MATCHER
protected static final java.nio.file.PathMatcher KEY_MATCHER
protected static final java.nio.file.PathMatcher ZIP_MATCHER
protected static final java.nio.file.PathMatcher CLASS_MATCHER
protected static void createDirsAndCopy(java.nio.file.Path source, java.nio.file.Path target) throws java.io.IOException
source
- path of the source filetarget
- path of the target filejava.io.IOException
- if an I/O error occurs (e.g. user has no permission to write target)protected static boolean isInternalFile(java.nio.file.Path path) throws java.net.MalformedURLException
path
- the path to testjava.net.MalformedURLException
- if the path can not be converted to an URLprotected static boolean isInternalResource(java.net.URL url)
url
- the url to testprotected java.nio.file.Path getJavaPath()
protected boolean isDisposed()
protected java.util.List<java.nio.file.Path> getClasspath()
protected java.nio.file.Path getBootclasspath()
protected java.nio.file.Path getBaseDir()
protected void addFile(java.nio.file.Path p)
p
- the path of the file to addprotected java.util.Set<Proof> getRegisteredProofs()
protected boolean isInJavaPath(java.nio.file.Path path)
path
- the path to checkprotected boolean isInBootClassPath(java.nio.file.Path path)
path
- the path to checkpublic void saveProof(java.nio.file.Path savePath) throws java.io.IOException
savePath
- the target path of the ZIP archivejava.io.IOException
- on IO errors, e.g. if the user has no permission to write at the pathprotected abstract java.nio.file.Path getSaveName(java.nio.file.Path path)
path
- the given file (absolute or relative to the proof base directory)public java.io.InputStream getInputStream(java.nio.file.Path path) throws java.io.IOException
FileRepo
null
if the path cannot be handled by this repository.getInputStream
in interface FileRepo
path
- the path of the filenull
java.io.FileNotFoundException
- if the file does not existjava.io.IOException
- on IO errors, e.g. if the user has no permission to read the filepublic java.io.InputStream getInputStream(RuleSource ruleSource) throws java.io.IOException
FileRepo
null
if the source cannot be handled by this repository.getInputStream
in interface FileRepo
ruleSource
- the RuleSourcenull
java.io.IOException
- on IO errorsprotected abstract java.io.InputStream getInputStreamInternal(java.nio.file.Path p) throws java.io.FileNotFoundException
p
- the original path (outside the FileRepo) of the requested filejava.io.FileNotFoundException
- if the does not file exist, is a directory,
or can not be openedprotected java.io.InputStream adaptFileRefs(java.nio.file.Path p) throws java.io.IOException
p
- the path of the file where the references are adaptedjava.io.IOException
- if an I/O error occurspublic void setBootClassPath(java.io.File path) throws java.lang.IllegalStateException
FileRepo
setBootClassPath
in interface FileRepo
path
- the bootclasspath to set (the method does nothing if null is given)java.lang.IllegalStateException
- if the java path is already setpublic void setClassPath(java.util.List<java.io.File> paths) throws java.lang.IllegalStateException
FileRepo
setClassPath
in interface FileRepo
paths
- the classpath to set (the method does nothing if null is given)java.lang.IllegalStateException
- if the java path is already setpublic void setJavaPath(java.lang.String path) throws java.lang.IllegalStateException
FileRepo
setJavaPath
in interface FileRepo
path
- the java path to set (the method does nothing if null is given)java.lang.IllegalStateException
- if the java path is already setpublic void setBaseDir(java.nio.file.Path path)
FileRepo
setBaseDir
in interface FileRepo
path
- The path of the base directory. If a file is given, then its parent directory is
set as base path.public void registerProof(Proof proof)
FileRepo
registerProof
in interface FileRepo
proof
- the proof to registerprotected void dispose()
public void proofDisposing(ProofDisposedEvent e)
ProofDisposedListener
Proof
is going to be disposed.proofDisposing
in interface ProofDisposedListener
e
- The event.public void proofDisposed(ProofDisposedEvent e)
ProofDisposedListener
Proof
was disposed via Proof.dispose()
.proofDisposed
in interface ProofDisposedListener
e
- The event.Copyright © 2003-2019 The KeY-Project.