Class AbstractWorkDirs
java.lang.Object
org.pgcodekeeper.core.database.base.project.AbstractWorkDirs
- All Implemented Interfaces:
IWorkDirs
- Direct Known Subclasses:
ChWorkDirs,MsWorkDirs,PgWorkDirs
Base implementation of
IWorkDirs. Holds the directory mapping and
loads overrides from "structure.properties" when the project path is
provided. Subclasses supply defaults via getDefaultDirNames() and
the initial split-by-schema flag via isSplitBySchemaByDefault().-
Field Summary
FieldsFields inherited from interface org.pgcodekeeper.core.database.api.project.IWorkDirs
SCHEMA_KEY -
Method Summary
Modifier and TypeMethodDescriptionReturns the mapping of configurable type names to their placement rules.getDirNameForType(DbObjType type) Returns the current directory name of the generic rule for the given type.Computes the relative path (inside a project directory) where the given statement should be stored.booleanReturnstrueif objects are organized into subdirectories per schema/database container,falseif the schema name is encoded in the filename instead.static PathresolveAltDirsFile(Path projectPath) Resolves the alt-dirs file path inside the given project directory.voidsaveAltDirs(Path projectPath) Persists the current directory layout overrides to the given project.
-
Field Details
-
ALT_DIRS_FILENAME
- See Also:
-
IS_SPLIT_BY_SCHEMA
- See Also:
-
-
Method Details
-
resolveAltDirsFile
Resolves the alt-dirs file path inside the given project directory. -
isSplitBySchema
public boolean isSplitBySchema()Description copied from interface:IWorkDirsReturnstrueif objects are organized into subdirectories per schema/database container,falseif the schema name is encoded in the filename instead.- Specified by:
isSplitBySchemain interfaceIWorkDirs
-
getDirMapping
Description copied from interface:IWorkDirsReturns the mapping of configurable type names to their placement rules. Defines which object types participate in the project layout and may be overridden by external configuration.Keys are type names (e.g.
TABLE,VIEW,TRIGGER_FUNC). Values areIDirRuleinstances carrying the current directory name (default or overridden) together with matching metadata.- Specified by:
getDirMappingin interfaceIWorkDirs- Returns:
- map of type names to their placement rules
-
getRelativeFilePath
Description copied from interface:IWorkDirsComputes the relative path (inside a project directory) where the given statement should be stored. Walks upISubElementchains so that sub-elements share the file of their parent.- Specified by:
getRelativeFilePathin interfaceIWorkDirs- Parameters:
st- statement to locate- Returns:
- project-relative path to the statement's SQL file
-
getDirNameForType
Description copied from interface:IWorkDirsReturns the current directory name of the generic rule for the given type. Specific-subset rules (e.g.MAT_VIEW,TRIGGER_FUNC) are skipped so the result reflects where the "regular" objects of the type live.- Specified by:
getDirNameForTypein interfaceIWorkDirs- Parameters:
type- object type- Returns:
- directory name, or
nullif no generic rule is registered
-
saveAltDirs
Description copied from interface:IWorkDirsPersists the current directory layout overrides to the given project. Implementations write only entries that differ from the defaults, so an unchanged layout may produce an empty file.- Specified by:
saveAltDirsin interfaceIWorkDirs- Parameters:
projectPath- target project directory; must exist- Throws:
IOException- if the configuration file cannot be written
-