Commit Graph
1462 Commits
Author SHA1 Message Date
Adam Heath e3c2dac101 DEPRECATION: framework: GenericValue.getRelated(ByAnd|OrderBy)(|Cache)
replaced by the single getRelated variant.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343527 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:20:26 +00:00
Adam Heath fb698e509b Deprecate all GenericValue.getRelated and GenericValue.getRelatedCache,
and add a version that takes a cache parameter.

Continuing the simplication of the entity api, this is the final step to
replacing all the GenericValue.getRelated(and cache versions as well)
with a variant that takes a boolean useCache parameter.

GenericValue.getRelated(String) is replaced by
GenericValue.getRelated(String, Map, List, boolean).

GenericValue.getRelated(String, List) is replaced by
GenericValue.getRelated(String, Map, List, boolean).

GenericValue.getRelated(String, Map, List) is replaced by
GenericValue.getRelated(String, Map, List, boolean).

GenericValue.getRelatedCache(String) is replaced by
GenericValue.getRelated(String, Map, List, boolean).

GenericValue.getRelatedCache(String, Map, List) is replaced by
GenericValue.getRelated(String, Map, List, boolean).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343526 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:20:19 +00:00
Adam Heath 83d37a796b DEPRECATION: framework: GenericValue.getRelated/getRelatedCache variants replaced with a single getRelated variant that takes a boolean useCache parameter.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343509 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:17:17 +00:00
Adam Heath 21c0cef59e DEPRECATION: Add a new GenericValue.getRelated() variant that takes a
boolean useCache parameter.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343508 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:16:57 +00:00
Adam Heath fb3e3bb557 Deprecate all Delegator.getRelated and Delegator.getRelatedCache
and add a version that takes a cache parameter.

This Continuing the simplication of the entity api, this is the final step to
replacing all the GenericValue.getRelated(and cache versions as well)
with a variant that takes a boolean useCache parameter.

Delegator.getRelated(String, Map, List, GenericValue) is replaced by
Delegator.getRelated(String, Map, List, GenericValue, boolean).

Delegator.getRelatedCache(String, GenericValue) is replaced by
Delegator.getRelated(String, Map, List, GenericValue, boolean).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343507 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:16:51 +00:00
Adam Heath c9eaf52fc9 FEATURE: Add new Delegator.getRelated that takes a boolean useCache
parameter; all internal calls from GenericDelegator and GenericValue
have been modified to use the new method.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343506 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:16:42 +00:00
Adam Heath 5bc50ed5f2 Deprecate GenericValue.getRelatedOne/getRelatedOneCache, and add
a version that takes a cache parameter.

Yet again, another simplication of the delegator api.  This replaces
all simple getRelatedOne type methods with a single version that takes
all possible arguments.

GenericValue.getRelatedOne(String) is replaced by
GenericValue.getRelatedOne(String, boolean).

GenericValue.getRelatedOneCache(String) is replaced by
GenericValue.getRelatedOne(String, boolean).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343504 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:16:26 +00:00
Adam Heath 1aa422773b DEPRECATION: framework: getRelatedOne variants replaced with a getRelatedOne variant that takes a boolean useCache parameter.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343478 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:11:19 +00:00
Adam Heath 9e8ddebcac FEATURE: Add GenericValue.getRelatedOne that takes a boolean useCache parameter.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343477 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:10:58 +00:00
Adam Heath 7cf7538567 Deprecate all Delegator.getRelatedOne/getRelatedOneCache, and add a
version that takes a cache parameter.

This commit finishes the Delegator.getRelatedOne set of changes; the
previous methods are now deprecated, and the new ones should be used
going forward.

Delegator.getRelatedOne(String, GenericValue) is replaced by
Delegator.getRelatedOne(String, GenericValue, boolean).

