Checkout
 

mthl in ofbiz

Improved: Refactor ‘ContainerConfig’ class

(OFBIZ-11256)

This removes some code duplication, make things immutable and add some javadoc.

Improved: Use ‘checkstyle’ linting tool

(OFBIZ-11251)

Linting [1] is a software engineering practice which make the code more

readable and maintainable by improving its consistency and avoiding

potential programming mistakes. Gradle provides a core plugin for the

‘checkstyle’ tool [2][3] which implement a linting facility for the Java

language.

The check is done with the ‘gradlew check’ command.

There are currently a lot reported errors that will need to be fixed

incrementally in the future. We ensure that new errors will not be

introduced by defining a global threshold of “allowed” errors

corresponding to the sum of errors found in the framework and in the

official plugins.

[1] https://en.wikipedia.org/wiki/Lint_(software)

[2] https://checkstyle.org/

[3] https://docs.gradle.org/current/userguide/checkstyle_plugin.html

Thanks: Taher Alkhateeb and Jacques Le Roux for their feedback

Improved: Refactor ‘ComponentConfig.ClasspathInfo’

(OFBIZ-11192)(OFBIZ-11238)

The validity checks have been moved at construction time instead of

relying on client code to ensure that the class path information are

sound.

A new ‘ComponentConfig.ClasspathInfo.Type’ enum has been defined to

improve type safety.

The location of the class path information is now using a

‘java.nio.file.Path’ class instance.

Improved: Specify that the component dependencies are never ‘null’

(OFBIZ-11238)

Improved: Use ‘Path’ for component config ‘rootLocation’ attribute

(OFBIZ-11192)

The method ‘ComponentConfig#getRootLocation’ has been removed

and replaced by ‘ComponentConfig#rootLocation’.

The callers have been adapted.

Improved: Rewrite ‘Classpath’ class

(OFBIZ-11237)

This class has been moved to ‘org.apache.ofbiz.base.container’ to be

able to reduce its visibility to the “package” level.

The API has been change to avoid unnecessary checks and simpler dataflow.

There was no need to provide thread safety so the ‘synchronized’

blocks have been removed.

Improved: Remove unnecessary semicolon

Improved: Remove unused imports

Improved: Add missing generic types

Improved: Refactor ‘ComponentContainer#loadComponentFromConfig’

(OFBIZ-11192)

The unnecessary declared ‘ContainerException’ exception has been removed. A

switch statement has been used and the javadoc has been rewritten.

Additionally the method has been renamed to ‘ComponentContainer#loadComponent’.

Improved: Use ‘java.nio.file’ API in ‘ComponentContainer’ class

(OFBIZ-11192)

Improved: Convert ‘Config#ofbizHome’ and ‘Config#logDir’ to a path

(OFBIZ-11192)

Improved: Refactor ‘ComponentLoaderConfig’ class

(OFBIZ-11192)

This redefines the ‘ComponentLoaderConfig#ComponentDef’ class by

removing its unused name attribute.

The ‘java.nio.file’ API has been used to represent the relative path

of a component location.

Various cleanups and Javadoc added.

Improved: Allow updating the ‘Config’ object of the server instance

(OFBIZ-11203)

When doing some informal tests, it is useful to be able to create

small programs using the OFBiz delegator without requiring every

components to be loaded as done by the ‘Start#main’ static method.

To achieve that with the current singleton based implementation, we

need to instantiate a custom ‘Config’ object and use it as the global

configuration.

Thanks: Samuel Trégouët for your contribution.

Reverted: JSON entity data import and export utility

(OFBIZ-10966)

Implementation was not matching OFBiz code quality requirements.

  1. … 3 more files in changeset.
Improved: Use spaces instead of tabs in “common.gradle”

Thanks: Samuel Trégouët for your contribution

Improved: Don't exclude properties and labels file from the Jar

(OFBIZ-11161)

In order to have an independent deployable jar, we need to include the

properties and labels inside the jar.

The properties and labels file was previously excluded from the jar

because it was not possible to replace the compile time values by

invalidating OFBiz caches which is convenient when developing

OFBiz. It was then necessary to reconstruct the jar and restart

OFBiz (See OFBIZ-8321 for more details).

With the recent improvment from revision 1865719 allowing to run OFBiz

without building a jar, it is now possible to enable this cache

invalidation by running both ‘gradle run’ in one shell and ‘gradlew

--continuous classes’ in a separate shell. Doing so make the

combination of editing the label files and clearing the caches use

the new value defined in the source file.

Improved: Remove redundant type declarations

Improved: Add missing override annotation

Improved: Remove unused imports

Improved: Remove unused code in ‘UtilValidate’

(OFBIZ-11172)

The code was not used in Java/Groovy/FreeMarker/XML in the framework

or official plugins.

Improved: Inline ‘UtilValidate#areEqual’

(OFBIZ-11172)

‘Objects#equals’ is already providing the same functionality of ‘null’

safe equality check.

Improved: Remove redundant "dtd" directory from classpath

(OFBIZ-11161)

the "dtd" directories are already present as resources distributed

inside OFBiz jar, so there is no need to augment the classpath to find

the XML schema inside those directories.

    • ?
    /ofbiz-plugins/trunk/example/ofbiz-component.xml
Improved: Remove redundant "dtd" directory from classpath

(OFBIZ-11161)

the "dtd" directories are already present as resources distributed

inside OFBiz jar, so there is no need to augment the classpath to find

the XML schema inside those directories.

Improved: Remove useless ‘GroovyScriptTestCase’

(OFBIZ-11165)

This class was useless since ‘GroovyScriptTestCase’ provides the same

interesting feature as ‘OFBizTestCase’ meaning a delegator and a dispatcher.

  1. … 3 more files in changeset.
Improved: Compile groovy integration tests

(OFBIZ-11165)

Since there is no need for dynamic reload for integration tests,

it is better to compile Groovy tests.

  1. … 47 more files in changeset.
Improved: Make ‘gradlew’ depend on :jar and :test

(OFBIZ-11162)

The default task was previously depending on :build which was requiring to

mess with the dependency graph in order to avoid executing the :distTar and

:distZip tasks which are too big to be executed by default.

It is cleaner to simply define the default tasks to :jar and :test.

Improved: Make ‘gradlew ofbiz’ depend on :classes instead of :build

(OFBIZ-11162)

It is not necessary to build the jar to run OFBiz. It is only

necessary to compile the classes in the build directory. This adapts

‘gradlew ofbiz’ to have the same dependencies as ‘gradlew run’.

Improved: Separate resources from Java source files

(OFBIZ-11161)

This moves the resource files in a dedicated "src/main/resources"

directory. This convention follows the Maven standard directory

layout which is the convention used by default in Gradle.

  1. … 36 more files in changeset.
Improved: Use method references instead of lambda inside variables

(OFBIZ-10817)

Lambda expressions are not meant to be stored inside variables. In

most cases it is better to define a static method and use a method

reference instead. Static methods have the benefits of having a more

explicit signature and some javadoc attached to them.