THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
If a large set of code needs to be added or changed in a a specific component in an existing OFBiz OOTB component where you will add more entities, services, screens, forms etc. then this strategy should be adopted and complete component should be overridden in hot-deploy directory.
Following steps need to be performed for overriding an existing component:
- Create custom component in hot-deploy directory by any name as you want to override, its just going be replica of existing OOTB OFBiz component with all the major directories and files required for setting up a component.
- You can use ant create-component target on OFBiz root directory to create this component in hot-deploy directory.
- Only those files need to be added which you need to have in overriding the component, webapp. Rest of the resources are going to be used from OOTB component so if you have used ant create-component target then you can safely delete some of the files like if you are not going to write a service then services.xml file can be deleted, or if you are not going to add or extend an existing entity then you can delete entitymodel.xml file and their entries from ofbiz-component.xml file of custom component.
- Basically this is the thin line between extending a webapp and a component. If you are going to have major changes in services and entities then creating a new component should be preferred where you will be extending the existing webapp.
- e.g. If you want to have a separate component for adding or extending existing functionalities from catalog application which is a webapp in product component then you can have component in hot-deploy dir by extending the catalog webapp from product component.
- Follow below given points:
- Make sure to properly override the webapp in ofbiz-component file of custom component as example given below:
Code Block <webapp name="catalog" title="Catalog" server="default-server" location="webapp/catalog" base-permission="OFBTOOLS,CATALOG" mount-point="/catalog" app-bar-display="true"/>
- Make sure to make entries of custom service defs(if-any), entity defs(if-any) and data files(if-any) in ofbiz-component file of custom component as example given below:
Code Block <entity-resource type="model" reader-name="main" loader="main" location="entitydef/entitymodel.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/*TypeData.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/>
- Make sure to have same web.xml file from existing webapp.
- You can have new main-decorator defined for screens in webapp so if this is the case this needs to be changed in web.xml.
- Make sure to have controller.xml file in new webapp created and include the the controller from existing webapp and only include custom requests only rest will be taken care by included controller only, as shown bellow:
Code Block <include location="component://product/webapp/catalog/WEB-INF/controller.xml"/>
- Make sure to have error.jsp inside extended webapp.
- Make sure to have index.jsp file with redirect path.
- Make sure to properly override the webapp in ofbiz-component file of custom component as example given below:
...