Delegator.getRelatedOneCache(String, GenericValue) is replaced by
Delegator.getRelatedOne(String, GenericValue, boolean).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343476 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:10:52 +00:00
Adam Heath 221b2c0312 FEATURE: Add Delegator.getRelatedOne variant that takes a boolean useCache parameter.
Rework internal GenericDelegator methods to call the new method, but no
other external classes directly call this new one yet.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343475 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:10:44 +00:00
Adam Heath ce8e0a2c24 FIX: Found a local case of findByPrimaryKey usage.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343471 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 04:09:53 +00:00
Adam Heath 1ba97a3210 FIX: This is the correct fix for 1343088;
TransactionUtil.doNewTransaction was starting a new transaction, then
immediately suspending it.  This caused confusion in calling code that
tried to use doNewTransaction.  Fortunately, this was not used very
much,

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343469 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 03:55:05 +00:00
Adam Heath a2d4b1b5e3 OPTIMIZE: Change return type of noTransaction(Callable) to
NoTransaction; it used to be Callable.  NoTransaction implements
Callable.  This change requires a recompile, but is otherwise
compatible with calling code.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343468 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 03:54:58 +00:00
Adam Heath b829aa5d60 FEATURE: Change NoTransaction.call() to throw GenericEntityException
instead of Exception.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343467 13f79535-47bb-0310-9956-ffa450edef68
2012-05-29 03:54:51 +00:00
Jacopo Cappellato 247c205188 Improved code that manages the cache:
* replaced putIfAbsent + get with putIfAbsentAndGet to avoid the risk of a NPE if the cache entry is removed (or expired) between the two calls



git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343287 13f79535-47bb-0310-9956-ffa450edef68
2012-05-28 15:32:28 +00:00
Jacques Le Roux baa73733d2 Where it shows that maintaining help is not that easy. Unlike Javadoc you don't have under eyes when changing things
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1343030 13f79535-47bb-0310-9956-ffa450edef68
2012-05-27 10:41:13 +00:00
Jacopo Cappellato 8c28b9751b Modified validation query (executed by DBCP to verify that a connection is valid before borrowing it) to remove dependency on the the "example" component; thanks to Adam Heath and Jacques Le Roux for the suggestions and tests to find out a proper SQL statement (db independent and efficient).
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1342310 13f79535-47bb-0310-9956-ffa450edef68
2012-05-24 16:12:05 +00:00
Jacopo Cappellato 748dd94841 Removed unused imports.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1340637 13f79535-47bb-0310-9956-ffa450edef68
2012-05-20 08:21:18 +00:00
Jacopo Cappellato 79ae52492a Refactored code to use the default BeansWrapper defined by FreemarkerWorker; this is important according to comment from one of the Freemarker committers:
"As of creating new BeansWrapper, be sure you create it only once during the application life-cycle and then reuse the same instance, or else it will have to rebuild the class introspection cache again and again."

Thanks to Adam Heath for the comment.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1340631 13f79535-47bb-0310-9956-ffa450edef68
2012-05-20 07:49:45 +00:00
Adam Heath abdead8200 Remove errant NOTE for 2008 that was part of a cut-n-waste.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338735 13f79535-47bb-0310-9956-ffa450edef68
2012-05-15 14:45:45 +00:00
Adam Heath 6299c90426 Deprecate all Delegator.findByAnd and Delegator.findByAndCache;
introduce a new Delegator.findByAnd variant that takes a boolean cache
parameter.

This change continues the simplication of the delegator api.  There is
no longer a version of a method with a 'Cache' suffix; instead, a single
version now exists that takes a boolean cache parameter.  Also, there
has been a trend to remove several method variants that take different
numbers and types of parameters, instead preferring to fully specify all
parameters; this also continues that trend.

Delegator.findByAnd(String, Map) is replaced with findByAnd(String, Map,
null, false).

Delegator.findByAnd(String, Map, List) is replaced with
findByAnd(String, Map, List, false).

Delegator.findByAnd(String, Object...) is replaced with
findByAnd(String, Map, null, false).  The object array is converted to a
map by using UtilMisc.toMap(Object...).

Delegator.findByAndCache(String, Map) is replaced with findByAnd(String,
Map, null, true).

Delegator.findByAndCache(String, Map, List) is replaced with
findByAnd(String, Map, List, true).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338424 13f79535-47bb-0310-9956-ffa450edef68
2012-05-14 21:03:45 +00:00
Adam Heath 9e5f405a4d DEPRECATION: framework: findByAnd variants replaced with findByAnd that takes a boolean useCache parameter.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338403 13f79535-47bb-0310-9956-ffa450edef68
2012-05-14 20:59:54 +00:00
Adam Heath 321196326a OPTIMIZE: One findByAnd call was calling another findByAnd, instead of
calling findList directly.  This change should speed it up(just
slightly).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338402 13f79535-47bb-0310-9956-ffa450edef68
2012-05-14 20:59:26 +00:00
Adam Heath 14db0dbfda DEPRECATION: Add new findByAnd variant, that has a boolean useCache
parameter; this is the same similiar pattern that other methods have.

