Commit Graph
172 Commits
Author SHA1 Message Date
Taher A. Alkhateeb 707e8e86f5 Improved: Refactor Config.java and properties files
(OFBIZ-9435)

Another round of refactoring in the start component with the following changes:

- Change the default adminKey to "NA" since it is only used in the "start"
  context. Other contexts do not require an admin server (test, load-data)
- Simplify and cleanup the locale creation logic in the constructor and move
  things out to the method with a return value
- Simplify the Timezone creation logic by moving it outside the constructor into
  a small method
- Substantially simplify the determineOfbizPropertiesFileName(..) method by
  reversing the order of condition evaluation (first, load-data, then test, then
  anything else is start)
- Change default locale to be 'en' as the system crashes if not provided.
- Remove all comments from properties files except for start.properties and
  refer to it from the other properties files
- Update the properties files accordingly

Thanks: Jacques Le Roux for review and suggestion to remove the comments from
        properties files


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1800368 13f79535-47bb-0310-9956-ffa450edef68
2017-06-30 10:19:50 +00:00
James Yong e4a7a0ef72 Implemented: OFBiz Startup Message
(OFBIZ-9285)

Provide log message after all containers/components are loaded. 
This helps to inform new developer that OFBiz has started.

Thanks: Jacques and Taher for code review and mentoring.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1789533 13f79535-47bb-0310-9956-ffa450edef68
2017-03-30 15:26:37 +00:00
Taher A. Alkhateeb efb6f60510 Fixed: Regression: a commit between R15 and the Gradle switch uses/blocks the ports
(OFBIZ-9196)
Disabled the admin server from starting on contexts other than "start"

This commit has reference to the below discussion thread in which buildbot
is failing in between commits due to blocking the admin server thread.
The commit enables the admin server only for the "start" ofbiz server command.
For all other commands the port is set to value zero and hence the admin server
is never initialized

https://s.apache.org/xfxS

Thanks: Taher for the fix

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1787627 13f79535-47bb-0310-9956-ffa450edef68
2017-03-19 14:55:13 +00:00
Jacques Le Roux 218fa05303 Fixed: JobPoller does not run and hence scheduled/async jobs are never run
(OFBIZ-9155)

Symptom:
* services that are invoked with "dispatcher.runAsync" stay "pending" in the 
job-list and never get executed
* scheduled jobs don't get executed

Steps to Reproduce
* Login to /webtools
* Schedule a Job to run in 5 mins, (for example service "clearAllEntityCaches")
* Wait 7mins

Expected:
* the scheduled service "clearAllEntityCaches" is not "pending" anymore but 
should have status "finished"

Actual:
* scheduled service "clearAllEntityCaches" is still "pending"

Analysis:
The problem can be reproduced with the OFBiz 16.11 branxh as well as 
with the OFBiz 16.11.01 zip file version and the trunk

JobPoller does get started on OFBiz start but does get stuck on line:
org.apache.ofbiz.service.job.JobPoller.java: 213-215 

The reason is that the "Start.ServerState" never reaches "RUNNING"

Doing a full-text scan through the whole source code shows, that there is no 
code at all that sets the ServerState to "RUNNING"

Comparing it to the 15.11-branch. There used to be a line:
serverState.compareAndSet(ServerState.STARTING, ServerState.RUNNING)

no such line exists in 16.11 anymore.

jleroux:  I confirm the behaviour in R16 branch as well as in trunk.

Leonard's "patch" is a good solution and works for the R16 branch which is less 
changed than the trunk when compared to R15. 

