Commit Graph
1462 Commits
Author SHA1 Message Date
Jacopo Cappellato bde211be6d Small optimization: two strings for sql statements are now stored as final strings in the SequenceBank object.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621599 13f79535-47bb-0310-9956-ffa450edef68
2014-08-31 15:41:52 +00:00
Jacques Le Roux eb44087cd8 Upgrades Derby from derby-10.10.2.0.jar to derby-10.11.1.1.jar, tests OK (4 not relevant failures on Windows, we will get confirmation with Buildbot, or revert)
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621581 13f79535-47bb-0310-9956-ffa450edef68
2014-08-31 10:18:38 +00:00
Adrian Crum fe096a298c Fixing some GenericDelegator method signatures to match the Delegator interface.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621460 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 13:38:24 +00:00
Adrian Crum f3e657b4d8 Move some GenericDelegator static methods to the Delegator interface.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621448 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 12:01:45 +00:00
Adrian Crum 0a76309879 Removed unnecessary public keywords from the Delegator interface.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621445 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 11:22:46 +00:00
Adrian Crum f14616dbdb Small code cleanup - use auto-boxing.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621442 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 09:53:25 +00:00
Adrian Crum 4e38c83fbc Removed references to GenericDelegator from Delegator interface.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621439 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 09:19:38 +00:00
Jacopo Cappellato 892ed70e57 Completely refactored the SequenceUtil class:
* the class is now thread safe
* the class is now cleaner (no references to delegator etc...)
* replaced the collision detection algorithm with a simpler/reliable/efficient one based on: update with no changes (to get a lock) + select + update (to increase the last sequence id)
* removed ugly special code for "clusters" that is no more needed



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621438 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 09:17:07 +00:00
Adrian Crum f4f119d057 Removed a deprecated constructor from GenericDelegator.java.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621437 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 09:12:00 +00:00
Adrian Crum 00d61094d0 Removed some references to GenericDelegator concrete class.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621436 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 09:00:39 +00:00
Jacopo Cappellato e5018c0031 Misc minor enhancements to the testSequenceValueItemWithConcurrentThreads unit test.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621425 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 08:32:14 +00:00
Adrian Crum 724ec8bb49 Fixed bugs in GenericDelegator.java - storeByCondition and removeByCondition did not update the cache, resulting in stale cache entries.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621413 13f79535-47bb-0310-9956-ffa450edef68
2014-08-30 02:49:22 +00:00
Adrian Crum 1810b389c7 Fix unintended change in my last commit.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621386 13f79535-47bb-0310-9956-ffa450edef68
2014-08-29 20:58:25 +00:00
Adrian Crum b4db076bb4 Unit test to demonstrate the bug I found in GenericDelegator.java. Test is commented out.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621385 13f79535-47bb-0310-9956-ffa450edef68
2014-08-29 20:56:08 +00:00
Jacopo Cappellato 38f5c17d0d Fixed an issue affecting the thread safeness of the SequenceBank objects.
Added two unit tests to confirm the proper behavior of the SequenceUtil class; the second test fails without the fix committed with this revision.
Part of OFBIZ-2353.
This is just the first pass of my work to refactor the SequenceUtil.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621335 13f79535-47bb-0310-9956-ffa450edef68
2014-08-29 16:26:51 +00:00
Adrian Crum 9156158d93 Found a bug in GenericDelegator.java. No time to fix it now, so leaving a FIXME comment.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1621122 13f79535-47bb-0310-9956-ffa450edef68
2014-08-28 11:36:39 +00:00
Jacopo Cappellato c00fc92699 Merged framework-api-cleanup branch into trunk.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1620538 13f79535-47bb-0310-9956-ffa450edef68
2014-08-26 09:16:52 +00:00
Adrian Crum c63cb8c89e Better encapsulation of entity engine multitenant setting.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1620120 13f79535-47bb-0310-9956-ffa450edef68
2014-08-24 10:27:24 +00:00
Jacopo Cappellato 10aceb0cfe Trivial fix to a log statement.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1619799 13f79535-47bb-0310-9956-ffa450edef68
2014-08-22 13:12:51 +00:00
Jacopo Cappellato 52d0dc1568 Upgraded Derby (embedded dbms) to the latest bug fix release 10.10.2.0
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1619319 13f79535-47bb-0310-9956-ffa450edef68
2014-08-21 09:16:40 +00:00
Adrian Crum 3fbbbd685a Remove console warnings related to method deprecation, https://issues.apache.org/jira/browse/OFBIZ-5718.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1618459 13f79535-47bb-0310-9956-ffa450edef68
2014-08-17 06:05:50 +00:00
Adam Heath e4bbbc71cc We now have a real delegator container, that can be used to auto-start
many delegator instances.  Just specify the ones to load, separated by
commas or spaces.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617817 13f79535-47bb-0310-9956-ffa450edef68
2014-08-13 19:38:54 +00:00
Adam Heath dbe9fd76da Now that the thread-pool startup dead-locks are fixed, we can configure
the entirety of the delegator in a thread pool.  This will become a big
win very shortly, when multiple delegators are created at startup.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617816 13f79535-47bb-0310-9956-ffa450edef68
2014-08-13 19:38:48 +00:00
Adam Heath 65d560bc14 Use the BATCH thread pool for the helper initialization.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617815 13f79535-47bb-0310-9956-ffa450edef68
2014-08-13 19:38:41 +00:00
Adam Heath 19fdeb617a Initialize the DistributedCacheClear handler in a thread pool.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617814 13f79535-47bb-0310-9956-ffa450edef68
2014-08-13 19:38:36 +00:00
Adam Heath cc0d265276 Initialize the eca handler in asycnhronously. This requires the previous
patch, that initializes the eca handlers DispatchContext asynchronously.
With it, when the eca attempts to initialize, the DelegatorContext will
also initialize at the same time; this will end up calling back into the
same delegator, and a deadlock will occur.

