Package org.forgerock.doc.maven.utils
Class NameUtils
java.lang.Object
org.forgerock.doc.maven.utils.NameUtils
Utility methods to work with documents.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected static String
capitalize
(String docName) Capitalize initial letters in a document name.getDocumentNames
(File srcDir, String docFile) Returns names of directories that mirror the document names and contain DocBook XML documents to build.static String
Rename document to reflect project and document name.static String
Rename document to reflect project and document name.static void
renameDocument
(File builtDocument, String docName, String projectName) Rename a single built document.protected static String
spacesToHyphens
(String string) Replace spaces with hyphens.
-
Field Details
-
DOCUMENT_FILE_PATTERN
Deprecated.since 3.0.0Valid names:
- guide
- admin-quide
- OpenTEST-guide
- OpenTEST-admin-guide
- OpenTEST-admin-guide-1.1.1.0
- OpenTEST-admin-guide-1.1.1.0-SNAPSHOT
- OpenTEST-admin-guide-1.1.1.0-express
- OpenTEST-admin-guide-1.1.1.0-Xpress
- OpenTEST-admin-guide-1.1.1.0-Xpress1
- OpenTEST-10.1.0-admin-guide
- OpenTEST-10.1.0-SNAPSHOT-admin-guide
- OpenTEST-10.1.0-Xpress2-admin-guide
- db2-connector-1.1.0.0-SNAPSHOT
Invalid names:
- guide.
- guide-1
- guide-.
Pattern to validate the document names.
project-doc-version names are not expected in published docs,
-
-
Method Details
-
renameDoc
Rename document to reflect project and document name. For example, index.pdf could be renamed OpenAM-Admin-Guide.pdf.- Parameters:
projectName
- Short name of the project, such as OpenAM, OpenDJ, OpenIDMdocName
- Short name for the document, such as admin-guide, release-notes, referenceextension
- File name extension not including dot, e.g. pdf- Returns:
- New name for document. Can be "" if rename failed.
-
renameDoc
public static String renameDoc(String projectName, String docName, String version, String extension) Rename document to reflect project and document name. For example, index.pdf could be renamed OpenAM-10.0.0-Admin-Guide.pdf.- Parameters:
projectName
- Short name of the project, such as OpenAM, OpenDJ, OpenIDMdocName
- Short name for the document, such as admin-guide, release-notes, referenceversion
- Document version such as 10.0.0, 2.5.0, 2.0.2extension
- File name extension not including dot, e.g. pdf- Returns:
- New name for document. Can be "" if rename failed.
-
capitalize
Capitalize initial letters in a document name.- Parameters:
docName
- Name of the document such as reference or admin-guide- Returns:
- Capitalized name such as Reference or Admin-Guide
-
spacesToHyphens
Replace spaces with hyphens.- Parameters:
string
- String in which to replace spaces with hyphens- Returns:
- String with spaces replaced by hyphens.
-
getDocumentNames
Returns names of directories that mirror the document names and contain DocBook XML documents to build.- Parameters:
srcDir
- Directory containing DocBook XML sources. Document directories like admin-guide or reference are one level below this directory.docFile
- Name of a file common to all documents to build, such as index.xml.- Returns:
- Document names, as in admin-guide or reference
-
renameDocument
public static void renameDocument(File builtDocument, String docName, String projectName) throws IOException Rename a single built document. For example, renameindex.pdf
toOpenAM-Admin-Guide.pdf
.- Parameters:
builtDocument
- File to rename, such asindex.pdf
.docName
- Simple document name such asadmin-guide
.projectName
- Project name, such asOpenAM
.- Throws:
IOException
- Something went wrong renaming the file.
-