Package com.inet.pdfc.config
Class DirectoryPdfSource
- java.lang.Object
-
- com.inet.pdfc.config.DirectoryPdfSource
-
public class DirectoryPdfSource extends java.lang.Object
This is a simple directory listing interface for the batch comparison. Feel free to override the implementation to serve PDFs from an FTP server or to a implement recursive file search for instance.- Since:
- i-net PDFC 3.0
-
-
Constructor Summary
Constructors Modifier Constructor Description DirectoryPdfSource(java.io.File directory)
Creates the directory source for a file directory.protected
DirectoryPdfSource(java.lang.String name)
Creates an empty directory source.DirectoryPdfSource(java.lang.String name, PdfSource... sources)
Creates an artificial directory source
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addPdfSource(PdfSource source)
Adds a PDF source to the directory.java.lang.String
getName()
Returns the name of the directory if setPdfSource
getPdfSource(java.lang.String name)
Returns a PDF source from the directory.java.util.List<PdfSource>
getPdfSources()
Returns all PDF sources registered to this directoryjava.lang.String
toString()
-
-
-
Constructor Detail
-
DirectoryPdfSource
protected DirectoryPdfSource(java.lang.String name)
Creates an empty directory source. Use this constructor to override the default implementation.- Parameters:
name
- a name describing this PdfSource, used for the notification messages about missing PDFs in the PdfSorce.- Since:
- i-net PDFC 3.0
-
DirectoryPdfSource
public DirectoryPdfSource(java.io.File directory)
Creates the directory source for a file directory. All files not matter their extension which are directly in this directory (not in a sub-directory) will be compared.- Parameters:
directory
- the directory to get the files from- Throws:
java.lang.IllegalArgumentException
- thrown in case the directory is not readable or not a directory- Since:
- i-net PDFC 3.0
-
DirectoryPdfSource
public DirectoryPdfSource(java.lang.String name, PdfSource... sources)
Creates an artificial directory source- Parameters:
name
- the name of the directorysources
- the PDF source which are contained in this directory, may benull
- Since:
- i-net PDFC 3.0
-
-
Method Detail
-
addPdfSource
protected void addPdfSource(PdfSource source)
Adds a PDF source to the directory. If a source of the same name already exists, it will be replaced.- Parameters:
source
- the PDF source to add, must not benull
- Since:
- i-net PDFC 3.0
-
getPdfSources
public java.util.List<PdfSource> getPdfSources()
Returns all PDF sources registered to this directory- Returns:
- all PDF sources registered to this directory, never
null
- Since:
- i-net PDFC 3.0
-
getPdfSource
public PdfSource getPdfSource(java.lang.String name)
Returns a PDF source from the directory. May returnnull
if the donated resource does not exist in the directory.- Parameters:
name
- the name of the requested PDF source- Returns:
- the PDF source where getName().equals( name ) or
null
if there is no such PDF source registered - Since:
- i-net PDFC 3.0
-
getName
public java.lang.String getName()
Returns the name of the directory if set- Returns:
- the name of the directory, may be
null
- Since:
- i-net PDFC 3.0
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Since:
- i-net PDFC 3.0
-
-