After all code has been modified to use this new method, the older
methods will be deprecated(and eventually replaced).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338400 13f79535-47bb-0310-9956-ffa450edef68
2012-05-14 20:59:20 +00:00
Jacopo Cappellato cef1cccf82 OFBIZ-4864
* enabled by default the DebugManagedDataSource wrapper around ManagedDataSource
* enhanced the DebugManagedDataSource wrapper to:
** print log messages only at verbose level (instead of always as it was before)
** if possible print additional information about the connection status
** added new method that returns information about the connection pool settings/status
* added new static method to DBCPConnectionFactory to return information about the pools
* new screen in the webtools where information about each pool/helper is shown
The information provided by the screen can be very useful to analyze the status of the connection pools.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338230 13f79535-47bb-0310-9956-ffa450edef68
2012-05-14 14:45:43 +00:00
Jacques Le Roux ef02599c23 Removes the ij.script and derbytools-10.8.2.2.jar.
Reasons for this:
 * no active committer was maintaining it
 * it's maintained by the Derby project, see http://db.apache.org/derby/docs/dev/tools/ for details


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1338173 13f79535-47bb-0310-9956-ffa450edef68
2012-05-14 12:03:58 +00:00
Adam Heath 2b3fdc9379 Deprecate Delegator.findByPrimaryKey and Delegator.findByPrimaryKeyCache.
Ofbiz is moving towards simpler delegator apis; this means all
'fooCache' variants are removed(and their matching 'foo' method), and a
new version of 'foo' added that takes a boolean cache parameter.

Delegator.findByPrimaryKey(String, Map) is replaced with
findOne(String, Map, false).

Delegator.findByPrimaryKeyCache(String, Map) is replaced with
findOne(String, Map, true).

Delegator.findByPrimaryKey(String, Object...) is replaced with
findOne(String, false, Object...).

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1337688 13f79535-47bb-0310-9956-ffa450edef68
2012-05-12 21:22:26 +00:00
Ashish Vijaywargiya e0971b304c Applied similar fix as we did on trunk r1300463.
On production systems you can't suppress Debug.log( message by the use of debug.properties file. It is always good to use Debug.* statements that are having log level setup in debug.properties file. The real problem comes with Debug.log( statement when you are printing any list or map object that contains so many records(or data) in it. Here I am changing all the occurrence of Debug.log( with Debug.logInfo(, Debug.logError( or Debug.logWarning( so that we can have better control of Debug.* statements on production system. :-)

Bad use of Debug statement. On production system you will get false alarm that you are having error in code base although the resultant statement is only giving additional information instead of error message.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1335927 13f79535-47bb-0310-9956-ffa450edef68
2012-05-09 05:28:17 +00:00
Adam Heath 6cd099d6fd FEATURE: Key-encrypting-key(kek) support is now enabled. To enable
support for this, run:

java org.ofbiz.base.crypto.Main -kek

and paste that value as a new attribute in entityengine.xml, <delegator
key-encrypting-key="$kekText"/>.  Make certain to add that attribute to
*all* delegators that share the same datasources.

ps: That java command should really be added to build.xml.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1335268 13f79535-47bb-0310-9956-ffa450edef68
2012-05-07 21:27:32 +00:00
Adam Heath 48062a3c41 FIX: There is a problem with tenant kek support, this should fix it.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1335064 13f79535-47bb-0310-9956-ffa450edef68
2012-05-07 15:29:28 +00:00
Hans Bakker 7f14038f90 fix duplicate relation name
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334927 13f79535-47bb-0310-9956-ffa450edef68
2012-05-07 08:58:06 +00:00
Adam Heath f1be0a1e0c FEATURE: Add key-encrypting-key support; this is to bring ofbiz *much*
closer to PCI compliance.  This key handler is *still* not active.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334257 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 23:37:06 +00:00
Adam Heath 48a8ed8b34 OPTIMIZE: Move delegatorInfo assignment into the constructor; in all
cases, this will always be configured, so might as well do it early.
This really should be final, but that change will come later.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334256 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 23:36:56 +00:00
Adam Heath a1f182fe02 FEATURE: Add SaltedBase64StorageHandler to EntityCrypto; key names are
base-64 crypted({hashType}$text), key values are base64 encoded,
encrypted row values are $salt$encoded.  Note, however, that this code
is not yet active, as it hasn't been added to the list of key handlers.