When both are asynchronous, then the eca initialization will return
quickly, and upon first access, the DispatchContext future will be
waited for.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617813 13f79535-47bb-0310-9956-ffa450edef68
2014-08-13 19:38:30 +00:00
Adam Heath 61a8dabc7e Add a GLOBAL_BATCH thread pool. This is different than GLOBAL_EXECUTOR,
in that:

* BATCH does not block when all the coreThreads are busy, as would
  happen with EXECUTOR.  When all coreThreads are busy, new threads will
  be spawned.
* Scheduled jobs can *not* be submitted.

You can simulate the first problem, by modifying ExecutionPool, and
force-setting the threadCount to 1.  Then, submit something to the pool,
that will then itself submit more items into the pool.  Dead-lock will
occur.

BATCH should be used when it might be posslbe that more items could be
submitted by code you are calling.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617810 13f79535-47bb-0310-9956-ffa450edef68
2014-08-13 19:38:12 +00:00
Jacopo Cappellato 951b7ccb56 Fix for a typo and an important optimization: enabled cache lookup for the retrieval of SystemProperty records.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1617480 13f79535-47bb-0310-9956-ffa450edef68
2014-08-12 14:12:30 +00:00
Jacopo Cappellato 066d782950 Misc minor cleanups to log messages.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1616744 13f79535-47bb-0310-9956-ffa450edef68
2014-08-08 13:16:46 +00:00
Jacopo Cappellato 37d586c160 Converted some startup messages from "important" to "info".
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1616431 13f79535-47bb-0310-9956-ffa450edef68
2014-08-07 07:52:23 +00:00
Jacopo Cappellato 4f4f95092c OFBIZ-4283: miscellaneous enhancements to give more control in the configuration of the DBCP connection pool. Thanks to Philippe Mouawad for the initial contribution that I have used as a starting point for a different implementation.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1613431 13f79535-47bb-0310-9956-ffa450edef68
2014-07-25 13:19:59 +00:00
Jacopo Cappellato f66ab18d6e Upgrade to Commons DBCP 2; this new version is designed for Java 7 (JDBC 4.1).
Commons DBCP 2 relies on Commons Pool 2 and this commits upgrades that jar too.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1612909 13f79535-47bb-0310-9956-ffa450edef68
2014-07-23 18:26:33 +00:00
Adam Heath 8ea51fb77e Fix issues with inventory creation/transfer tests, and with the entity
engine tests, when run with java1.7.  Apparently, the order of methods
returned by reflection varies between runs, so if methods have implicit
requirements on each other, you get spurious errors.

The are 3 types of fixes:

* Combine the separate testCase methods into one
* Add explict method ordering.
* Make use testCase method completely stand-alone.

The product inventory tests were combined, while the entity engine tests
were restructured to be stand-alone.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1605269 13f79535-47bb-0310-9956-ffa450edef68
2014-06-25 05:27:30 +00:00
Adam Heath 1596c224f4 Re-enable hiding of condition parameters in toString calls; this was
accidentally checked in as part of r1604972.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604985 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:45:28 +00:00
Adam Heath c423838342 Remove encryptConditionFields from the condition objects; now, the
encryption/decryption happens at the jdbc layer, when values are set
into a PreparedStatement, or fetched from a ResultSet.

This means that conditions are no longer munged to contain the encrypted
value, and entities are no longer updated to temporarily contain the
encrypted value.  In all cases, the value of a field in memory will be
unecncrypted.

This fixes the following code patterns:

person = delegator.create("Person", [partyId: "my-party"]);
person.socialSecurityNumber = "1234";
person.store();
// this fails, the encrypted value is stored inside entity
assertEquals("1234", person.socialSecurityNumber);
currentValue = person.socialSecurityNumber
person.store();
// this fails, the field is doubly-encrypted
assertEquals(currentValue, person.socialSecurityNumber);

