Class AdocPackages
java.lang.Object
network.ike.docs.plugin.packages.AdocPackages
The packages layout of an AsciiDoc root (
dev-adoc-packages,
IKE-Network/ike-issues#1341): the first directory under the root is the
owning group written as one dotted segment, network.ike.lab, and
the directory under that is the topic domain, so a topic is
network.ike.lab/dev/gitflow-overview.adoc and its package is
network.ike.lab/dev. A library whose group ends in its only
domain may use the group directory itself as the domain package: the
ANF kompendium's topics are network.ike.kompendium.anf/determine-topic.adoc,
in the package network.ike.kompendium.anf. META-INF is
reserved for what describes the artifact; every group begins with a
top-level domain, so the two never meet.
This class enumerates the packages a root holds and what each holds, the reading the manifest and the lint share.
- Since:
- 136
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternA group directory's name: a reverse-DNS group as one dotted segment, at least two labels of lowercase letters, digits, hyphens and underscores, as a Maven group id is written.static final StringThe directory inside a package that holds its images.static final StringThe reserved directory for artifact metadata, never a package. -
Method Summary
Modifier and TypeMethodDescriptionThe immediate entries of a directory in name order.groupDirectories(Path root) The group directories of a root: its immediate subdirectories whose name is a dotted group.static List<TopicHeader> Parse the header of every.adocfile under a directory, in path order, paths relative to the root; symbolic links and the directoriesTopicRegistry.SKIPPED_DIRSare left out.static booleanisDomainPackage(Path group) Whether a group directory is itself the domain package: it holds an.adocfile directly, as the ANF library's group directory does.static StringmetaDirectory(String groupId, String artifactId) The metadata directory of an artifact inside the zip and the union, keyed by its coordinates so that it cannot collide:META-INF/ike/<groupId>/<artifactId>.static List<AdocPackages.Package> Enumerate the packages of a root: for each group directory, the group itself when it holds topics directly, otherwise each subdirectory of it as<group>/<domain>, hidden directories left out.
-
Field Details
-
META_INF
The reserved directory for artifact metadata, never a package.- See Also:
-
IMAGES
-
GROUP
A group directory's name: a reverse-DNS group as one dotted segment, at least two labels of lowercase letters, digits, hyphens and underscores, as a Maven group id is written.
-
-
Method Details
-
metaDirectory
The metadata directory of an artifact inside the zip and the union, keyed by its coordinates so that it cannot collide:META-INF/ike/<groupId>/<artifactId>.- Parameters:
groupId- the artifact's group idartifactId- the artifact's artifact id- Returns:
- the relative path with
/separators
-
groupDirectories
The group directories of a root: its immediate subdirectories whose name is a dotted group.- Parameters:
root- the AsciiDoc root- Returns:
- the directories in name order
- Throws:
IOException- if the root cannot be listed
-
isDomainPackage
Whether a group directory is itself the domain package: it holds an.adocfile directly, as the ANF library's group directory does.- Parameters:
group- the group directory- Returns:
- true when the group directory holds topics directly
- Throws:
IOException- if the directory cannot be listed
-
packages
public static List<AdocPackages.Package> packages(Path root, String libraryPackage) throws IOException Enumerate the packages of a root: for each group directory, the group itself when it holds topics directly, otherwise each subdirectory of it as<group>/<domain>, hidden directories left out. Every.adocfile under a package is parsed for its header, which is what the kind and the lint's domain rule are decided by.- Parameters:
root- the AsciiDoc rootlibraryPackage- the packageike.adoc.library-packagenames as the library's own, ornull- Returns:
- the packages in name order
- Throws:
IOException- if the tree cannot be read
-
headers
Parse the header of every.adocfile under a directory, in path order, paths relative to the root; symbolic links and the directoriesTopicRegistry.SKIPPED_DIRSare left out.- Parameters:
root- the AsciiDoc root paths are relative todirectory- the directory to walk, under the root- Returns:
- the parsed headers
- Throws:
IOException- if a file cannot be read
-
children
The immediate entries of a directory in name order.- Parameters:
directory- the directory- Returns:
- its entries
- Throws:
IOException- if it cannot be listed
-