This new handler is *not* active yet.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334255 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 23:36:50 +00:00
Adam Heath 31f3253361 OPTIMIZE/FEATURE: Move a bunch of code around, into a set of abstract
classes and concrete instances.  This allows for adding new types of key
management blocks, so that enhanced features can be added.  No
functional changes have actually been implemented yet; all existing
systems should behave *exactly* the same.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334254 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 23:36:44 +00:00
Adam Heath 53d1aa5762 OPTIMIZE: Remove the use of a few internal variables, and return results
directly.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334253 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 23:36:37 +00:00
Adam Heath 53492a9a9a OPTIMIZE: Now that safe locking/threading is supported, there is no
longer a need to pre-populate the EntityKeyStore table with 20 random
keys; in reality, these 20 keys were enought to expand the keyMap
HashMap's internal structure, to a size that wouldn't normally be
auto-expanded during production.  And it was this lack of auto-expanding
that was keeping the map from becoming corrupted in very rare
circumstances.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334252 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 23:36:31 +00:00
Adam Heath 1db44dbbd7 FEATURE: Use a ConcurrentHashMap to store the keys loaded from the
database; as such, there is no longer any synchronization on the keyMap.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334251 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 23:36:25 +00:00
Adam Heath 4e8ed7763d FEATURE: Make EntityCrypto final.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334218 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 21:58:51 +00:00
Adam Heath b7572e89b8 FEATURE: call UtilObject.getObjectException, and rethrow any exceptions,
so that the exception doesn't get logged multiple times.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334217 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 21:58:45 +00:00
Adam Heath 486f43495b FIX: When decrypting a value from the database, throw a useful exception
if the key couldn't be found; previously, an NPE would be thrown.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334215 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 21:58:37 +00:00
Adam Heath 2a05c1a04e OPTIMIZE: Rename secretKey variable to key; this makes it just like the
rest of the code.  The key stored in the database is not only just for
decrypting or encrypting, it's just a key.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334214 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 21:58:30 +00:00
Adam Heath b69f181a54 OPTIMIZE: Move the 2 similiar blocks of key/value decryption code in
decrypt() into a separate internal helper method.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334213 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 21:58:24 +00:00
Adam Heath cc85b5e604 OPTIMIZE/FIX: Split the creation and searching of keys in the database
into two separate methods; a find for an old-style hashed key will no
longer create the old-style key.  This commit does not fix the existing
issue when multiplle threads try to encrypt a value with a key that
hasn't been created or loaded from the database yet; that is still to
come.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334212 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 21:58:17 +00:00
Adam Heath 2774841b66 OPTIMIZE: Use TransactionUtil.doNewTransaction, instead of suspending it
locally; makes the code simpler to follow.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334211 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 21:58:10 +00:00
Adam Heath a0108243f5 FIX/DEPRECATION: Fix all the HashCrypt deprecated uses. All proper methods in HashCrypt
now follow the same form: (String hashType, ..., String valueToHash).
Some methods also follow a polish notation suffix.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334172 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 20:42:45 +00:00
Adam Heath ad92b98bd9 FIX: Handle the case of a field being encrypted that is currently null;
this is really just moving the null check into the local toString().

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1334171 13f79535-47bb-0310-9956-ffa450edef68
2012-05-04 20:42:34 +00:00
Adam Heath 4f966b5ef2 OPTIMIZE: s/encHex/encValue/, this is a more accurate variable name.
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333623 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 21:13:33 +00:00
Adam Heath d192773e13 OPTIMIZE: Remove andCacheFieldSets from GenericDelegator; this variable
hasn't been used in like forever, man.

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1333620 13f79535-47bb-0310-9956-ffa450edef68
2012-05-03 21:13:14 +00:00