Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Partially updates for Gradle

This is the most common requirement, where you have to customize implementation of framework in some areas you are using. In some cases we need to implement something or extend something in an existing(OOTB) OFBiz component which is very specific to a client and not generalized enough to put back in OFBiz trunk. So to achieve this we usually follow following strategies for testing(staging) and production systems:

Table of Contents

Maintaining Patches

...

  1. 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 structure with all the major directories and files required for setting up a component.
  2. You can use ant create-component createComponent target on OFBiz root directory to create this component in hot-deploy directory.
  3. 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 gradlew createComponent target then you can safely delete some of the files e.g. 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.
  4. 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.
  5. 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.
  6. Follow these steps:
    1. 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"/>
      
    2. 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"/>
      
    3. Make sure to have same web.xml file from existing webapp.
    4. 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.
    5. 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"/>
      
    6. Make sure to have error.jsp inside extended webapp.
    7. Make sure to have index.jsp file with redirect path.

Patch Management Using

...

Gradle Targets

There are 4 targets, to create/apply/reapply/revert patches for the framework, applications and specialpurpose: they are available in the ant script for auto generated hot-deploy components (see in framework/resources/templates/build.xml)

...