From bf7ff532f4de8376c296bf301d85ea2ae01e534a Mon Sep 17 00:00:00 2001 From: Adam Heath Date: Thu, 26 Nov 2009 00:40:44 +0000 Subject: [PATCH] Shark compiles now. Except that you have to add the libraries uploaded to https://issues.apache.org/jira/browse/OFBIZ-552. Which you probably can't, as latest shark(2.0 or 2.5, couldn't really tell) is LGPL. So we should probably remove this anyways. git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@884347 13f79535-47bb-0310-9956-ffa450edef68 --- .gitignore | 1 + .../src/org/ofbiz/shark/audit/AuditEntityObject.java | 3 ++- .../src/org/ofbiz/shark/audit/EntityAuditMgr.java | 1 + .../org/ofbiz/shark/auth/GenericAuthenticationMgr.java | 5 +++-- .../org/ofbiz/shark/auth/OfbizAuthenticationMgr.java | 7 ++++--- .../src/org/ofbiz/shark/container/SharkContainer.java | 10 ++++------ .../shark/expression/ActivityIteratorCondExprBldr.java | 1 + .../expression/ProcessMgrIteratorCondExprBldr.java | 1 + .../org/ofbiz/shark/instance/EntityPersistentMgr.java | 10 +++++----- .../org/ofbiz/shark/instance/InstanceEntityObject.java | 8 ++------ .../shark/mapping/EntityParticipantMappingMgr.java | 1 + .../ofbiz/shark/repository/EntityRepositoryMgr.java | 2 +- .../org/ofbiz/shark/requester/AbstractRequester.java | 6 +----- 13 files changed, 27 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index b41d127dab..a4ae467035 100644 --- a/.gitignore +++ b/.gitignore @@ -44,6 +44,7 @@ specialpurpose/oagis/build/ specialpurpose/pos/build/ specialpurpose/projectmgr/build/ specialpurpose/webpos/build/ +specialpurpose/shark/build/ ofbiz.jar changelog runtime/svninfo.ftl diff --git a/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java b/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java index 779c9b6fe6..a82613f675 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/audit/AuditEntityObject.java @@ -19,6 +19,7 @@ package org.ofbiz.shark.audit; import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; @@ -40,7 +41,7 @@ public abstract class AuditEntityObject { public Delegator getDelegator() { if (this.delegator == null && delegatorName != null) { - this.delegator = Delegator.getDelegator(delegatorName); + this.delegator = DelegatorFactory.getDelegator(delegatorName); } return this.delegator; } diff --git a/specialpurpose/shark/src/org/ofbiz/shark/audit/EntityAuditMgr.java b/specialpurpose/shark/src/org/ofbiz/shark/audit/EntityAuditMgr.java index 8d1e68bf5f..f935c8e064 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/audit/EntityAuditMgr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/audit/EntityAuditMgr.java @@ -24,6 +24,7 @@ import java.util.List; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; diff --git a/specialpurpose/shark/src/org/ofbiz/shark/auth/GenericAuthenticationMgr.java b/specialpurpose/shark/src/org/ofbiz/shark/auth/GenericAuthenticationMgr.java index 7f39d846ce..5b0eb5b024 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/auth/GenericAuthenticationMgr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/auth/GenericAuthenticationMgr.java @@ -22,6 +22,7 @@ import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.shark.container.SharkContainer; +import org.ofbiz.base.crypto.HashCrypt; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.common.login.LoginServices; @@ -54,9 +55,9 @@ public class GenericAuthenticationMgr implements AuthenticationManager { String registeredPwd = sharkUser.getString(org.ofbiz.shark.SharkConstants.passwd); if (password.equals(registeredPwd)) { return true; - } else if (LoginServices.getPasswordHash(password).equals(registeredPwd)) { + } else if (HashCrypt.getDigestHash(password, LoginServices.getHashType()).equals(registeredPwd)) { return true; - } else if (LoginServices.getPasswordHash(registeredPwd).equals(password)) { + } else if (HashCrypt.getDigestHash(registeredPwd, LoginServices.getHashType()).equals(password)) { return true; } else { return false; diff --git a/specialpurpose/shark/src/org/ofbiz/shark/auth/OfbizAuthenticationMgr.java b/specialpurpose/shark/src/org/ofbiz/shark/auth/OfbizAuthenticationMgr.java index 61c026ab7a..d8abcf1a8a 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/auth/OfbizAuthenticationMgr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/auth/OfbizAuthenticationMgr.java @@ -25,6 +25,7 @@ import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.entity.util.EntityCrypto; import org.ofbiz.shark.container.SharkContainer; +import org.ofbiz.base.crypto.HashCrypt; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.common.login.LoginServices; import org.ofbiz.service.LocalDispatcher; @@ -52,7 +53,7 @@ public class OfbizAuthenticationMgr implements AuthenticationManager { Delegator delegator = SharkContainer.getDelegator(); String p = null; GenericValue adminUser = null; - String pass_hash = LoginServices.getPasswordHash(password); + String pass_hash = HashCrypt.getDigestHash(password, LoginServices.getHashType()); try { adminUser = delegator.findByPrimaryKey("UserLogin", UtilMisc.toMap("userLoginId", userName)); String a = adminUser.getString("userLoginId"); @@ -61,9 +62,9 @@ public class OfbizAuthenticationMgr implements AuthenticationManager { if (adminUser != null) { if (password.equals(p)) { return true; - } else if (LoginServices.getPasswordHash(password).equals(p)) { + } else if (HashCrypt.getDigestHash(password, LoginServices.getHashType()).equals(p)) { return true; - } else if (LoginServices.getPasswordHash(p).equals(password)) { + } else if (HashCrypt.getDigestHash(p, LoginServices.getHashType()).equals(password)) { return true; } else { return false; diff --git a/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java b/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java index ed7cd529ef..d26f745291 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/container/SharkContainer.java @@ -40,7 +40,9 @@ import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralRuntimeException; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; +import org.ofbiz.entity.DelegatorFactory; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; import org.ofbiz.service.GenericDispatcher; @@ -107,12 +109,8 @@ public class SharkContainer implements Container, Runnable } // get the delegator and dispatcher objects - SharkContainer.delegator = Delegator.getDelegator(delegatorProp.value); - try { - SharkContainer.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherProp.value, SharkContainer.delegator); - } catch (GenericServiceException e) { - throw new ContainerException(e); - } + SharkContainer.delegator = DelegatorFactory.getDelegator(delegatorProp.value); + SharkContainer.dispatcher = GenericDispatcher.getLocalDispatcher(dispatcherProp.value, SharkContainer.delegator); // get the admin user try { diff --git a/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java b/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java index 7cc5e37ba7..dceeb22689 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/expression/ActivityIteratorCondExprBldr.java @@ -24,6 +24,7 @@ import org.enhydra.shark.api.RootException; import org.enhydra.shark.api.common.ActivityIteratorExpressionBuilder; import org.ofbiz.base.util.Debug; import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityOperator; import org.ofbiz.entity.model.ModelKeyMap; public class ActivityIteratorCondExprBldr extends BaseEntityCondExprBldr implements ActivityIteratorExpressionBuilder { diff --git a/specialpurpose/shark/src/org/ofbiz/shark/expression/ProcessMgrIteratorCondExprBldr.java b/specialpurpose/shark/src/org/ofbiz/shark/expression/ProcessMgrIteratorCondExprBldr.java index 80d5bffbc8..33cc9bbfc9 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/expression/ProcessMgrIteratorCondExprBldr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/expression/ProcessMgrIteratorCondExprBldr.java @@ -20,6 +20,7 @@ package org.ofbiz.shark.expression; import org.enhydra.shark.api.common.ProcessMgrIteratorExpressionBuilder; import org.ofbiz.base.util.Debug; +import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.condition.EntityExpr; import org.ofbiz.entity.condition.EntityOperator; diff --git a/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java b/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java index d2df4fc685..4a03f52b04 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/instance/EntityPersistentMgr.java @@ -478,8 +478,8 @@ public class EntityPersistentMgr implements PersistentManagerInterface { List createdList = new ArrayList(); List lookupList = null; try { - lookupList = delegator.findByCondition(org.ofbiz.shark.SharkConstants.WfProcess, - makeStateListCondition(org.ofbiz.shark.SharkConstants.currentState, runningStates, EntityOperator.EQUALS, EntityOperator.OR), null, order); + lookupList = delegator.findList(org.ofbiz.shark.SharkConstants.WfProcess, + makeStateListCondition(org.ofbiz.shark.SharkConstants.currentState, runningStates, EntityOperator.EQUALS, EntityOperator.OR), null, order, null, false); } catch (GenericEntityException e) { throw new PersistenceException(e); } @@ -504,7 +504,7 @@ public class EntityPersistentMgr implements PersistentManagerInterface { try { EntityCondition stateCond = this.makeStateListCondition(org.ofbiz.shark.SharkConstants.currentState, finsihedStates, EntityOperator.EQUALS, EntityOperator.OR); EntityCondition cond = this.makeProcessFilterCondition(stateCond, packageId, processDefId, packageVer, finishedBefore); - lookupList = delegator.findByCondition(org.ofbiz.shark.SharkConstants.WfProcess, cond, null, order); + lookupList = delegator.findList(org.ofbiz.shark.SharkConstants.WfProcess, cond, null, order, null, false); } catch (GenericEntityException e) { throw new PersistenceException(e); } @@ -846,7 +846,7 @@ public class EntityPersistentMgr implements PersistentManagerInterface { Delegator delegator = SharkContainer.getDelegator(); long count = 0; try { - count = delegator.findCountByAnd(org.ofbiz.shark.SharkConstants.WfActivity, UtilMisc.toMap(org.ofbiz.shark.SharkConstants.processId, procId, org.ofbiz.shark.SharkConstants.setDefinitionId, asDefId, org.ofbiz.shark.SharkConstants.definitionId, aDefId)); + count = delegator.findCountByCondition(org.ofbiz.shark.SharkConstants.WfActivity, EntityCondition.makeCondition(UtilMisc.toMap(org.ofbiz.shark.SharkConstants.processId, procId, org.ofbiz.shark.SharkConstants.setDefinitionId, asDefId, org.ofbiz.shark.SharkConstants.definitionId, aDefId)), null, null); } catch (GenericEntityException e) { throw new PersistenceException(e); } @@ -1146,7 +1146,7 @@ public class EntityPersistentMgr implements PersistentManagerInterface { } else { cond = proc; } - lookupList = delegator.findByCondition(org.ofbiz.shark.SharkConstants.WfActivity, cond, null, order); + lookupList = delegator.findList(org.ofbiz.shark.SharkConstants.WfActivity, cond, null, order, null, false); } catch (GenericEntityException e) { throw new PersistenceException(e); } diff --git a/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java b/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java index 9e0d0eb534..3e717e0f57 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/instance/InstanceEntityObject.java @@ -31,7 +31,7 @@ public abstract class InstanceEntityObject { protected EntityPersistentMgr mgr = null; protected String delegatorName = null; - public InstanceEntityObject(EntityPersistentMgr mgr, GenericDelegator delegator) { + public InstanceEntityObject(EntityPersistentMgr mgr, Delegator delegator) { this.delegatorName = delegator.getDelegatorName(); this.delegator = delegator; this.mgr = mgr; @@ -43,11 +43,7 @@ public abstract class InstanceEntityObject { public Delegator getGenericDelegator() { if (this.delegator == null && delegatorName != null) { - try { - this.delegator = DelegatorFactory.getDelegator(this.delegatorName); - } catch (ClassNotFoundException e) { - Debug.logError(e, module); - } + this.delegator = DelegatorFactory.getDelegator(this.delegatorName); } return this.delegator; } diff --git a/specialpurpose/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java b/specialpurpose/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java index 3c30ca8bbc..e45e075038 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/mapping/EntityParticipantMappingMgr.java @@ -28,6 +28,7 @@ import org.ofbiz.entity.GenericValue; import org.ofbiz.shark.container.SharkContainer; import org.ofbiz.shark.transaction.JtaTransaction; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; import org.enhydra.shark.api.internal.working.CallbackUtilities; import org.enhydra.shark.api.internal.partmappersistence.ParticipantMap; diff --git a/specialpurpose/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java b/specialpurpose/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java index 9f6e79daf1..42208e663f 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/repository/EntityRepositoryMgr.java @@ -308,7 +308,7 @@ public class EntityRepositoryMgr implements RepositoryPersistenceManager { EntityCondition cond = EntityCondition.makeCondition(exprList, EntityOperator.AND); List lookupList = null; try { - lookupList = delegator.findByCondition(org.ofbiz.shark.SharkConstants.WfRepository, cond, null, UtilMisc.toList("-xpdlVersion")); + lookupList = delegator.findList(org.ofbiz.shark.SharkConstants.WfRepository, cond, null, UtilMisc.toList("-xpdlVersion"), null, false); } catch (GenericEntityException e) { throw new RepositoryException(e); } finally { diff --git a/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java b/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java index f1fd7c025f..c0c001d043 100644 --- a/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java +++ b/specialpurpose/shark/src/org/ofbiz/shark/requester/AbstractRequester.java @@ -149,11 +149,7 @@ public abstract class AbstractRequester implements WfRequester, Serializable { protected synchronized Delegator getDelegator() { if (this.delegator == null && this.delegatorName != null) { - try { - this.delegator = DelegatorFactory.getDelegator(this.delegatorName); - } catch (ClassNotFoundException e) { - Debug.logError(e, module); - } + this.delegator = DelegatorFactory.getDelegator(this.delegatorName); } return this.delegator; }