The same applies to the trunk with the relative block of code which contains
if (serverState.get() == ServerState.STOPPING) {

The line Leonard propose to add was obviously missed during the recent 
refactoring.

Thanks: Leonard Lin

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1779596 13f79535-47bb-0310-9956-ffa450edef68
2017-01-20 09:56:56 +00:00
Taher A. Alkhateeb 9cdf1909ee Improved: Refactored Config.java to simplify fields initialization
Improvements remove in total roughly 70 lines of code and includes:

- moving all default values to the constructor to make it clear
- refactor getProperty to use the Optional monad
- remove FileInputStream from getPropertiesFile as it is not used
- properly indent conditions in determineOfbizPropertiesFileName
- simplify locale creation
- remove dependency on base (StringUtil)
- other minor renamings and formatting



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1775340 13f79535-47bb-0310-9956-ffa450edef68
2016-12-20 19:26:11 +00:00
Taher A. Alkhateeb 5953cb9e64 Improved: properly implement the Optional interface for retrieving portoffset
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1775238 13f79535-47bb-0310-9956-ffa450edef68
2016-12-20 09:35:11 +00:00
Taher A. Alkhateeb 8074a9b3c6 Improved: Refactor and simplify the startup sequence in OFBiz
(OFBIZ-8337)

This is another major commit to the refactoring of the startup sequence in
OFBiz with the following highlighted changes:

- Delete the NativeLibClassLoader.java
- Delete the native classpath logic in Classpath.java
- Refactor the ComponentContainer and StartupControlPanel to operate without
  the NativeLibClassLoader. This substantially simplifies the code
- Declare a URLClassLoader in ComponentContainer that is instantiated upon
  building the classpath for all components. This makes the classloader start
  in one shot
- Simplify the Config file and remove fields that are not used. Also
  refactor some messy logic for loading the props file and other code
  improvements
- Refactor all the .properties files for startup to have a consistent
  structure that clearly documents all available properties and the
  default value for each property. This change is also related to the
  changes applied on Config.java
- Remove the declaration of the StartupLoader implementation class
  from all startup .properties files because only one implementation exists
  and it should be the default always.
- Refactor the loaders retrieval code (main, rmi, test, load-data) defined
  in the startup .properties files
- Refactor some switch statements to comply with java coding standards
- Add the DTDs defined in base through Gradle because we removed the
  NativeLibClassLoader and the classpath buildup logic in StartupControlPanel

Thanks: Jacopo Cappellato for reviewing the work


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1772879 13f79535-47bb-0310-9956-ffa450edef68
2016-12-06 12:31:00 +00:00
Taher A. Alkhateeb aadf556625 Reverted: partially reverted r1765127 to fix classpath issue
(OFBIZ-8337)

The above mentioned revision introduced a regression in which starting
OFBiz in debug mode triggers classpath exceptions due to not finding
certain jars. Upon investigation we realized that the new logic
instantiates the loader class before the custom ClassLoader is
instantiated. The fix would take a bit more time, hence reverting now
to quickly resolve the issue and make the code base ready for the next
release. The revert essentially re-introduce a List<StartupLoader> data
set instead of a single StartupLoader.

This is a minimal revert (less than 400 lines) instead of a full revert
going above 2000 lines because we isolated only the parts that trigger the
regression mentioned above. However, we should ideally revisit this code
and clean it up again with careful attention to the class loading sequence.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1767866 13f79535-47bb-0310-9956-ffa450edef68
2016-11-03 11:03:54 +00:00
Taher A. Alkhateeb d44020f0d6 Improved: Refactor and simplify the startup sequence in OFBiz
(OFBIZ-8337)

This is a major refactoring exercise to simplify the startup sequence in
OFBiz. There are no functional changes, however, both the logic and the
API signatures of the core classes in OFBiz are changed to help simplify
the startup sequence. The changes insofar are summarized as:

- Rename ContainerConfig.Container to ContainerConfig.Configuration, the old
  nameing was very confusing as it confuses it with actual containers
- Change the signature of ContainerLoader and Container to accept
  List<StartupCommand> instead of String[]. And also migrate the adapter for
  converting these args into a standalone class called
  StartupCommandsToArgsAdapter
- Remove the LockedBy annotation as it is not used
- Substantially simplify the ContainerLoader load and unload logic and delete
  the start logic (merge it with load). The interface StartupLoader was updated
  accordingly
- Remove old logic to load containers in hot-deploy components
- Remove printThreadDump output from ContainerLoader which used to exist for
  debugging purposes and is no longer necessary
- Cleanup the AdminServer startup logic
- Change the StartupControlPanel logic to use only one StartupLoader instead
  of a list. The only implementation is ContainerLoader
- Remove the synchronized blocks in StartupControlPanel due to having only one
  loader
- Update the startup .properties files to reflect the changes in the startup
  logic
- Update the TestRunContainer to use List<StartupCommand> in its logic

We expect more commits (specifically to the containers) to complete this
refactoring initiative



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1765127 13f79535-47bb-0310-9956-ffa450edef68
2016-10-16 09:07:08 +00:00
Jacopo Cappellato e9ec720bed Improved: removed some unused methods from the Classpath class.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1761594 13f79535-47bb-0310-9956-ffa450edef68
2016-09-20 15:20:19 +00:00
Jacopo Cappellato f062e9b9e9 Improved: removed the no more required property
ofbiz.start.classpath.addFilesFromPath.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1761589 13f79535-47bb-0310-9956-ffa450edef68
2016-09-20 15:03:56 +00:00
Jacques Le Roux d4d91995a5 The portoffset option does not only offset the default network port but all default ports
Better English from Scott (I wrote it right in the comment but not in the class)

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1758522 13f79535-47bb-0310-9956-ffa450edef68
2016-08-31 06:02:43 +00:00
Jacques Le Roux 9cedcd2ca3 The portoffset option does not only offset the default network port but all default ports
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1758461 13f79535-47bb-0310-9956-ffa450edef68
2016-08-30 20:12:57 +00:00
Jacopo Cappellato 1906aa927a Minor enhancements to the way the comments about RMI are worded.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1757869 13f79535-47bb-0310-9956-ffa450edef68
2016-08-26 15:05:00 +00:00
Taher A. Alkhateeb c85f812a1b remove unit tests from the start component that cause a regression - OFBIZ-7897
There were two tests in the start component that have a hidden regression which
can be repeated as follows:

- start ofbiz with a normal ./gradlew "ofbiz --start"
- Make some changes to the code
- stop ofbiz with ./gradlew "ofbiz --shutdown"

OFBiz will fail to stop because the unit tests will fail due to changed code
while OFBiz is still active.

The correct solution is to convert these tests to integration tests and handle the different
scenarios while the AdminServer is up.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1757360 13f79535-47bb-0310-9956-ffa450edef68
2016-08-23 11:42:21 +00:00
Jacques Le Roux 1db730faa9 No functional changes, simply update the documentation with respect to Gradle changes - OFBIZ-7677
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1756349 13f79535-47bb-0310-9956-ffa450edef68
2016-08-15 05:35:15 +00:00
Taher A. Alkhateeb 474299f8cc remove the tasks ofbizSecure and ofbizBackgroundSecure from gradle - OFBIZ-7951
Removes the ofbizSecure and ofbizBackgroundSecure and makes all OFBiz server tasks
secure by default. Also, update the documentation of README.md and the StartupCommandUtil
to remove these entries from the documentation.

This has reference to a thread discussion here -> http://markmail.org/message/zbbun7zrzdrtxavv


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1756305 13f79535-47bb-0310-9956-ffa450edef68
2016-08-14 07:24:42 +00:00
Jacques Le Roux ef7996c983 Fixes "Remove warnings regarding missing component lib folders" - https://issues.apache.org/jira/browse/OFBIZ-7776 - by cleaning/clearing the references to non existent/empty dirs.
Notes: 
* Also removes empty framework/base/lib/scripting and useless applications\content\lib\uno\README (miss doc in wiki)
* When jpim-0.1.jar will be (hopefully) replaced we can drop lib ref in framework/base/ofbiz-component.xml
* I wonder if we should let the geronimo component alone with only 2 classes, could we not put that in entity or entityext?
 
    



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1755306 13f79535-47bb-0310-9956-ffa450edef68
2016-08-05 12:27:21 +00:00
Taher A. Alkhateeb 59fa9f46cd Remove the testlist OFBiz server command - OFBIZ-7924
Apply the following:
- remove the testlist command from options available in OFBiz server
- Delete the TestListContainer.java which implement the behavior
- Update the Config file to ignore properties related to that command
- Delete the properties file related to the command.

This has reference to the above JIRA and the below discussion
thread in which the community agreed to remove the testlist
server command from OFBiz. This command is an old and deprecated
command that used to create an ant script which iterates over all
test suites and execute them consecutively. It is both not-needed
and also deprecated given its dependence on Ant.

The discussion thread:
http://ofbiz.markmail.org/message/r64igaf6ihvpolaa


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1754507 13f79535-47bb-0310-9956-ffa450edef68
2016-07-29 12:42:55 +00:00
Jacques Le Roux ea0ccc9721 No functional change, both Taher and I missed this little now useless var
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1754434 13f79535-47bb-0310-9956-ffa450edef68
2016-07-28 17:02:44 +00:00
Jacques Le Roux 7ada24fd04 This removes the pos component. OFBIZ-7804 "Check if we should fix or remove the POS (hence WebPos?)"
Most is done already. Test pass but testFopMacroLibrary but I don't see how it could be related to these changes, could be a quirk on Windows, BuilBot will tell us. Anyway, I will later double-check to be sure, also to see if I did not miss anything else.

I have voluntarily left 2 or 3 moot points
I was unable to remove possible POS references in <property key="FieldDescription.ProductStore.isImmediatelyFulfilled"> for certain language I'm unable to read.
I have to check if we should keep or not this code snippet
                <!-- if inventory info is not available for all of the products, then don't do the issuance, ie there has to be at least SOME inventory info in the database to facilitate inventory-less POS terminals -->
                <entity-count entity-name="InventoryItem" count-field="iiCount">
                    <condition-expr field-name="facilityId" operator="equals" from-field="orderHeader.originFacilityId"/>
                </entity-count>
I simply commented out twice this snippet in InvoiceServices.java, because I wonder if it would not be useful when the webPos will be able to issue money change
//                if (null == adj.get("amount")) { // JLR 17/4/7 : fix a bug coming from POS in case of use of a discount (on item(s) or sale, sale here) and a cash amount higher than total (hence issuing change)
//                    continue;
//                }

While at it, since I modified OPTIONAL_LIBRARIES, I also changed these svn:properties: svn:eol-style = native & svn:mime-type = text/plain


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1754402 13f79535-47bb-0310-9956-ffa450edef68
2016-07-28 12:27:20 +00:00
Taher A. Alkhateeb ce718d81c6 Break down the tests of requestStatus and requestShutdown - OFBIZ-7897
The two tests were lumped together and if one throws an exception the other
will never throw it. So test coverage was not done properly. This commit
fixes this issue by separating the calls into two different tests.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1753348 13f79535-47bb-0310-9956-ffa450edef68
2016-07-19 08:20:45 +00:00
Taher A. Alkhateeb d5cf4875a2 Introduce unit tests to the start component - OFBIZ-7897
This is the first batch of unit tests for the Start component
which introduces 8 unit tests for parsing the start commands
and also some tests for the AdminClient.

At some point if the tests become numerous we might need to
break it down into multiple files. The tests are implemented
with standard JUnit tests. A minor correction was done to the
StartupCommandUtil class by converting the List of startup
commands to a Set to remove duplicates. This was discovered
thank to the unit tests being introduced.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1753274 13f79535-47bb-0310-9956-ffa450edef68
2016-07-18 17:28:31 +00:00
Deepak Dixit 834691742b (OFBIZ-6274) Renamed OFBiz artefacts from org.ofbiz.* to org.apache.ofbiz.*.Thanks to Taher for working on it.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752920 13f79535-47bb-0310-9956-ffa450edef68
2016-07-16 10:30:49 +00:00
Taher A. Alkhateeb b37ef2d280 Migrate ALL java files from /src to /src/main/java - OFBIZ-7790
This is the first of two steps in the above mentioned JIRA. This
first step changes the java source directory for every component
from /src to /src/main/java. The next step will be adding unit
tests to every component in /src/test/java

Thank you to Deepak Dixit for tips on how to use the SVN commands
to make the appropriate file moving.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1752838 13f79535-47bb-0310-9956-ffa450edef68
2016-07-15 14:17:14 +00:00
Taher A. Alkhateeb c2cb34d1e9 First commit in replacing Apache ant with Gradle - OFBIZ-7534
This commit represents a pivotal change in the history of the
project in which the build system is being replaced from Apache
Ant to Gradle of which the discussion mail thread link is below.

Thanks to everyone who helped with testing and feedback

This commit delivers the following:

- add the gradle wrapper directory in gradle/* which holds
  all items necessary for gradle to run
- add the build.gradle master script
- add the settings.gradle script which declares all the subprojects
- add documentation for how to use everything in a new file called
  README.md (written in markdown)

The new script is capable of the functionality that used to exist
in Ant with some additional features including automation of eclipse
files generation and many other functions.

To complete this new feature, we need to apply the following _after_
this commit:
- change the buildbot to utilize gradle instead of ant
- delete all ant & maven scripts
- replace all local jars with remote ones from jcenter

Reference thread: http://ofbiz.markmail.org/message/vstt3wxuubmjgmqj?q=Important+Changes+to+Trunk+and+Use+of+Ant+%26+Gradle

Reference JIRA: https://issues.apache.org/jira/browse/OFBIZ-7534



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1751309 13f79535-47bb-0310-9956-ffa450edef68
2016-07-04 15:22:47 +00:00
Jacques Le Roux da29d8e842 This closes "Add the -server JVM argument to Ant targets like start and tools/start*.bat files" https://issues.apache.org/jira/browse/OFBIZ-7321
I kept things as simple as possible. I only changed the following Ant targets
  start
  start-secure
  start-batch
  start-batch-secure
  run-test

I also changed the startofbiz.bat file. The other start*.bat are for the POS and it's not expected to run on a server.

I put a mention when using "java -jar ofbiz.jar -u" (start)
I will add a mention in "Technical+Production+Setup+Guide" wiki page about using "java -jar ofbiz.jar"

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1748173 13f79535-47bb-0310-9956-ffa450edef68
2016-06-13 10:34:39 +00:00
Pranay Pandey f0134b07cc [OFBIZ-7214] No functional changes, adding missing license header.
Thanks Pierre Smits for reporting.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1747344 13f79535-47bb-0310-9956-ffa450edef68
2016-06-08 04:09:23 +00:00
Taher A. Alkhateeb 50127f4a9c Major commit for refactoring the start component - Ref OFBIZ-6783
A thank you is due to Jacques Le Roux, whom substantially improved
the refactoring of the start component with his QA work, and also
credit is due to Jacopo Capellato and Gil Portenseigne for their help

This commit is the last commit on OFBIZ-6783 and applies the following:

- convert the startup loaders from ArrayList to List. Given that
  only two loaders existed in the system since the beginning of 
  OFBiz means that it is really unnecessary to use the 
  loaders.trimToSize() method. It's simply too much specificity for
  no apparent performance value. this leads to changing many method
  signatures from ArrayList to list across different classes
- More simplification of Config.java by simplifying timezone setting
  logic
- remove the throws StartupException from main. This was confusing
  confused me a lot and lead to a regression from my refactoring
  in OFBIZ-7167 because some exceptions bubble up all the way to
  main but then the system does not terminate because other 
  threads are running. It took me and Jacques a long while to 
  dig it out and figure the root cause.
- Introduce a function called fullyTerminateSystem(StartupException e).
  This function replaces the exception bubble issue that is
  described above. Consequently, the methods init, status and
  shutdown no longer throw an exception but instead terminate
  the system (which is the right thing to do).
- finetune adaptStartupCommandsToLoaderArgs(...) and other 
  places in StartupControlPanel
- separate the Classpath creation from NativeLibClassLoader 
  creation. This makes it cleaner and easier to refactor
  in the future
- break the StartupControlPanel.start(...) method into
  smaller more readable methods. It is easier now to understand
  the startup sequence for ofbiz in english words (the method names).
  It also allows for cleaner refactoring in the future.
- add JavaDoc to a lot of methods all over the start component
- rename AdminPortThread to AdminServer and create a new class called
  AdminClient. Now everything relating to controlling OFBiz directly
  happens through StartupControlPanel such as start, stop or init 
  for the server, and everything which happens indirectly through
  the network (by an admin client) is done through the AdminClient
  which talks to AdminServer
- more refactoring of AdminServer to simplify the code and break it
  down into multiple methods and refactor some messy old code

Assuming this commit is stable, and after waiting for a sufficient time
I will close the JIRA and move on with the refactoring exercise.



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1747288 13f79535-47bb-0310-9956-ffa450edef68
2016-06-07 18:12:46 +00:00
Taher A. Alkhateeb d91d0dc283 Fix regression caused by refactoring start comp - ref OFBIZ-7167
Thanks to an excellent investigation by Jacques Le Roux we realized
that if not all tests are successful (on java -jar ofbiz -jar --tests)
then the system hangs and does not print HTML reports.

After investigating this issue, I realized that the old logic before
refactoring used to call System.exit(99) which executes all the shutdown
hooks and releases the system resources. In the new code, however, the
resources are not released as the exception simply bubbles up to the main
method and thrown out, while the other threads are still running. So
the resources are not released and build.xml cannot continue processing
the HTML results with <junitreport ...>

The fix is simple, but the investigation was hard. Big thank you to Jacques.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1746737 13f79535-47bb-0310-9956-ffa450edef68
2016-06-03 16:31:34 +00:00
Taher A. Alkhateeb e8b73f703f related to r1746236 on OFBIZ-6783 to delete extra files forgotten
The patch that I provided only emptied the files when they should be
deleted. This removes them completely


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1746239 13f79535-47bb-0310-9956-ffa450edef68
2016-05-31 06:56:21 +00:00
Taher A. Alkhateeb ca819dda9d Remove cobertura and sonar completely. Ref OFBIZ-6783
After getting consensus from the community in the email thread below
we agreed to remove these two items because they make the startup
logic more complex and also because many things are broken and 
unmaintained for years.

It is a good idea to reintroduce cobertura in the future on a cleaner
implementation, hopefully completely away from the start component and
perhaps as a container implementation.

The email thread:
http://ofbiz.markmail.org/message/b4jovfhurczunbam?q=remove+cobertura

The related JIRA:
https://issues.apache.org/jira/browse/OFBIZ-6783


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1746236 13f79535-47bb-0310-9956-ffa450edef68
2016-05-31 06:43:11 +00:00
Taher A. Alkhateeb 741ac838cc move validation logic to its correct place in StartupCommandUtil OFBIZ-6783
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1745584 13f79535-47bb-0310-9956-ffa450edef68
2016-05-26 09:33:46 +00:00
Taher A. Alkhateeb ed564da850 major commit to start component - for OFBIZ-6783
This is another major refactoring exercise of the start
component in ofbiz. There are too many details in this commit
that may be summarized as follows:

- refactor Start.java to make it about 140 lines long and focused
  only on high level function calls. Also minimized the number of
  class fields (state) to only two (ServerState and Config)
- Separate the AdminPortThread into a new class with some refactoring
  done to ensure interoperability with other classes
- delete CommonsDaemonStart as jsvc is not yet fully implemented in ofbiz
  and it stands in the way of a proper refactoring of ofbiz
- refactor everything so that all dependencies between classes are explicit
  through function calls (no hidden state or declarations)
- Move all the server processing logic (status, shutdown, start ...) to a 
  new class called StartupControlPanel. All methods in this class are static 
  with side effects only limited to the arguments passed to them.
- Add a few missing apache copyright headers
- Refactoring some method, variable and enum names to make them clearer
- Refactor Config.java and make it much cleaner and simpler by breaking 
  things down into private methods. Also changed the portoffset to be
  a normal int instead of a boxed int (Integer)
- redefine most classes to be package protected (not public) to offer
  more isolation from the rest of the framework
- redefine most classes to be final


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1745351 13f79535-47bb-0310-9956-ffa450edef68
2016-05-24 12:26:28 +00:00
Taher A. Alkhateeb a27bad3e90 clarify documentation for java -jar ofbiz.jar --testlist OFBIZ-6783
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744547 13f79535-47bb-0310-9956-ffa450edef68
2016-05-19 09:46:01 +00:00
Taher A. Alkhateeb e2dd77fe6d improve the --test command documentation and widen commons-cli screen OFBIZ-6783
as suggested by Jacques, the commons-cli screen is widened to be
80 characters instead of the default 74 characters. Also the test
command for java -jar ofbiz.jar is improved in terms of documentation
so that it does not break off into a newline which was confusing


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744537 13f79535-47bb-0310-9956-ffa450edef68
2016-05-19 08:54:03 +00:00
Taher A. Alkhateeb af91a37dd3 provide further clarification for usage of java -jar ofbiz.jar OFBIZ-6783
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744528 13f79535-47bb-0310-9956-ffa450edef68
2016-05-19 08:05:27 +00:00
Taher A. Alkhateeb 9ba1e73c3b provide pretty printing for error messages for startup OFBIZ-6783
Box the error messages with "=======" strings to highlight
the error the to user when calling java -jar ofbiz.jar --somewrongcommand


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744525 13f79535-47bb-0310-9956-ffa450edef68
2016-05-19 07:54:16 +00:00
Jacques Le Roux 4808935bbc Reverts formatting changes in Start component (was Improves the visibility of the Start error messages - OFBIZ-6783)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744524 13f79535-47bb-0310-9956-ffa450edef68
2016-05-19 07:38:51 +00:00
Jacques Le Roux a651b20151 No functional change, completes previous commit ("Improves the visibility of the Start error messages - OFBIZ-6783")
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744516 13f79535-47bb-0310-9956-ffa450edef68
2016-05-19 05:31:52 +00:00
Jacques Le Roux d6030d2fc2 Improves the visibility of the Start error messages - OFBIZ-6783
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744515 13f79535-47bb-0310-9956-ffa450edef68
2016-05-19 05:25:54 +00:00
Taher A. Alkhateeb c84e3320c5 major change in the start component related to OFBIZ-6783
this is a big commit that achieves the following new features in ofbiz:

- add the commons-cli library
- fix build.xml in start menu to include the commons-cli. It is done
  in a way to ensure that the classpath continues to work when ofbiz.jar
  is copied to the root folder
- set a default portoffset value of 0 when not selected in build.xml
- fully redefine the commands passed in java -jar ofbiz.jar using the commons-cli
  api. The commands are now much more consistent and clean
- remove ofbiz dependency on String[] args across the different components and isolate
  them in a new entity class called StartupCommand. This decouples ofbiz from both
  String[] args and commons-cli at the same time
- fix all the calls in the master build.xml to comply with the new commands
- fix the Config.java to remove dependecies on the args array
- create a utility class StartupCommandUtil that takes care of all commons-cli
  operations and abstracts away the implementation in private methods
- substantially reduce the size of main and init in Start.java by refactoring
  them in different places
- create an intermediate function called populateLoaderArgs. This is the first
  step in removing the dependecies on args by "adapting" them using this method
- unify the exception model everywhere to StartupException. This makes exception
  propagation cleaner and easier
- lots of cleanup of the code related in all these areas

Big thanks to Jacques for the substantial help in testing.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1744107 13f79535-47bb-0310-9956-ffa450edef68
2016-05-16 18:40:49 +00:00
Jacques Le Roux f0a5f582c1 Partially revert r1743411, some files inadvertently slipped in :/
This keep changes for OFBIZ-7053

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1743412 13f79535-47bb-0310-9956-ffa450edef68
2016-05-11 19:13:44 +00:00
Jacques Le Roux 4b364d1e5a A patch from Ravi Lodhi for "Order term description is not getting set on adding and updating new order term" https://issues.apache.org/jira/browse/OFBIZ-7053
Steps to regenerate (Create a new order) -
1) Go to Order Entry (in Order Manager) and add the necessary detail and continue.
2) Add Order items and click on Finalize Order.
3) Continue with Order Entry Ship-To Settings.
4) Add any shipment method and continue.
5) On Order Terms Page add a term with description. Term description is not getting saved. Same case with the update term functionality.

As said Florian Montalbano:
I looked into the issue and found the root of the problem :
There are multiple functions prototype to add a term to an order and the one used wasn't using the "description" field.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1743411 13f79535-47bb-0310-9956-ffa450edef68
2016-05-11 19:10:10 +00:00
Taher A. Alkhateeb ebf0bd299d refactor Start.java as per guidelines in OFBIZ-6783
This specific commit achieves the following:

- remove private comments relating to the class to the JavaDoc location 
  at the top of the class
- relocate class fields to the top of the class as per Java conventions
- relocate the constructor with its singleton instance to the top of the
  class below the fields
- sort all the methods starting with main, followed by public, default 
  and private
- add JavaDoc to main
- remove System.exit(99) from main and replace it with throw new 
  StartException(e); I did this because main declares that it throws a
  StartupException which it never does
- breakup the logic part to evaluate ofbiz command to a new method
  called evaluateOfbizCommand(String[] args). I will replace this
  eventually with apache commons-cli
- make startStartLoaders private, since it is not called outside Start.java


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1741624 13f79535-47bb-0310-9956-ffa450edef68
2016-04-29 12:50:57 +00:00
Deepak Dixit 64ef408374 Removed extra unused sign from start.properties file, I think its mistakenly committed at r#1736083.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1736272 13f79535-47bb-0310-9956-ffa450edef68
2016-03-23 05:23:41 +00:00
Jacques Le Roux e38ec39dfe This partially reverts r1735569 to simplify and have less commented out parts.
Fixes "Comment out RMI related code because of the Java deserialization issue" - https://issues.apache.org/jira/browse/OFBIZ-6942

We decided to comment out as less as possible because once, in the start and both properties; the rmi part is off and the related test services are off there is no RMI related danger left (test services are not a danger but would fail during tests run). 
It's then easier for users who need RMI in their projects to have only to uncomment those and not digg everywhere.

[CVE-2016-2170] The infamous Java serialization vulnerability

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1736083 13f79535-47bb-0310-9956-ffa450edef68
2016-03-21 20:17:59 +00:00
Jacques Le Roux b021268fa7 Fixes "Comment out RMI related code because of the Java deserialization issue" - https://issues.apache.org/jira/browse/OFBIZ-6942
I decided to comment out as less as possible because once the RMI loaders, the RMI dispatcher and the related test services are off there is no RMI related danger left (test services are not a danger but would fail during tests run). It's then easier for users who need RMI in their projects to have only to uncomment those and not digg everywhere. Because the naming (JNDI) server relies on the rmi loader it will also be commented out.

[CVE-2016-2170] The infamous Java serialization vulnerability

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1735569 13f79535-47bb-0310-9956-ffa450edef68
2016-03-18 10:38:04 +00:00
Jacques Le Roux 067df90ae1 After r1695126, I found that most of the Java files have svn:eol-style=native. So only 116 Java files were missing svn:eol-style=native. I guess those have been added by committers who are not using the OFBiz svn config file on their machines. So rather than removing svn:eol-style=native, this commits add the property to the files which miss it. Here 116+89=205 files have their svn:eol-style property changed to native.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1695129 13f79535-47bb-0310-9956-ffa450edef68
2015-08-10 16:33:23 +00:00
Jacques Le Roux dca48b0893 Reverts r1044202. No functional change.
This reverts svn:eol-style=native on Java files which were forced by r1044202n, 89 Java files are concerned. This commit hopefully makes things more consistent. 
It's indeed hard to see the impact of this change before it's committed. I'll check once done, I already found 116 Java files w/o svn:eol-style=native but there are 1231 Java files at all, so not sure how most are set...


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1695126 13f79535-47bb-0310-9956-ffa450edef68
2015-08-10 16:15:37 +00:00