origCondition = EntityCondition.makeCondition(
    "socialSecurityNumber",
    EntityOperator.EQUALS,
    "1234"
);
list = delegator.findList("Person", origCondition);
newCondition = EntityCondition.makeCondition(
    "socialSecurityNumber",
    EntityOperator.EQUALS,
    "1234"
);
// this fails, because the condition is updated in-place, with the
// encrypted field value.
assertEquals(origCondition, newCondition);

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604976 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:24:22 +00:00
Adam Heath eeb2cc31f3 Condition objects are now immutable. This removed more uses of
javolution classes, namely, all the factory support code is now gone.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604975 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:24:08 +00:00
Adam Heath e226c3310b Restructured so that the built-up object is a wrapper around the actual
condition; this allows the wrapped value to be changed, as the builder
api is used, and will make it possible for the actual condition object
to be made final.

To allow for this wrapper to be passed to the delegator, it extends
EntityCondition, and delegates all calls to the contained condition
object.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604974 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:24:01 +00:00
Adam Heath fb157fd4c7 encryptConditionFields now returns a new EntityCondition, if it did
anything.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604973 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:54 +00:00
Adam Heath 40a06ca876 Add EntityConditionValue.encryptConditionFields support to
EntityConditionValue.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604972 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:46 +00:00
Adam Heath b6662d97b3 In EntityExpr.encryptConditionFields. pass the call down to the lhs and
rhs when we are in join mode.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604971 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:38 +00:00
Adam Heath 9d5779c95b This is the first phase at making EntityCondition objects immutable; the
classes/fields not yet finalized are left undone due to there being
side-effects with other parts of the code base.  These side-effects will
be fixed shortly.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604969 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:32 +00:00
Adam Heath 5bc5c4151f Change encrypt=true fields to no longer have a pre-pended salt value.
This is done by just setting the length of salt bytes to 0, but still
having a length byte prepended.

Add a feature to allow for certain fields to actually have a salt
prefix.  This is enabled by setting encrypt=salt in the entity
definition.

This change is slightly incompatible with existing code.  Old database
values will continue to be decrypted correctly.  However, newly
encrypted values will no longer have a salt prepended, while originally
they would.  This shouldn't be a problem in practice.

This change, along with the previous commit, finally allow for direct
lookup of encrypted values.  However, already stored values will not be
found.  To fix those, each database row will have to be read in by
ofbiz, then immediately written back out.

This is part two to completely fix OFBIZ-5959:
Person.socialSecurityNumber can't be used for findByAnd.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604968 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:23 +00:00
Adam Heath 91b11ac4f8 Fix EntityExpr encryptConditionFields; in normal use, lhs would never be
a String, because it would end up being wrapped in an EntityFieldValue
object.  The only way it would be a String is during incorrect
Freemarker lookups(which no longer happen, as the
EntityCondition.makeCondition factory pattern is now in use).

With this fix in place, EntityExpr can finally start encrypting it's
field values, so that direct matching on encrypted fields can work.

This is part one to fix OFBIZ-5959: Person.socialSecurityNumber can't be
used for findByAnd.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604967 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:11 +00:00
Adam Heath 0aaad002d6 Start creating test cases for the entity engine crypto feature.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604966 13f79535-47bb-0310-9956-ffa450edef68
2014-06-24 00:23:04 +00:00
Adam Heath cf7cfdc544 Remove the last uses of FastList from the entity engine.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1604038 13f79535-47bb-0310-9956-ffa450edef68
2014-06-19 21:38:48 +00:00
Jacques Le Roux d7782d5fb9 Completes OFBIZ-5648 - Extend primary keys, removes trailing blanks
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1597273 13f79535-47bb-0310-9956-ffa450edef68
2014-05-24 09:51:48 +00:00
Jacques Le Roux 79365e65da Completes OFBIZ-5648 - Extend primary keys, by adding XSD documentation about current restrictions
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1597270 13f79535-47bb-0310-9956-ffa450edef68
2014-05-24 09:14:22 +00:00
Jacques Le Roux a00123d7e7 Closes OFBIZ-5648 - Extend primary keys
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1597239 13f79535-47bb-0310-9956-ffa450edef68
2014-05-24 05:09:39 +00:00
Jacopo Cappellato 1ea8fe79b2 Fixes for a bug reported by Pierre Smits in OFBIZ-4130 (and OFBIZ-5319): a tenant user can access, via the delegator, the meta data information of other tenants; for example a tenant user with grants to use the Webtools application could view/edit the database details of all tenants.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1589589 13f79535-47bb-0310-9956-ffa450edef68
2014-04-24 05:19:13 +00:00
Adrian Crum c63f91c75b GenericEntity.java bug fix, updated the unit tests.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1575589 13f79535-47bb-0310-9956-ffa450edef68
2014-03-08 18:48:35 +00:00