PageSourceSearch

https://regardsoss.github.io/assets/js/9d35b545.ea5beb08.js

js regardsoss.github.io collected 2026-10-03 09:51:03 UTC 7,227 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunkregardsoss_github_io=globalThis.webpackChunkregardsoss_github_io||[]).push([[3702],{63692(e,n,r){r.r(n),r.d(n,{assets:()=>s,contentTitle:()=>d,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>l});const o=JSON.parse('{"id":"development/framework/starters/backend-framework-starters-module","title":"Module starter","description":"Purpose","source":"@site/versioned_docs/version-2.2.0/development/framework/starters/module-starter.md","sourceDirName":"development/framework/starters","slug":"/development/backend/framework/starters/module/","permalink":"/docs/2.2.0/development/backend/framework/starters/module/","draft":false,"unlisted":false,"editUrl":"https://github.com/RegardsOss/RegardsOss.github.io/edit/master/versioned_docs/version-2.2.0/development/framework/starters/module-starter.md","tags":[],"version":"2.2.0","frontMatter":{"id":"backend-framework-starters-module","title":"Module starter","slug":"/development/backend/framework/starters/module/"},"sidebar":"dev","previous":{"title":"Microservice starter","permalink":"/docs/2.2.0/development/backend/framework/starters/microservice/"},"next":{"title":"Multitenant starter","permalink":"/docs/2.2.0/development/backend/framework/starters/multitenant/"}}');var t=r(74848),i=r(28453);const a={id:"backend-framework-starters-module",title:"Module starter",slug:"/development/backend/framework/starters/module/"},d=void 0,s={},l=[{value:"Purpose",id:"purpose",level:2},{value:"Configuration",id:"configuration",level:2},{value:"How to",id:"how-to",level:2},{value:"Implement a module manager",id:"implement-a-module-manager",level:3},{value:"Import/export configuration",id:"importexport-configuration",level:4},{value:"Ready",id:"ready",level:4},{value:"Restart",id:"restart",level:4}];function c(e){const n={code:"code",h2:"h2",h3:"h3",h4:"h4",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"purpose",children:"Purpose"}),"\n",(0,t.jsx)(n.p,{children:"This starter :"}),"\n",(0,t.jsxs)(n.ul,{children:["\n",(0,t.jsx)(n.li,{children:"Gives access to standard system exceptions,"}),"\n",(0,t.jsx)(n.li,{children:"Centralizes system exception transformation into REST exception,"}),"\n",(0,t.jsx)(n.li,{children:"Brings the module manager engine logic."}),"\n"]}),"\n",(0,t.jsx)(n.h2,{id:"configuration",children:"Configuration"}),"\n",(0,t.jsx)(n.p,{children:"Add starter dependency to your POM (version depends on the BOM)"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-xml",children:"<dependency>\n  <groupId>fr.cnes.regards.framework</groupId>\n  <artifactId>module-regards-starter</artifactId>\n</dependency>\n"})}),"\n",(0,t.jsx)(n.p,{children:"Business dependency"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-xml",children:"<dependency>\n  <groupId>fr.cnes.regards.framework</groupId>\n  <artifactId>module-regards</artifactId>\n</dependency>\n"})}),"\n",(0,t.jsx)(n.h2,{id:"how-to",children:"How to"}),"\n",(0,t.jsx)(n.h3,{id:"implement-a-module-manager",children:"Implement a module manager"}),"\n",(0,t.jsxs)(n.p,{children:["To do this, you have to implement a module manager inheriting abstract class ",(0,t.jsx)(n.code,{children:"AbstractModuleManager"})," (and implementing ",(0,t.jsx)(n.code,{children:"IModuleManager"}),") and ",(0,t.jsx)(n.strong,{children:"annotated as a Spring component"}),"."]}),"\n",(0,t.jsxs)(n.p,{children:["In the same package as your module configuration manager, you have to create a ",(0,t.jsx)(n.code,{children:"module.properties"})," file containing following required properties:"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-properties",children:"# Your module properties\nmodule.id=<your module id>\nmodule.name=<your module name for display purpose>\nmodule.description=<your module description for display purpose>\nmodule.version=<your module version>\nmodule.author=<author>\nmodule.legalOwner=<author,client, ...>\nmodule.documentation=<url>\n"})}),"\n",(0,t.jsxs)(n.p,{children:["By default, ",(0,t.jsx)(n.code,{children:"IModuleManager#importConfiguration"})," will only be called if imported file matches the same ",(0,t.jsx)(n.code,{children:"module.id"})," properties."]}),"\n",(0,t.jsxs)(n.p,{children:["At last, to adjust your exported JSON configuration, you can annotate your exported POJO with ",(0,t.jsx)(n.code,{children:"@ConfigIgnore"}),"."]}),"\n",(0,t.jsx)(n.h4,{id:"importexport-configuration",children:"Import/export configuration"}),"\n",(0,t.jsx)(n.p,{children:"For instance,"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-java",children:"@Service\npublic class MyModuleManager extends AbstractModuleManager {\n\n    @Override\n    public void importConfiguration(ModuleConfiguration configuration) throws ModuleException {\n        for (ModuleConfigurationItem<?> item : configuration.getConfiguration()) {\n            if (MyPOJO.class.isAssignableFrom(item.getKey())) {\n                MyPOJO pojo = item.getTypedValue();\n                // Do something to import configuration\n            }\n        }\n    }\n\n    @Override\n    public ModuleConfiguration exportConfiguration() {\
1n        List<ModuleConfigurationItem<?>> configuration = new ArrayList<>();\n        // Fill list using ModuleConfigurationItem#build\n        return ModuleConfiguration.build(info, configuration);\n    }\n}\n"})}),"\n",(0,t.jsx)(n.h4,{id:"ready",children:"Ready"}),"\n",(0,t.jsx)(n.p,{children:"Override default method."}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"isReady"})," is only called if ",(0,t.jsx)(n.code,{children:"isReadyImplemented"})," return ",(0,t.jsx)(n.code,{children:"true"}),"."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-java",children:'    default ModuleReadinessReport<S> isReady() {\n        throw new UnsupportedOperationException("Ready feature not implemented");\n    }\n\n    default boolean isReadyImplemented() {\n        return false;\n    }\n'})}),"\n",(0,t.jsx)(n.h4,{id:"restart",children:"Restart"}),"\n",(0,t.jsx)(n.p,{children:"Override default method."}),"\n",(0,t.jsxs)(n.p,{children:[(0,t.jsx)(n.code,{children:"restart"})," is only called if ",(0,t.jsx)(n.code,{children:"isRestartImplemented"})," return ",(0,t.jsx)(n.code,{children:"true"}),"."]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-java",children:'    default ModuleRestartReport restart() {\n        throw new UnsupportedOperationException("Restart feature not implemented");\n    }\n\n    default boolean isRestartImplemented() {\n        return false;\n    }\n'})})]})}function u(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(c,{...e})}):c(e)}},28453(e,n,r){r.d(n,{R:()=>a,x:()=>d});var o=r(96540);const t={},i=o.createContext(t);function a(e){const n=o.useContext(i);return o.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function d(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(t):e.components||t:a(e.components),o.createElement(i.Provider,{value:n},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.