|
| 1 | +# Configuration migration from DocProcessConfig to FreemarkerDocProcessConfig |
| 2 | + |
| 3 | +[Index](index.md) |
| 4 | + |
| 5 | +This guide is needed only if the old configurations files `doc-handler-facade.xml` and/or the `doc-process-config.xml` are being used. |
| 6 | + |
| 7 | +If you are already using the new [freemarker-doc-process-1-0.xsd](https://github.com/fugerit-org/fj-doc/blob/main/fj-doc-freemarker/src/main/resources/config_fm_xsd/freemarker-doc-process-1-0.xsd) you do not need to read more. |
| 8 | + |
| 9 | +At the beginning, Venus was using the [DocProcessConfig](https://github.com/fugerit-org/fj-doc/blob/c458ba4e54477a6db650dcc9f71fb2dab4c63bef/fj-doc-base/src/main/java/org/fugerit/java/doc/base/process/DocProcessConfig.java) facade to handle the generation pipeline. |
| 10 | + |
| 11 | +Now it is strongly recommended to use the new [FreemarkerDocProcessConfig](https://github.com/fugerit-org/fj-doc/blob/main/fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfig.java) facade. |
| 12 | + |
| 13 | +It substitutes both the `doc-handler-facade.xml` and the `doc-process-config.xml`. |
| 14 | + |
| 15 | +The needed steps depends on the specific project configuration, but can be summarized in : |
| 16 | + |
| 17 | +## 1. Convert the `doc-process-config.xml` and `doc-handler-facade.xml` in `freemarker-doc-process.xml` |
| 18 | + |
| 19 | +You can use the [Doc Configuration Convert](https://docs.fugerit.org/fj-doc-playground/home) function from the online playground. |
| 20 | + |
| 21 | +For instance starting from : |
| 22 | + |
| 23 | +```xml |
| 24 | +<doc-process> |
| 25 | + |
| 26 | + <chain id="test-chain"> |
| 27 | + <step id="step-01" defaultBehaviour="CONTINUE" |
| 28 | + description="Test for coverage" |
| 29 | + type="test.org.fugerit.java.doc.base.coverage.ProcessStepCoverage" |
| 30 | + param01="TEST"> |
| 31 | + <properties xmlPath="coverage/xml/default_doc_alt.xml"/> |
| 32 | + </step> |
| 33 | + </chain> |
| 34 | + |
| 35 | +</doc-process> |
| 36 | +``` |
| 37 | + |
| 38 | +```xml |
| 39 | +<doc-handler-config user-catalog="default-complete"> |
| 40 | + |
| 41 | + <factory id="default-complete"> |
| 42 | + <data id="md-ext" info="md" type="org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownExtTypeHandler" /> |
| 43 | + </factory> |
| 44 | + |
| 45 | +</doc-handler-config> |
| 46 | +``` |
| 47 | + |
| 48 | +The resulting `freemarker-doc-process.xml` should be : |
| 49 | + |
| 50 | +```xml |
| 51 | +<?xml version="1.0" encoding="utf-8"?> |
| 52 | +<freemarker-doc-process-config |
| 53 | +xmlns="https://freemarkerdocprocess.fugerit.org" |
| 54 | +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 55 | +xsi:schemaLocation="https://freemarkerdocprocess.fugerit.org https://www.fugerit.org/data/java/doc/xsd/freemarker-doc-process-1-0.xsd" > |
| 56 | + |
| 57 | + <docHandlerConfig> |
| 58 | + <!-- Type handler for markdown format --> |
| 59 | + <docHandler id="md-ext" info="md" type="org.fugerit.java.doc.base.typehandler.markdown.SimpleMarkdownExtTypeHandler" /> |
| 60 | + |
| 61 | + </docHandlerConfig> |
| 62 | + |
| 63 | + <docChain id="test-chain"> |
| 64 | + <chainStep stepType="test.org.fugerit.java.doc.base.coverage.ProcessStepCoverage"> |
| 65 | + <!-- custom step, additional configuration may be needed --> |
| 66 | + </chainStep> |
| 67 | + </docChain> |
| 68 | + |
| 69 | +</freemarker-doc-process-config> |
| 70 | +``` |
| 71 | + |
| 72 | +## 2. Create your FreemarkerDocProcessConfig instance |
| 73 | + |
| 74 | +```java |
| 75 | +FreemarkerDocProcessConfig config = FreemarkerDocProcessConfigFacade.loadConfigSafe("cl://path/to/freemarker-doc-process.xml" ); |
| 76 | +``` |
| 77 | +## 3. Use new fullProcess() functions |
| 78 | + |
| 79 | +```java |
| 80 | +String chainId = "test-chain"; |
| 81 | +DocProcessContext context = DocProcessContext.newContext( ... ); |
| 82 | +String type = "md"; |
| 83 | +FreemarkerDocProcessConfig config = FreemarkerDocProcessConfigFacade.loadConfigSafe("cl://path/to/freemarker-doc-process.xml" ); |
| 84 | +config.fullProcess( chainId, context, type, outputStream ); |
| 85 | +``` |
| 86 | +## 4. Any needed clean up |
| 87 | + |
| 88 | +Remove your old `doc-process-config.xml` configuration and any obsolete file and method. |
0 commit comments