|
Author: adrianc
Date: Sun Apr 14 08:16:46 2013 New Revision: 1467744 URL: http://svn.apache.org/r1467744 Log: Removed most of Javolution from the entity engine. There are some Javolution classes I am not familiar with, so I will replace those after I do some research. Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBuilder.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperInfo.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/JdbcValueHandler.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/SqlJdbcUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelEntityChecker.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelFieldTypeReader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelGroupReader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelReader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelRelation.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/model/ModelViewEntity.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityConditionPlanner.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntityPlanner.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/JNDIFactory.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/Converters.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityListIterator.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntitySaxReader.java ofbiz/trunk/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericDelegator.java Sun Apr 14 08:16:46 2013 @@ -23,7 +23,9 @@ import java.io.IOException; import java.net.URL; import java.sql.Timestamp; import java.util.Collection; +import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -34,9 +36,6 @@ import java.util.concurrent.atomic.Atomi import javax.xml.parsers.ParserConfigurationException; -import javolution.util.FastList; -import javolution.util.FastMap; - import org.ofbiz.base.concurrent.ExecutionPool; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralRuntimeException; @@ -131,7 +130,7 @@ public class GenericDelegator implements protected static List<String> getUserIdentifierStack() { List<String> curValList = userIdentifierStack.get(); if (curValList == null) { - curValList = FastList.newInstance(); + curValList = new LinkedList<String>(); userIdentifierStack.set(curValList); } return curValList; @@ -167,7 +166,7 @@ public class GenericDelegator implements protected static List<String> getSessionIdentifierStack() { List<String> curValList = sessionIdentifierStack.get(); if (curValList == null) { - curValList = FastList.newInstance(); + curValList = new LinkedList<String>(); sessionIdentifierStack.set(curValList); } return curValList; @@ -235,7 +234,7 @@ public class GenericDelegator implements cache = new Cache(delegatorFullName); // do the entity model check - List<String> warningList = FastList.newInstance(); + List<String> warningList = new LinkedList<String>(); Debug.logImportant("Doing entity definition check...", module); ModelEntityChecker.checkEntities(this, warningList); if (warningList.size() > 0) { @@ -247,7 +246,7 @@ public class GenericDelegator implements // initialize helpers by group Set<String> groupNames = getModelGroupReader().getGroupNames(delegatorBaseName); - List<Future<Void>> futures = FastList.newInstance(); + List<Future<Void>> futures = new LinkedList<Future<Void>>(); for (String groupName: groupNames) { futures.add(ExecutionPool.GLOBAL_EXECUTOR.submit(createHelperCallable(groupName))); } @@ -421,7 +420,7 @@ public class GenericDelegator implements } } - Map<String, ModelEntity> entities = FastMap.newInstance(); + Map<String, ModelEntity> entities = new HashMap<String, ModelEntity>(); if (UtilValidate.isEmpty(entityNameSet)) { return entities; } @@ -1216,7 +1215,7 @@ public class GenericDelegator implements throw new GenericModelException("Could not find relation for relationName: " + relationName + " for value " + value); } - Map<String, Object> fields = FastMap.newInstance(); + Map<String, Object> fields = new HashMap<String, Object>(); for (int i = 0; i < relation.getKeyMapsSize(); i++) { ModelKeyMap keyMap = relation.getKeyMap(i); fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName())); @@ -1960,7 +1959,7 @@ public class GenericDelegator implements // put the byAndFields (if not null) into the hash map first, // they will be overridden by value's fields if over-specified this is important for security and cleanliness - Map<String, Object> fields = FastMap.newInstance(); + Map<String, Object> fields = new HashMap<String, Object>(); if (byAndFields != null) { fields.putAll(byAndFields); } @@ -1986,7 +1985,7 @@ public class GenericDelegator implements // put the byAndFields (if not null) into the hash map first, // they will be overridden by value's fields if over-specified this is important for security and cleanliness - Map<String, Object> fields = FastMap.newInstance(); + Map<String, Object> fields = new HashMap<String, Object>(); if (byAndFields != null) { fields.putAll(byAndFields); } @@ -2038,7 +2037,7 @@ public class GenericDelegator implements throw new GenericModelException("Relation is not a 'one' or a 'one-nofk' relation: " + relationName + " of entity " + value.getEntityName()); } - Map<String, Object> fields = FastMap.newInstance(); + Map<String, Object> fields = new HashMap<String, Object>(); for (int i = 0; i < relation.getKeyMapsSize(); i++) { ModelKeyMap keyMap = relation.getKeyMap(i); fields.put(keyMap.getRelFieldName(), value.get(keyMap.getFieldName())); @@ -2308,7 +2307,7 @@ public class GenericDelegator implements if (document == null) { return null; } - List<GenericValue> values = FastList.newInstance(); + List<GenericValue> values = new LinkedList<GenericValue>(); Element docElement = document.getDocumentElement(); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericEntity.java Sun Apr 14 08:16:46 2013 @@ -26,7 +26,9 @@ import java.sql.Blob; import java.sql.SQLException; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; @@ -35,10 +37,6 @@ import java.util.Observable; import java.util.ResourceBundle; import java.util.TreeSet; -import javolution.lang.Reusable; -import javolution.util.FastList; -import javolution.util.FastMap; - import org.ofbiz.base.crypto.HashCrypt; import org.ofbiz.base.util.Base64; import org.ofbiz.base.util.Debug; @@ -69,7 +67,7 @@ import org.w3c.dom.Element; * */ @SuppressWarnings("serial") -public class GenericEntity extends Observable implements Map<String, Object>, LocalizedMap<Object>, Serializable, Comparable<GenericEntity>, Cloneable, Reusable { +public class GenericEntity extends Observable implements Map<String, Object>, LocalizedMap<Object>, Serializable, Comparable<GenericEntity>, Cloneable { public static final String module = GenericEntity.class.getName(); public static final GenericEntity NULL_ENTITY = new NullGenericEntity(); @@ -88,7 +86,7 @@ public class GenericEntity extends Obser * between desiring to set a value to null and desiring to not modify the * current value on an update. */ - protected Map<String, Object> fields = FastMap.newInstance(); + protected Map<String, Object> fields = new HashMap<String, Object>(); /** Contains the entityName of this entity, necessary for efficiency when creating EJBs */ protected String entityName = null; @@ -212,7 +210,7 @@ public class GenericEntity extends Obser // from GenericEntity this.delegatorName = null; this.internalDelegator = null; - this.fields = FastMap.newInstance(); + this.fields = new HashMap<String, Object>(); this.entityName = null; this.modelEntity = null; this.modified = false; @@ -809,7 +807,7 @@ public class GenericEntity extends Obser if (modelEntity instanceof ModelViewEntity){ // retrieve pkNames of realEntity ModelViewEntity modelViewEntity = (ModelViewEntity) modelEntity; - List<String> pkNamesToUse = FastList.newInstance(); + List<String> pkNamesToUse = new LinkedList<String>(); // iterate on realEntity for pkField Iterator<ModelField> iter = modelEntityToUse.getPksIterator(); while (iter != null && iter.hasNext()) { @@ -858,7 +856,7 @@ public class GenericEntity extends Obser } public GenericPK getPrimaryKey() { - Collection<String> pkNames = FastList.newInstance(); + Collection<String> pkNames = new LinkedList<String>(); Iterator<ModelField> iter = this.getModelEntity().getPksIterator(); while (iter != null && iter.hasNext()) { ModelField curField = iter.next(); @@ -960,7 +958,7 @@ public class GenericEntity extends Obser * @return java.util.Map */ public Map<String, Object> getAllFields() { - Map<String, Object> newMap = FastMap.newInstance(); + Map<String, Object> newMap = new HashMap<String, Object>(); newMap.putAll(this.fields); return newMap; } @@ -971,7 +969,7 @@ public class GenericEntity extends Obser */ public Map<String, Object> getFields(Collection<String> keysofFields) { if (keysofFields == null) return null; - Map<String, Object> aMap = FastMap.newInstance(); + Map<String, Object> aMap = new HashMap<String, Object>(); for (String aKey: keysofFields) { aMap.put(aKey, this.fields.get(aKey)); @@ -1096,7 +1094,7 @@ public class GenericEntity extends Obser writer.print(this.getEntityName()); // write attributes immediately and if a CDATA element is needed, put those in a Map for now - Map<String, String> cdataMap = FastMap.newInstance(); + Map<String, String> cdataMap = new HashMap<String, String>(); Iterator<ModelField> modelFields = this.getModelEntity().getFieldsIterator(); while (modelFields.hasNext()) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValue.java Sun Apr 14 08:16:46 2013 @@ -20,13 +20,11 @@ package org.ofbiz.entity; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; -import javolution.context.ObjectFactory; -import javolution.util.FastMap; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; @@ -47,13 +45,6 @@ public class GenericValue extends Generi public static final GenericValue NULL_VALUE = new NullGenericValue(); - protected static final ObjectFactory<GenericValue> genericValueFactory = new ObjectFactory<GenericValue>() { - @Override - protected GenericValue create() { - return new GenericValue(); - } - }; - /** Map to cache various related entity collections */ public transient Map<String, List<GenericValue>> relatedCache = null; @@ -66,39 +57,37 @@ public class GenericValue extends Generi */ protected Map<String, Object> originalDbValues = null; - protected GenericValue() { } - /** Creates new GenericValue */ public static GenericValue create(ModelEntity modelEntity) { - GenericValue newValue = genericValueFactory.object(); + GenericValue newValue = new GenericValue(); newValue.init(modelEntity); return newValue; } /** Creates new GenericValue from existing Map */ public static GenericValue create(Delegator delegator, ModelEntity modelEntity, Map<String, ? extends Object> fields) { - GenericValue newValue = genericValueFactory.object(); + GenericValue newValue = new GenericValue(); newValue.init(delegator, modelEntity, fields); return newValue; } /** Creates new GenericValue from existing Map */ public static GenericValue create(Delegator delegator, ModelEntity modelEntity, Object singlePkValue) { - GenericValue newValue = genericValueFactory.object(); + GenericValue newValue = new GenericValue(); newValue.init(delegator, modelEntity, singlePkValue); return newValue; } /** Creates new GenericValue from existing GenericValue */ public static GenericValue create(GenericValue value) { - GenericValue newValue = genericValueFactory.object(); + GenericValue newValue = new GenericValue(); newValue.init(value); return newValue; } /** Creates new GenericValue from existing GenericValue */ public static GenericValue create(GenericPK primaryKey) { - GenericValue newValue = genericValueFactory.object(); + GenericValue newValue = new GenericValue(); newValue.init(primaryKey); return newValue; } @@ -157,7 +146,7 @@ public class GenericValue extends Generi * values from the Db. */ public void copyOriginalDbValues() { - this.originalDbValues = FastMap.newInstance(); + this.originalDbValues = new HashMap<String, Object>(); this.originalDbValues.putAll(this.fields); } @@ -180,7 +169,7 @@ public class GenericValue extends Generi */ @Deprecated public List<GenericValue> getRelated(String relationName, List<String> orderBy) throws GenericEntityException { - return this.getDelegator().getRelated(relationName, FastMap.<String, Object>newInstance(), orderBy, this, false); + return this.getDelegator().getRelated(relationName, new HashMap<String, Object>(), orderBy, this, false); } /** Get the named Related Entity for the GenericValue from the persistent store @@ -281,7 +270,7 @@ public class GenericValue extends Generi *@return List of GenericValue instances as specified in the relation definition */ public List<GenericValue> getRelatedEmbeddedCache(String relationName) throws GenericEntityException { - if (relatedCache == null) relatedCache = FastMap.newInstance(); + if (relatedCache == null) relatedCache = new HashMap<String, List<GenericValue>>(); List<GenericValue> col = relatedCache.get(relationName); if (col == null) { @@ -314,12 +303,12 @@ public class GenericValue extends Generi } public void storeRelatedEmbeddedCache(String relationName, List<GenericValue> col) { - if (relatedCache == null) relatedCache = FastMap.newInstance(); + if (relatedCache == null) relatedCache = new HashMap<String, List<GenericValue>>(); relatedCache.put(relationName, col); } public void storeRelatedEmbeddedCache(String relationName, GenericValue value) { - if (relatedCache == null) relatedCache = FastMap.newInstance(); + if (relatedCache == null) relatedCache = new HashMap<String, List<GenericValue>>(); relatedCache.put(relationName, UtilMisc.toList(value)); } @@ -364,7 +353,7 @@ public class GenericValue extends Generi *@return List of GenericValue instances as specified in the relation definition */ public GenericValue getRelatedOneEmbeddedCache(String relationName) throws GenericEntityException { - if (relatedOneCache == null) relatedOneCache = FastMap.newInstance(); + if (relatedOneCache == null) relatedOneCache = new HashMap<String, GenericValue>(); GenericValue value = relatedOneCache.get(relationName); if (value == null) { @@ -485,7 +474,7 @@ public class GenericValue extends Generi ModelRelation relation = relItr.next(); if ("one".equalsIgnoreCase(relation.getType())) { // see if the related value exists - Map<String, Object> fields = FastMap.newInstance(); + Map<String, Object> fields = new HashMap<String, Object>(); for (int i = 0; i < relation.getKeyMapsSize(); i++) { ModelKeyMap keyMap = relation.getKeyMap(i); fields.put(keyMap.getRelFieldName(), this.get(keyMap.getFieldName())); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/GenericValueHtmlWrapper.java Sun Apr 14 08:16:46 2013 @@ -20,8 +20,6 @@ package org.ofbiz.entity; -import javolution.context.ObjectFactory; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.StringUtil; @@ -39,16 +37,10 @@ import freemarker.template.TemplateModel */ @SuppressWarnings("serial") public class GenericValueHtmlWrapper extends GenericValue { - protected static final ObjectFactory<GenericValueHtmlWrapper> genericValueHtmlWrapperFactory = new ObjectFactory<GenericValueHtmlWrapper>() { - @Override - protected GenericValueHtmlWrapper create() { - return new GenericValueHtmlWrapper(); - } - }; /** Creates new GenericValueHtmlWrapper from existing GenericValue */ public static GenericValueHtmlWrapper create(GenericValue value) { - GenericValueHtmlWrapper newValue = genericValueHtmlWrapperFactory.object(); + GenericValueHtmlWrapper newValue = new GenericValueHtmlWrapper(); try { newValue.init(value); } catch (RuntimeException e) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityCondition.java Sun Apr 14 08:16:46 2013 @@ -48,91 +48,91 @@ import org.ofbiz.entity.model.ModelEntit public abstract class EntityCondition extends EntityConditionBase implements IsEmpty, Reusable { public static <L,R,LL,RR> EntityExpr makeCondition(L lhs, EntityComparisonOperator<LL,RR> operator, R rhs) { - EntityExpr expr = EntityExpr.entityExprFactory.object(); + EntityExpr expr = new EntityExpr(); expr.init(lhs, operator, rhs); return expr; } public static <R> EntityExpr makeCondition(String fieldName, R value) { - EntityExpr expr = EntityExpr.entityExprFactory.object(); + EntityExpr expr = new EntityExpr(); expr.init(fieldName, EntityOperator.EQUALS, value); return expr; } public static EntityExpr makeCondition(EntityCondition lhs, EntityJoinOperator operator, EntityCondition rhs) { - EntityExpr expr = EntityExpr.entityExprFactory.object(); + EntityExpr expr = new EntityExpr(); expr.init(lhs, operator, rhs); return expr; } public static <T extends EntityCondition> EntityConditionList<T> makeCondition(EntityJoinOperator operator, T... conditionList) { - EntityConditionList<T> ecl = cast(EntityConditionList.entityConditionListFactory.object()); + EntityConditionList<T> ecl = cast(new EntityConditionList<T>()); ecl.init(operator, conditionList); return ecl; } public static <T extends EntityCondition> EntityConditionList<T> makeCondition(T... conditionList) { - EntityConditionList<T> ecl = cast(EntityConditionList.entityConditionListFactory.object()); + EntityConditionList<T> ecl = cast(new EntityConditionList<T>()); ecl.init(EntityOperator.AND, conditionList); return ecl; } public static <T extends EntityCondition> EntityConditionList<T> makeCondition(List<T> conditionList, EntityJoinOperator operator) { - EntityConditionList<T> ecl = cast(EntityConditionList.entityConditionListFactory.object()); + EntityConditionList<T> ecl = cast(new EntityConditionList<T>()); ecl.init(conditionList, operator); return ecl; } public static <T extends EntityCondition> EntityConditionList<T> makeCondition(List<T> conditionList) { - EntityConditionList<T> ecl = cast(EntityConditionList.entityConditionListFactory.object()); + EntityConditionList<T> ecl = cast(new EntityConditionList<T>()); ecl.init(conditionList, EntityOperator.AND); return ecl; } public static <L,R> EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap, EntityComparisonOperator<L,R> compOp, EntityJoinOperator joinOp) { - EntityFieldMap efm = EntityFieldMap.entityFieldMapFactory.object(); + EntityFieldMap efm = new EntityFieldMap(); efm.init(fieldMap, compOp, joinOp); return efm; } public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap, EntityJoinOperator joinOp) { - EntityFieldMap efm = EntityFieldMap.entityFieldMapFactory.object(); + EntityFieldMap efm = new EntityFieldMap(); efm.init(fieldMap, EntityOperator.EQUALS, joinOp); return efm; } public static EntityFieldMap makeCondition(Map<String, ? extends Object> fieldMap) { - EntityFieldMap efm = EntityFieldMap.entityFieldMapFactory.object(); + EntityFieldMap efm = new EntityFieldMap(); efm.init(fieldMap, EntityOperator.EQUALS, EntityOperator.AND); return efm; } public static <L,R> EntityFieldMap makeCondition(EntityComparisonOperator<L,R> compOp, EntityJoinOperator joinOp, Object... keysValues) { - EntityFieldMap efm = EntityFieldMap.entityFieldMapFactory.object(); + EntityFieldMap efm = new EntityFieldMap(); efm.init(compOp, joinOp, keysValues); return efm; } public static EntityFieldMap makeCondition(EntityJoinOperator joinOp, Object... keysValues) { - EntityFieldMap efm = EntityFieldMap.entityFieldMapFactory.object(); + EntityFieldMap efm = new EntityFieldMap(); efm.init(EntityOperator.EQUALS, joinOp, keysValues); return efm; } public static EntityFieldMap makeConditionMap(Object... keysValues) { - EntityFieldMap efm = EntityFieldMap.entityFieldMapFactory.object(); + EntityFieldMap efm = new EntityFieldMap(); efm.init(EntityOperator.EQUALS, EntityOperator.AND, keysValues); return efm; } public static EntityDateFilterCondition makeConditionDate(String fromDateName, String thruDateName) { - EntityDateFilterCondition edfc = EntityDateFilterCondition.entityDateFilterConditionFactory.object(); + EntityDateFilterCondition edfc = new EntityDateFilterCondition(); edfc.init(fromDateName, thruDateName); return edfc; } public static EntityWhereString makeConditionWhere(String sqlString) { - EntityWhereString ews = EntityWhereString.entityWhereStringFactory.object(); + EntityWhereString ews = new EntityWhereString(); ews.init(sqlString); return ews; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBase.java Sun Apr 14 08:16:46 2013 @@ -19,13 +19,12 @@ package org.ofbiz.entity.condition; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; -import javolution.util.FastList; -import javolution.util.FastMap; - import org.ofbiz.entity.config.DatasourceInfo; import org.ofbiz.entity.jdbc.SqlJdbcUtil; import org.ofbiz.entity.model.ModelEntity; @@ -44,12 +43,12 @@ import org.ofbiz.entity.model.ModelViewE * These can be used in various combinations using the EntityConditionList and EntityExpr objects. * */ -@SuppressWarnings("serial") +@SuppressWarnings({ "serial", "unchecked" }) public abstract class EntityConditionBase implements Serializable { - public static final List<?> emptyList = Collections.unmodifiableList(FastList.newInstance()); - public static final Map<?,?> _emptyMap = Collections.unmodifiableMap(FastMap.newInstance()); - public static final Map<String, String> emptyAliases = Collections.unmodifiableMap(FastMap.<String, String>newInstance()); + public static final List<?> emptyList = Collections.unmodifiableList(new ArrayList(0)); + public static final Map<?,?> _emptyMap = Collections.unmodifiableMap(new HashMap()); + public static final Map<String, String> emptyAliases = Collections.unmodifiableMap(new HashMap<String, String>()); protected ModelField getField(ModelEntity modelEntity, String fieldName) { ModelField modelField = null; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBuilder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBuilder.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBuilder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionBuilder.java Sun Apr 14 08:16:46 2013 @@ -19,23 +19,22 @@ package org.ofbiz.entity.condition; +import groovy.util.BuilderSupport; + import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import org.ofbiz.base.util.UtilGenerics; -import javolution.util.FastList; - -import groovy.util.BuilderSupport; - public class EntityConditionBuilder extends BuilderSupport { @Override protected Object createNode(Object methodName) { String operatorName = ((String)methodName).toLowerCase(); EntityJoinOperator operator = EntityOperator.lookupJoin(operatorName); - List<EntityCondition> condList = FastList.newInstance(); + List<EntityCondition> condList = new LinkedList<EntityCondition>(); return EntityCondition.makeCondition(condList, operator); } @@ -52,7 +51,7 @@ public class EntityConditionBuilder exte Map<String, Object> fieldValueMap = UtilGenerics.checkMap(mapArg); String operatorName = ((String)methodName).toLowerCase(); EntityComparisonOperator<String, Object> operator = EntityOperator.lookupComparison(operatorName); - List<EntityCondition> conditionList = FastList.newInstance(); + List<EntityCondition> conditionList = new LinkedList<EntityCondition>(); for (Map.Entry<String, Object> entry : fieldValueMap.entrySet()) { conditionList.add(EntityCondition.makeCondition(entry.getKey(), operator, entry.getValue())); } @@ -74,7 +73,7 @@ public class EntityConditionBuilder exte // No add method on EntityConditionList? EntityConditionList<EntityCondition> parentConList = UtilGenerics.cast(parent); Iterator<EntityCondition> iterator = parentConList.getConditionIterator(); - List<EntityCondition> tempList = FastList.newInstance(); + List<EntityCondition> tempList = new LinkedList<EntityCondition>(); while (iterator.hasNext()) { tempList.add(iterator.next()); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityConditionList.java Sun Apr 14 08:16:46 2013 @@ -20,26 +20,12 @@ package org.ofbiz.entity.condition; import java.util.Iterator; -import javolution.context.ObjectFactory; - /** * Encapsulates a list of EntityConditions to be used as a single EntityCondition combined as specified * */ @SuppressWarnings("serial") public class EntityConditionList<T extends EntityCondition> extends EntityConditionListBase<T> { - public static final String module = EntityConditionList.class.getName(); - - protected static final ObjectFactory<EntityConditionList<EntityCondition>> entityConditionListFactory = new ObjectFactory<EntityConditionList<EntityCondition>>() { - @Override - protected EntityConditionList<EntityCondition> create() { - return new EntityConditionList<EntityCondition>(); - } - }; - - protected EntityConditionList() { - super(); - } @Override public int getConditionListSize() { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityDateFilterCondition.java Sun Apr 14 08:16:46 2013 @@ -19,12 +19,10 @@ package org.ofbiz.entity.condition; import java.sql.Timestamp; +import java.util.LinkedList; import java.util.List; import java.util.Map; -import javolution.context.ObjectFactory; -import javolution.util.FastList; - import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericModelException; @@ -38,18 +36,9 @@ import org.ofbiz.entity.model.ModelEntit @SuppressWarnings("serial") public class EntityDateFilterCondition extends EntityCondition { - protected static final ObjectFactory<EntityDateFilterCondition> entityDateFilterConditionFactory = new ObjectFactory<EntityDateFilterCondition>() { - @Override - protected EntityDateFilterCondition create() { - return new EntityDateFilterCondition(); - } - }; - protected String fromDateName = null; protected String thruDateName = null; - protected EntityDateFilterCondition() {} - public void init(String fromDateName, String thruDateName) { this.fromDateName = fromDateName; this.thruDateName = thruDateName; @@ -152,7 +141,7 @@ public class EntityDateFilterCondition e * @return EntityCondition representing the date range filter */ public static EntityCondition makeRangeCondition(Timestamp rangeStart, Timestamp rangeEnd, String fromDateName, String thruDateName) { - List<EntityCondition> criteria = FastList.newInstance(); + List<EntityCondition> criteria = new LinkedList<EntityCondition>(); // fromDate is equal to or after rangeStart but before rangeEnd criteria.add( EntityCondition.makeCondition( Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityExpr.java Sun Apr 14 08:16:46 2013 @@ -22,8 +22,6 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import javolution.context.ObjectFactory; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.UtilGenerics; @@ -46,19 +44,10 @@ import org.ofbiz.entity.model.ModelField public class EntityExpr extends EntityCondition { public static final String module = EntityExpr.class.getName(); - protected static final ObjectFactory<EntityExpr> entityExprFactory = new ObjectFactory<EntityExpr>() { - @Override - protected EntityExpr create() { - return new EntityExpr(); - } - }; - private Object lhs = null; private EntityOperator<Object, Object, ?> operator = null; private Object rhs = null; - protected EntityExpr() {} - public <L,R,LL,RR> void init(L lhs, EntityComparisonOperator<LL,RR> operator, R rhs) { if (lhs == null) { throw new IllegalArgumentException("The field name/value cannot be null"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldMap.java Sun Apr 14 08:16:46 2013 @@ -23,9 +23,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.Map; - -import javolution.context.ObjectFactory; -import javolution.util.FastMap; +import java.util.HashMap; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.entity.util.EntityUtil; @@ -37,19 +35,8 @@ import org.ofbiz.entity.util.EntityUtil; @SuppressWarnings("serial") public class EntityFieldMap extends EntityConditionListBase<EntityExpr> { - protected static final ObjectFactory<EntityFieldMap> entityFieldMapFactory = new ObjectFactory<EntityFieldMap>() { - @Override - protected EntityFieldMap create() { - return new EntityFieldMap(); - } - }; - protected Map<String, ? extends Object> fieldMap = null; - protected EntityFieldMap() { - super(); - } - public static <V> List<EntityExpr> makeConditionList(EntityComparisonOperator<?,V> op, V... keysValues) { return makeConditionList(EntityUtil.makeFields(keysValues), op); } @@ -66,14 +53,14 @@ public class EntityFieldMap extends Enti public <V> void init(EntityComparisonOperator<?,?> compOp, EntityJoinOperator joinOp, V... keysValues) { super.init(makeConditionList(EntityUtil.makeFields(keysValues), UtilGenerics.<EntityComparisonOperator<String,V>>cast(compOp)), joinOp); this.fieldMap = EntityUtil.makeFields(keysValues); - if (this.fieldMap == null) this.fieldMap = FastMap.newInstance(); + if (this.fieldMap == null) this.fieldMap = new HashMap<String, Object>(); this.operator = joinOp; } public <V> void init(Map<String, V> fieldMap, EntityComparisonOperator<?,?> compOp, EntityJoinOperator joinOp) { super.init(makeConditionList(fieldMap, UtilGenerics.<EntityComparisonOperator<String,V>>cast(compOp)), joinOp); this.fieldMap = fieldMap; - if (this.fieldMap == null) this.fieldMap = FastMap.newInstance(); + if (this.fieldMap == null) this.fieldMap = new HashMap<String, Object>(); this.operator = joinOp; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityFieldValue.java Sun Apr 14 08:16:46 2013 @@ -19,13 +19,10 @@ package org.ofbiz.entity.condition; +import java.util.LinkedList; import java.util.List; import java.util.Map; -import javolution.context.ObjectFactory; -import javolution.lang.Reusable; -import javolution.util.FastList; - import org.ofbiz.base.util.UtilMisc; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; @@ -42,41 +39,32 @@ import org.ofbiz.entity.model.ModelViewE * */ @SuppressWarnings("serial") -public class EntityFieldValue extends EntityConditionValue implements Reusable { +public class EntityFieldValue extends EntityConditionValue { public static final String module = EntityFieldValue.class.getName(); - protected static final ObjectFactory<EntityFieldValue> entityFieldValueFactory = new ObjectFactory<EntityFieldValue>() { - @Override - protected EntityFieldValue create() { - return new EntityFieldValue(); - } - }; - protected String fieldName = null; protected String entityAlias = null; protected List<String> entityAliasStack = null; protected ModelViewEntity modelViewEntity = null; public static EntityFieldValue makeFieldValue(String fieldName) { - EntityFieldValue efv = EntityFieldValue.entityFieldValueFactory.object(); + EntityFieldValue efv = new EntityFieldValue(); efv.init(fieldName, null, null, null); return efv; } public static EntityFieldValue makeFieldValue(String fieldName, String entityAlias, List<String> entityAliasStack, ModelViewEntity modelViewEntity) { - EntityFieldValue efv = EntityFieldValue.entityFieldValueFactory.object(); + EntityFieldValue efv = new EntityFieldValue(); efv.init(fieldName, entityAlias, entityAliasStack, modelViewEntity); return efv; } - protected EntityFieldValue() {} - public void init(String fieldName, String entityAlias, List<String> entityAliasStack, ModelViewEntity modelViewEntity) { this.fieldName = fieldName; this.entityAlias = entityAlias; if (UtilValidate.isNotEmpty(entityAliasStack)) { - this.entityAliasStack = FastList.newInstance(); + this.entityAliasStack = new LinkedList<String>(); this.entityAliasStack.addAll(entityAliasStack); } this.modelViewEntity = modelViewEntity; Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityJoinOperator.java Sun Apr 14 08:16:46 2013 @@ -21,11 +21,10 @@ package org.ofbiz.entity.condition; import java.util.ArrayList; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; -import javolution.util.FastList; - import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntity; @@ -49,7 +48,7 @@ public class EntityJoinOperator extends @Override public void addSqlValue(StringBuilder sql, ModelEntity modelEntity, List<EntityConditionParam> entityConditionParams, boolean compat, EntityCondition lhs, EntityCondition rhs, DatasourceInfo datasourceInfo) { - List<EntityCondition> conditions = FastList.newInstance(); + List<EntityCondition> conditions = new LinkedList<EntityCondition>(); conditions.add(lhs); conditions.add(rhs); addSqlValue(sql, modelEntity, entityConditionParams, conditions, datasourceInfo); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/condition/EntityWhereString.java Sun Apr 14 08:16:46 2013 @@ -21,8 +21,6 @@ package org.ofbiz.entity.condition; import java.util.List; import java.util.Map; -import javolution.context.ObjectFactory; - import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntity; @@ -44,17 +42,8 @@ import org.ofbiz.entity.model.ModelEntit @SuppressWarnings("serial") public class EntityWhereString extends EntityCondition { - protected static final ObjectFactory<EntityWhereString> entityWhereStringFactory = new ObjectFactory<EntityWhereString>() { - @Override - protected EntityWhereString create() { - return new EntityWhereString(); - } - }; - protected String sqlString; - protected EntityWhereString() {} - public void init(String sqlString) { this.sqlString = sqlString; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/connection/DBCPConnectionFactory.java Sun Apr 14 08:16:46 2013 @@ -24,11 +24,10 @@ import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import java.util.Properties; +import java.util.concurrent.ConcurrentHashMap; import javax.transaction.TransactionManager; -import javolution.util.FastMap; - import org.apache.commons.dbcp.ConnectionFactory; import org.apache.commons.dbcp.DriverConnectionFactory; import org.apache.commons.dbcp.PoolableConnectionFactory; @@ -50,133 +49,125 @@ import org.w3c.dom.Element; public class DBCPConnectionFactory implements ConnectionFactoryInterface { public static final String module = DBCPConnectionFactory.class.getName(); - protected static Map<String, ManagedDataSource> dsCache = FastMap.newInstance(); + protected static final ConcurrentHashMap<String, ManagedDataSource> dsCache = new ConcurrentHashMap<String, ManagedDataSource>(); public Connection getConnection(GenericHelperInfo helperInfo, Element jdbcElement) throws SQLException, GenericEntityException { - ManagedDataSource mds = dsCache.get(helperInfo.getHelperFullName()); + String cacheKey = helperInfo.getHelperFullName(); + ManagedDataSource mds = dsCache.get(cacheKey); if (mds != null) { return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection()); } - - synchronized (DBCPConnectionFactory.class) { - mds = dsCache.get(helperInfo.getHelperFullName()); - if (mds != null) { - return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection()); - } - - // connection properties - TransactionManager txMgr = TransactionFactory.getTransactionManager(); - String driverName = jdbcElement.getAttribute("jdbc-driver"); - - - String jdbcUri = UtilValidate.isNotEmpty(helperInfo.getOverrideJdbcUri()) ? helperInfo.getOverrideJdbcUri() : jdbcElement.getAttribute("jdbc-uri"); - String jdbcUsername = UtilValidate.isNotEmpty(helperInfo.getOverrideUsername()) ? helperInfo.getOverrideUsername() : jdbcElement.getAttribute("jdbc-username"); - String jdbcPassword = UtilValidate.isNotEmpty(helperInfo.getOverridePassword()) ? helperInfo.getOverridePassword() : jdbcElement.getAttribute("jdbc-password"); - - // pool settings - int maxSize, minSize, timeBetweenEvictionRunsMillis; - try { - maxSize = Integer.parseInt(jdbcElement.getAttribute("pool-maxsize")); - } catch (NumberFormatException nfe) { - Debug.logError("Problems with pool settings [pool-maxsize=" + jdbcElement.getAttribute("pool-maxsize") + "]; the values MUST be numbers, using default of 20.", module); - maxSize = 20; - } catch (Exception e) { - Debug.logError("Problems with pool settings [pool-maxsize], using default of 20.", module); - maxSize = 20; - } + // connection properties + TransactionManager txMgr = TransactionFactory.getTransactionManager(); + String driverName = jdbcElement.getAttribute("jdbc-driver"); + + String jdbcUri = UtilValidate.isNotEmpty(helperInfo.getOverrideJdbcUri()) ? helperInfo.getOverrideJdbcUri() : jdbcElement.getAttribute("jdbc-uri"); + String jdbcUsername = UtilValidate.isNotEmpty(helperInfo.getOverrideUsername()) ? helperInfo.getOverrideUsername() : jdbcElement.getAttribute("jdbc-username"); + String jdbcPassword = UtilValidate.isNotEmpty(helperInfo.getOverridePassword()) ? helperInfo.getOverridePassword() : jdbcElement.getAttribute("jdbc-password"); + + // pool settings + int maxSize, minSize, timeBetweenEvictionRunsMillis; + try { + maxSize = Integer.parseInt(jdbcElement.getAttribute("pool-maxsize")); + } catch (NumberFormatException nfe) { + Debug.logError("Problems with pool settings [pool-maxsize=" + jdbcElement.getAttribute("pool-maxsize") + "]; the values MUST be numbers, using default of 20.", module); + maxSize = 20; + } catch (Exception e) { + Debug.logError("Problems with pool settings [pool-maxsize], using default of 20.", module); + maxSize = 20; + } + try { + minSize = Integer.parseInt(jdbcElement.getAttribute("pool-minsize")); + } catch (NumberFormatException nfe) { + Debug.logError("Problems with pool settings [pool-minsize=" + jdbcElement.getAttribute("pool-minsize") + "]; the values MUST be numbers, using default of 2.", module); + minSize = 2; + } catch (Exception e) { + Debug.logError("Problems with pool settings [pool-minsize], using default of 2.", module); + minSize = 2; + } + // idle-maxsize, default to half of pool-maxsize + int maxIdle = maxSize / 2; + if (jdbcElement.hasAttribute("idle-maxsize")) { try { - minSize = Integer.parseInt(jdbcElement.getAttribute("pool-minsize")); + maxIdle = Integer.parseInt(jdbcElement.getAttribute("idle-maxsize")); } catch (NumberFormatException nfe) { - Debug.logError("Problems with pool settings [pool-minsize=" + jdbcElement.getAttribute("pool-minsize") + "]; the values MUST be numbers, using default of 2.", module); - minSize = 2; + Debug.logError("Problems with pool settings [idle-maxsize=" + jdbcElement.getAttribute("idle-maxsize") + "]; the values MUST be numbers, using calculated default of" + (maxIdle > minSize ? maxIdle : minSize) + ".", module); } catch (Exception e) { - Debug.logError("Problems with pool settings [pool-minsize], using default of 2.", module); - minSize = 2; - } - // idle-maxsize, default to half of pool-maxsize - int maxIdle = maxSize / 2; - if (jdbcElement.hasAttribute("idle-maxsize")) { - try { - maxIdle = Integer.parseInt(jdbcElement.getAttribute("idle-maxsize")); - } catch (NumberFormatException nfe) { - Debug.logError("Problems with pool settings [idle-maxsize=" + jdbcElement.getAttribute("idle-maxsize") + "]; the values MUST be numbers, using calculated default of" + (maxIdle > minSize ? maxIdle : minSize) + ".", module); - } catch (Exception e) { - Debug.logError("Problems with pool settings [idle-maxsize], using calculated default of" + (maxIdle > minSize ? maxIdle : minSize) + ".", module); - } + Debug.logError("Problems with pool settings [idle-maxsize], using calculated default of" + (maxIdle > minSize ? maxIdle : minSize) + ".", module); } - // Don't allow a maxIdle of less than pool-minsize - maxIdle = maxIdle > minSize ? maxIdle : minSize; + } + // Don't allow a maxIdle of less than pool-minsize + maxIdle = maxIdle > minSize ? maxIdle : minSize; - try { - timeBetweenEvictionRunsMillis = Integer.parseInt(jdbcElement.getAttribute("time-between-eviction-runs-millis")); - } catch (NumberFormatException nfe) { - Debug.logError("Problems with pool settings [time-between-eviction-runs-millis=" + jdbcElement.getAttribute("time-between-eviction-runs-millis") + "]; the values MUST be numbers, using default of 600000.", module); - timeBetweenEvictionRunsMillis = 600000; - } catch (Exception e) { - Debug.logError("Problems with pool settings [time-between-eviction-runs-millis], using default of 600000.", module); - timeBetweenEvictionRunsMillis = 600000; - } + try { + timeBetweenEvictionRunsMillis = Integer.parseInt(jdbcElement.getAttribute("time-between-eviction-runs-millis")); + } catch (NumberFormatException nfe) { + Debug.logError("Problems with pool settings [time-between-eviction-runs-millis=" + jdbcElement.getAttribute("time-between-eviction-runs-millis") + "]; the values MUST be numbers, using default of 600000.", module); + timeBetweenEvictionRunsMillis = 600000; + } catch (Exception e) { + Debug.logError("Problems with pool settings [time-between-eviction-runs-millis], using default of 600000.", module); + timeBetweenEvictionRunsMillis = 600000; + } - // load the driver - Driver jdbcDriver; - try { - jdbcDriver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance(); - } catch (Exception e) { - Debug.logError(e, module); - throw new GenericEntityException(e.getMessage(), e); - } + // load the driver + Driver jdbcDriver; + try { + jdbcDriver = (Driver) Class.forName(driverName, true, Thread.currentThread().getContextClassLoader()).newInstance(); + } catch (Exception e) { + Debug.logError(e, module); + throw new GenericEntityException(e.getMessage(), e); + } - // connection factory properties - Properties cfProps = new Properties(); - cfProps.put("user", jdbcUsername); - cfProps.put("password", jdbcPassword); - - // create the connection factory - ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, jdbcUri, cfProps); - - // wrap it with a LocalXAConnectionFactory - XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf); - - // configure the pool settings - GenericObjectPool pool = new GenericObjectPool(); - - pool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); - pool.setMaxActive(maxSize); - pool.setMaxIdle(maxIdle); - pool.setMinIdle(minSize); - pool.setMaxWait(120000); - - - // create the pool object factory - PoolableConnectionFactory factory = new PoolableManagedConnectionFactory(xacf, pool, null, null, true, true); - factory.setValidationQuery("select 1 from entity_key_store where key_name = ''"); - factory.setDefaultReadOnly(false); - - String transIso = jdbcElement.getAttribute("isolation-level"); - if (UtilValidate.isNotEmpty(transIso)) { - if ("Serializable".equals(transIso)) { - factory.setDefaultTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); - } else if ("RepeatableRead".equals(transIso)) { - factory.setDefaultTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); - } else if ("ReadUncommitted".equals(transIso)) { - factory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); - } else if ("ReadCommitted".equals(transIso)) { - factory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); - } else if ("None".equals(transIso)) { - factory.setDefaultTransactionIsolation(Connection.TRANSACTION_NONE); - } + // connection factory properties + Properties cfProps = new Properties(); + cfProps.put("user", jdbcUsername); + cfProps.put("password", jdbcPassword); + + // create the connection factory + ConnectionFactory cf = new DriverConnectionFactory(jdbcDriver, jdbcUri, cfProps); + + // wrap it with a LocalXAConnectionFactory + XAConnectionFactory xacf = new LocalXAConnectionFactory(txMgr, cf); + + // configure the pool settings + GenericObjectPool pool = new GenericObjectPool(); + + pool.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis); + pool.setMaxActive(maxSize); + pool.setMaxIdle(maxIdle); + pool.setMinIdle(minSize); + pool.setMaxWait(120000); + + // create the pool object factory + PoolableConnectionFactory factory = new PoolableManagedConnectionFactory(xacf, pool, null, null, true, true); + factory.setValidationQuery("select 1 from entity_key_store where key_name = ''"); + factory.setDefaultReadOnly(false); + + String transIso = jdbcElement.getAttribute("isolation-level"); + if (UtilValidate.isNotEmpty(transIso)) { + if ("Serializable".equals(transIso)) { + factory.setDefaultTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE); + } else if ("RepeatableRead".equals(transIso)) { + factory.setDefaultTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); + } else if ("ReadUncommitted".equals(transIso)) { + factory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); + } else if ("ReadCommitted".equals(transIso)) { + factory.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); + } else if ("None".equals(transIso)) { + factory.setDefaultTransactionIsolation(Connection.TRANSACTION_NONE); } - pool.setFactory(factory); + } + pool.setFactory(factory); - //mds = new ManagedDataSource(pool, xacf.getTransactionRegistry()); - mds = new DebugManagedDataSource(pool, xacf.getTransactionRegistry()); // Useful to debug the usage of connections in the pool - mds.setAccessToUnderlyingConnectionAllowed(true); + // mds = new ManagedDataSource(pool, xacf.getTransactionRegistry()); + mds = new DebugManagedDataSource(pool, xacf.getTransactionRegistry()); // Useful to debug the usage of connections in the pool + mds.setAccessToUnderlyingConnectionAllowed(true); - // cache the pool - dsCache.put(helperInfo.getHelperFullName(), mds); + // cache the pool + dsCache.putIfAbsent(cacheKey, mds); + mds = dsCache.get(cacheKey); - return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection()); - } + return TransactionFactory.getCursorConnection(helperInfo, mds.getConnection()); } public void closeAll() { @@ -184,6 +175,7 @@ public class DBCPConnectionFactory imple dsCache.clear(); } + @SuppressWarnings("unchecked") public static Map getDataSourceInfo(String helperName) { Map dataSourceInfo = new HashMap(); ManagedDataSource mds = dsCache.get(helperName); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericDAO.java Sun Apr 14 08:16:46 2013 @@ -23,6 +23,8 @@ import java.sql.SQLException; import java.sql.Timestamp; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -30,12 +32,9 @@ import java.util.Map; import java.util.Set; import java.util.TreeSet; import java.util.concurrent.Callable; -import java.util.concurrent.Future; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; - -import javolution.util.FastList; -import javolution.util.FastMap; -import javolution.util.FastSet; +import java.util.concurrent.Future; import org.ofbiz.base.concurrent.ExecutionPool; import org.ofbiz.base.util.Debug; @@ -43,9 +42,9 @@ import org.ofbiz.base.util.UtilValidate; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.EntityLockedException; import org.ofbiz.entity.GenericDataSourceException; -import org.ofbiz.entity.GenericEntityNotFoundException; import org.ofbiz.entity.GenericEntity; import org.ofbiz.entity.GenericEntityException; +import org.ofbiz.entity.GenericEntityNotFoundException; import org.ofbiz.entity.GenericModelException; import org.ofbiz.entity.GenericNotImplementedException; import org.ofbiz.entity.GenericValue; @@ -75,7 +74,7 @@ public class GenericDAO { public static final String module = GenericDAO.class.getName(); - private static final FastMap<String, GenericDAO> genericDAOs = FastMap.newInstance(); + private static final ConcurrentHashMap<String, GenericDAO> genericDAOs = new ConcurrentHashMap<String, GenericDAO>(); private static final ThreadGroup GENERIC_DAO_THREAD_GROUP = new ThreadGroup("GenericDAO"); private final GenericHelperInfo helperInfo; private final ModelFieldTypeReader modelFieldTypeReader; @@ -83,11 +82,11 @@ public class GenericDAO { private final ExecutorService executor; public static GenericDAO getGenericDAO(GenericHelperInfo helperInfo) { - GenericDAO newGenericDAO = genericDAOs.get(helperInfo.getHelperFullName()); - + String cacheKey = helperInfo.getHelperFullName(); + GenericDAO newGenericDAO = genericDAOs.get(cacheKey); if (newGenericDAO == null) { - genericDAOs.putIfAbsent(helperInfo.getHelperFullName(), new GenericDAO(helperInfo)); - newGenericDAO = genericDAOs.get(helperInfo.getHelperFullName()); + genericDAOs.putIfAbsent(cacheKey, new GenericDAO(helperInfo)); + newGenericDAO = genericDAOs.get(cacheKey); } return newGenericDAO; } @@ -210,7 +209,7 @@ public class GenericDAO { } // we don't want to update ALL fields, just the nonpk fields that are in the passed GenericEntity - List<ModelField> partialFields = FastList.newInstance(); + List<ModelField> partialFields = new LinkedList<ModelField>(); Collection<String> keys = entity.getAllKeys(); Iterator<ModelField> nopkIter = modelEntity.getNopksIterator(); @@ -385,7 +384,7 @@ public class GenericDAO { throw new GenericEntityException("Failed to get model entity for " + meName, e); } - Map<String, Object> findByMap = FastMap.newInstance(); + Map<String, Object> findByMap = new HashMap<String, Object>(); // Now iterate the ModelViewLinks to construct the "WHERE" part for update/insert Iterator<ModelViewEntity.ModelViewLink> linkIter = modelViewEntity.getViewLinksIterator(); @@ -455,7 +454,7 @@ public class GenericDAO { } // Construct fieldsToSave list for this member entity - List<ModelField> meFieldsToSave = FastList.newInstance(); + List<ModelField> meFieldsToSave = new LinkedList<ModelField>(); for (ModelField modelField: fieldsToSave) { if (memberModelEntity.isField(modelField.getName())) { ModelField meModelField = memberModelEntity.getField(modelField.getName()); @@ -570,7 +569,7 @@ public class GenericDAO { } */ // we don't want to select ALL fields, just the nonpk fields that are in the passed GenericEntity - List<ModelField> partialFields = FastList.newInstance(); + List<ModelField> partialFields = new LinkedList<ModelField>(); Set<String> tempKeys = new TreeSet<String>(keys); @@ -656,12 +655,12 @@ public class GenericDAO { } // make two ArrayLists of fields, one for fields to select and the other for where clause fields (to find by) - List<ModelField> selectFields = FastList.newInstance(); + List<ModelField> selectFields = new LinkedList<ModelField>(); if (UtilValidate.isNotEmpty(fieldsToSelect)) { - Set<String> tempKeys = FastSet.newInstance(); + Set<String> tempKeys = new HashSet<String>(); tempKeys.addAll(fieldsToSelect); - Set<String> fieldSetsToInclude = FastSet.newInstance(); - Set<String> addedFields = FastSet.newInstance(); + Set<String> fieldSetsToInclude = new HashSet<String>(); + Set<String> addedFields = new HashSet<String>(); for (String fieldToSelect : fieldsToSelect) { if (tempKeys.contains(fieldToSelect)) { ModelField curField = modelEntity.getField(fieldToSelect); @@ -683,8 +682,8 @@ public class GenericDAO { } if (UtilValidate.isNotEmpty(fieldSetsToInclude)) { Iterator<ModelField> fieldIter = modelEntity.getFieldsIterator(); - Set<String> extraFields = FastSet.newInstance(); - Set<String> reasonSets = FastSet.newInstance(); + Set<String> extraFields = new HashSet<String>(); + Set<String> reasonSets = new HashSet<String>(); while (fieldIter.hasNext()) { ModelField curField = fieldIter.next(); String fieldSet = curField.getFieldSet(); @@ -729,9 +728,9 @@ public class GenericDAO { List<EntityCondition> viewHavingConditions = null; List<String> viewOrderByList = null; if (modelViewEntity != null) { - viewWhereConditions = FastList.newInstance(); - viewHavingConditions = FastList.newInstance(); - viewOrderByList = FastList.newInstance(); + viewWhereConditions = new LinkedList<EntityCondition>(); + viewHavingConditions = new LinkedList<EntityCondition>(); + viewOrderByList = new LinkedList<String>(); modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, viewWhereConditions, viewHavingConditions, viewOrderByList, null); } @@ -739,7 +738,7 @@ public class GenericDAO { sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, modelFieldTypeReader, datasourceInfo)); // WHERE clause - List<EntityConditionParam> whereEntityConditionParams = FastList.newInstance(); + List<EntityConditionParam> whereEntityConditionParams = new LinkedList<EntityConditionParam>(); makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams); // GROUP BY clause for view-entity @@ -748,11 +747,11 @@ public class GenericDAO { } // HAVING clause - List<EntityConditionParam> havingEntityConditionParams = FastList.newInstance(); + List<EntityConditionParam> havingEntityConditionParams = new LinkedList<EntityConditionParam>(); makeConditionHavingString(sqlBuffer, " HAVING ", modelEntity, havingEntityCondition, viewHavingConditions, havingEntityConditionParams); // ORDER BY clause - List<String> orderByExpanded = FastList.<String>newInstance(); + List<String> orderByExpanded = new LinkedList<String>(); // add the manually specified ones, then the ones in the view entity's entity-condition if (orderBy != null) { orderByExpanded.addAll(orderBy); @@ -816,7 +815,7 @@ public class GenericDAO { modelViewEntity = (ModelViewEntity) modelEntity; } - List<EntityCondition> conditions = FastList.newInstance(); + List<EntityCondition> conditions = new LinkedList<EntityCondition>(); if (UtilValidate.isNotEmpty(whereEntityCondition)) { conditions.add(whereEntityCondition); } @@ -920,8 +919,8 @@ public class GenericDAO { // get the column name string to select StringBuilder selsb = new StringBuilder(); - List<String> collist = FastList.newInstance(); - List<String> fldlist = FastList.newInstance(); + List<String> collist = new LinkedList<String>(); + List<String> fldlist = new LinkedList<String>(); for (Iterator<ModelField> iterator = modelEntityTwo.getFieldsIterator(); iterator.hasNext();) { ModelField mf = iterator.next(); @@ -954,7 +953,7 @@ public class GenericDAO { // construct the source entity qualifier // get the fields from relation description kmsize = modelRelationOne.getKeyMapsSize(); - Map<ModelField, Object> bindMap = FastMap.newInstance(); + Map<ModelField, Object> bindMap = new HashMap<ModelField, Object>(); for (int i = 0; i < kmsize; i++) { // get the equivalent column names in the relation @@ -985,7 +984,7 @@ public class GenericDAO { sqlsb.append(SqlJdbcUtil.makeOrderByClause(modelEntityTwo, orderBy, true, datasourceInfo)); // now execute the query - List<GenericValue> retlist = FastList.newInstance(); + List<GenericValue> retlist = new LinkedList<GenericValue>(); Delegator gd = value.getDelegator(); try { @@ -1089,9 +1088,9 @@ public class GenericDAO { List<EntityCondition> viewHavingConditions = null; List<String> viewOrderByList = null; if (modelViewEntity != null) { - viewWhereConditions = FastList.newInstance(); - viewHavingConditions = FastList.newInstance(); - viewOrderByList = FastList.newInstance(); + viewWhereConditions = new LinkedList<EntityCondition>(); + viewHavingConditions = new LinkedList<EntityCondition>(); + viewOrderByList = new LinkedList<String>(); modelViewEntity.populateViewEntityConditionInformation(modelFieldTypeReader, viewWhereConditions, viewHavingConditions, viewOrderByList, null); } @@ -1099,7 +1098,7 @@ public class GenericDAO { sqlBuffer.append(SqlJdbcUtil.makeFromClause(modelEntity, modelFieldTypeReader, datasourceInfo)); // WHERE clause - List<EntityConditionParam> whereEntityConditionParams = FastList.newInstance(); + List<EntityConditionParam> whereEntityConditionParams = new LinkedList<EntityConditionParam>(); makeConditionWhereString(sqlBuffer, " WHERE ", modelEntity, whereEntityCondition, viewWhereConditions, whereEntityConditionParams); // GROUP BY clause for view-entity @@ -1108,7 +1107,7 @@ public class GenericDAO { } // HAVING clause - List<EntityConditionParam> havingEntityConditionParams = FastList.newInstance(); + List<EntityConditionParam> havingEntityConditionParams = new LinkedList<EntityConditionParam>(); makeConditionHavingString(sqlBuffer, " HAVING ", modelEntity, havingEntityCondition, viewHavingConditions, havingEntityConditionParams); if (isGroupBy) { Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperInfo.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperInfo.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperInfo.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/datasource/GenericHelperInfo.java Sun Apr 14 08:16:46 2013 @@ -43,7 +43,7 @@ public class GenericHelperInfo { public String getHelperFullName() { if (UtilValidate.isNotEmpty(tenantId)) { - return helperBaseName + "#" + tenantId; + return helperBaseName.concat("#").concat(tenantId); } else { return helperBaseName; } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ByAndFinder.java Sun Apr 14 08:16:46 2013 @@ -18,10 +18,9 @@ *******************************************************************************/ package org.ofbiz.entity.finder; +import java.util.HashMap; import java.util.Map; -import javolution.util.FastMap; - import org.ofbiz.base.util.collections.FlexibleMapAccessor; import org.ofbiz.entity.condition.EntityCondition; import org.ofbiz.entity.model.ModelEntity; @@ -49,7 +48,7 @@ public class ByAndFinder extends ListFin @Override public EntityCondition getWhereEntityCondition(Map<String, Object> context, ModelEntity modelEntity, ModelFieldTypeReader modelFieldTypeReader) { // create the by and map - Map<String, Object> entityContext = FastMap.newInstance(); + Map<String, Object> entityContext = new HashMap<String, Object>(); EntityFinderUtil.expandFieldMapToContext(this.fieldMap, context, entityContext); // then convert the types... modelEntity.convertFieldMapInPlace(entityContext, modelFieldTypeReader); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/EntityFinderUtil.java Sun Apr 14 08:16:46 2013 @@ -26,12 +26,11 @@ import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; -import javolution.util.FastList; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.ObjectType; import org.ofbiz.base.util.StringUtil; @@ -387,7 +386,7 @@ public class EntityFinderUtil { } result = results.subList(start, end); } else { - result = FastList.newInstance(); + result = new LinkedList<GenericValue>(); } listAcsr.put(context, result); } @@ -450,7 +449,7 @@ public class EntityFinderUtil { } result = results.subList(begin, end); } else { - result = FastList.newInstance(); + result = new LinkedList<GenericValue>(); } listAcsr.put(context, result); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/ListFinder.java Sun Apr 14 08:16:46 2013 @@ -19,12 +19,11 @@ package org.ofbiz.entity.finder; import java.sql.ResultSet; +import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; -import javolution.util.FastList; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilMisc; @@ -90,7 +89,7 @@ public abstract class ListFinder extends // process order-by List<? extends Element> orderByElementList = UtilXml.childElementList(element, "order-by"); if (orderByElementList.size() > 0) { - orderByExpanderList = FastList.newInstance(); + orderByExpanderList = new ArrayList<FlexibleStringExpander>(orderByElementList.size()); for (Element orderByElement: orderByElementList) { orderByExpanderList.add(FlexibleStringExpander.getInstance(orderByElement.getAttribute("field-name"))); } Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/finder/PrimaryKeyFinder.java Sun Apr 14 08:16:46 2013 @@ -18,13 +18,12 @@ */ package org.ofbiz.entity.finder; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; -import javolution.util.FastMap; - import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.GeneralException; import org.ofbiz.base.util.UtilValidate; @@ -101,7 +100,7 @@ public class PrimaryKeyFinder extends Fi Map<FlexibleMapAccessor<Object>, Object> fieldMap, List<FlexibleStringExpander> selectFieldExpanderList) throws GeneralException { // assemble the field map - Map<String, Object> entityContext = FastMap.newInstance(); + Map<String, Object> entityContext = new HashMap<String, Object>(); if (autoFieldMap) { // try a map called "parameters", try it first so values from here are overridden by values in the main context Object parametersObj = context.get("parameters"); Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1467744&r1=1467743&r2=1467744&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/jdbc/DatabaseUtil.java Sun Apr 14 08:16:46 2013 @@ -28,7 +28,9 @@ import java.sql.Statement; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.Iterator; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -38,11 +40,6 @@ import java.util.concurrent.ExecutorServ import java.util.concurrent.Future; import java.util.concurrent.FutureTask; -import javolution.util.FastList; -import javolution.util.FastMap; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - import org.ofbiz.base.concurrent.ExecutionPool; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilTimer; @@ -61,6 +58,8 @@ import org.ofbiz.entity.model.ModelKeyMa import org.ofbiz.entity.model.ModelRelation; import org.ofbiz.entity.model.ModelViewEntity; import org.ofbiz.entity.transaction.TransactionUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; /** * Utilities for Entity Database Maintenance @@ -223,7 +222,7 @@ public class DatabaseUtil { Collections.sort(modelEntityList); int curEnt = 0; int totalEnt = modelEntityList.size(); - List<ModelEntity> entitiesAdded = FastList.newInstance(); + List<ModelEntity> entitiesAdded = new LinkedList<ModelEntity>(); String schemaName; try { DatabaseMetaData dbData = this.getDatabaseMetaData(null, messages); @@ -234,7 +233,7 @@ public class DatabaseUtil { Debug.logError(message, module); return; } - List<Future<CreateTableCallable>> tableFutures = FastList.newInstance(); + List<Future<CreateTableCallable>> tableFutures = new LinkedList<Future<CreateTableCallable>>(); for (ModelEntity entity: modelEntityList) { curEnt++; @@ -270,7 +269,7 @@ public class DatabaseUtil { tableNames.remove(tableName); if (colInfo != null) { - Map<String, ModelField> fieldColNames = FastMap.newInstance(); + Map<String, ModelField> fieldColNames = new HashMap<String, ModelField>(); Iterator<ModelField> fieldIter = entity.getFieldsIterator(); while (fieldIter.hasNext()) { ModelField field = fieldIter.next(); @@ -442,7 +441,7 @@ public class DatabaseUtil { // for each newly added table, add fk indices if (datasourceInfo.useFkIndices) { int totalFkIndices = 0; - List<Future<AbstractCountingCallable>> fkIndicesFutures = FastList.newInstance(); + List<Future<AbstractCountingCallable>> fkIndicesFutures = new LinkedList<Future<AbstractCountingCallable>>(); for (ModelEntity curEntity: entitiesAdded) { if (curEntity.getRelationsOneSize() > 0) { fkIndicesFutures.add(submitWork(new AbstractCountingCallable(curEntity, modelEntities) { @@ -471,7 +470,7 @@ public class DatabaseUtil { // for each newly added table, add declared indexes if (datasourceInfo.useIndices) { int totalDis = 0; - List<Future<AbstractCountingCallable>> disFutures = FastList.newInstance(); + List<Future<AbstractCountingCallable>> disFutures = new LinkedList<Future<AbstractCountingCallable>>(); for (ModelEntity curEntity: entitiesAdded) { if (curEntity.getIndexesSize() > 0) { disFutures.add(submitWork(new AbstractCountingCallable(curEntity, modelEntities) { @@ -737,7 +736,7 @@ public class DatabaseUtil { // go through each table and make a ModelEntity object, add to list // for each entity make corresponding ModelField objects // then print out XML for the entities/fields - List<ModelEntity> newEntList = FastList.newInstance(); + List<ModelEntity> newEntList = new LinkedList<ModelEntity>(); boolean isCaseSensitive = false; DatabaseMetaData dbData = this.getDatabaseMetaData(null, messages); @@ -1099,7 +1098,7 @@ public class DatabaseUtil { public Map<String, Map<String, ColumnCheckInfo>> getColumnInfo(Set<String> tableNames, boolean getPks, Collection<String> messages) { // if there are no tableNames, don't even try to get the columns if (tableNames.size() == 0) { - return FastMap.newInstance(); + return new HashMap<String, Map<String, ColumnCheckInfo>>(); } Connection connection = null; @@ -1129,7 +1128,7 @@ public class DatabaseUtil { if (Debug.infoOn()) Debug.logInfo("Getting Column Info From Database", module); - Map<String, Map<String, ColumnCheckInfo>> colInfo = FastMap.newInstance(); + Map<String, Map<String, ColumnCheckInfo>> colInfo = new HashMap<String, Map<String, ColumnCheckInfo>>(); try { String lookupSchemaName = getSchemaName(dbData); boolean needsUpperCase = false; @@ -1184,7 +1183,7 @@ public class DatabaseUtil { Map<String, ColumnCheckInfo> tableColInfo = colInfo.get(ccInfo.tableName); if (tableColInfo == null) { - tableColInfo = FastMap.newInstance(); + tableColInfo = new HashMap<String, ColumnCheckInfo>(); colInfo.put(ccInfo.tableName, tableColInfo); } tableColInfo.put(ccInfo.columnName, ccInfo); @@ -1225,7 +1224,7 @@ public class DatabaseUtil { } if (pkCount == 0) { Debug.logInfo("Searching in " + tableNames.size() + " tables for primary key fields ...", module); - List<Future<AbstractCountingCallable>> pkFetcherFutures = FastList.newInstance(); + List<Future<AbstractCountingCallable>> pkFetcherFutures = new LinkedList<Future<AbstractCountingCallable>>(); for (String curTable: tableNames) { curTable = curTable.substring(curTable.indexOf('.') + 1); //cut off schema name pkFetcherFutures.add(submitWork(createPrimaryKeyFetcher(dbData, lookupSchemaName, needsUpperCase, colInfo, messages, curTable))); @@ -1348,7 +1347,7 @@ public class DatabaseUtil { if (Debug.infoOn()) Debug.logInfo("Getting Foreign Key (Reference) Info From Database", module); - Map<String, Map<String, ReferenceCheckInfo>> refInfo = FastMap.newInstance(); + Map<String, Map<String, ReferenceCheckInfo>> refInfo = new HashMap<String, Map<String, ReferenceCheckInfo>>(); try { // ResultSet rsCols = dbData.getCrossReference(null, null, null, null, null, null); @@ -1405,7 +1404,7 @@ public class DatabaseUtil { Map<String, ReferenceCheckInfo> tableRefInfo = refInfo.get(rcInfo.fkTableName); if (tableRefInfo == null) { - tableRefInfo = FastMap.newInstance(); + tableRefInfo = new HashMap<String, ReferenceCheckInfo>(); refInfo.put(rcInfo.fkTableName, tableRefInfo); if (Debug.verboseOn()) Debug.logVerbose("Adding new Map for table: " + rcInfo.fkTableName, module); } @@ -1482,7 +1481,7 @@ public class DatabaseUtil { if (Debug.infoOn()) Debug.logInfo("Getting Index Info From Database", module); - Map<String, Set<String>> indexInfo = FastMap.newInstance(); + Map<String, Set<String>> indexInfo = new HashMap<String, Set<String>>(); try { int totalIndices = 0; String lookupSchemaName = getSchemaName(dbData); @@ -1617,7 +1616,7 @@ public class DatabaseUtil { private abstract class AbstractCountingCallable implements Callable<AbstractCountingCallable> { protected final ModelEntity entity; protected final Map<String, ModelEntity> modelEntities; - protected final List<String> messages = FastList.newInstance(); + protected final List<String> messages = new LinkedList<String>(); protected int count; protected AbstractCountingCallable(ModelEntity entity, Map<String, ModelEntity> modelEntities) { |
| Free forum by Nabble | Edit this page |
