Package eu.bandm.tools.util.files
Class SourceHabitats
java.lang.Object
eu.bandm.tools.util.files.SourceHabitats
Organizes a collection of places where to look for resources (=input files).
A sequence of
A sequence of
SourceHabitats.SourceHabitat
is maintained which will
be searched for a file, ie. a data source with a certain file name.
Currently this can be a SourceHabitats.SourceHabitat_file
as a pointer
into the file system, or a SourceHabitats.SourceHabitat_resource
as a class
which cames with "resources", eg. in a ".jar" file.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclass
Represents the only one data source which has been successfully found for one particular resource name (mostly a "file name stem").class
Represents one of many potential sources which have to be searched for library modules, etc.protected class
Represents a source habitat which is a directory in the file system.protected class
Represents a source habitat which points to a directory, relative to the position of a loaded java class. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) final BiConsumer<String,
Object[]> static final String
static final String
static final String
protected List<SourceHabitats.SourceHabitat>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
appendNewHabitat
(String s, @Opt String additionalErrorText) Service access point for adding a habitat to the end of the search list.protected void
protected @Opt SourceHabitats.SourceHabitat
makeHabitat
(String name, @Opt String additionalErrorText) Internal method to check whether the input toappendNewHabitat(String,String)
is consistent.searchAllPlaces
(String name, @Opt BiConsumer<String, Object[]> verbose, String... suffices) Service access point for searching all habitats, for the name of the resources, tested with all suffixed.
-
Field Details
-
PREFIX_FILE
- See Also:
-
PREFIX_RESOURCE
- See Also:
-
RELATIVE_PATH_SEPARATOR
- See Also:
-
msg
-
sourceList
-
-
Constructor Details
-
SourceHabitats
-
-
Method Details
-
allPlaces_toString
-
searchAllPlaces
@Opt public @Opt SourceHabitats.FoundSource searchAllPlaces(String name, @Opt @Opt BiConsumer<String, Object[]> verbose, String... suffices) Service access point for searching all habitats, for the name of the resources, tested with all suffixed. The suffixes are tested faster, i.e.all are tested per habitat in the sequential order of the argument. The suffixes must include a leading dot (="."), but can also be totally empty. -
appendNewHabitat
Service access point for adding a habitat to the end of the search list. Does so only if consistency checks okay.- Parameters:
s
- name of the habitat according to the defined prefices, see class docu text.additionalErrorText
- describes the context of the habitat modification attempt
-
ERROR
-
makeHabitat
@Opt protected @Opt SourceHabitats.SourceHabitat makeHabitat(String name, @Opt @Opt String additionalErrorText) Internal method to check whether the input toappendNewHabitat(String,String)
is consistent.- Parameters:
additionalErrorText
- describes the context of the habitat modification attempt
-