You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2014/08/25 08:26:03 UTC
svn commit: r1620260 - in /ofbiz/branches/framework-api-cleanup: ./
framework/base/src/org/ofbiz/base/util/cache/
framework/common/src/org/ofbiz/common/
framework/entity/src/org/ofbiz/entity/util/
framework/entityext/src/org/ofbiz/entityext/data/ frame...
Author: jacopoc
Date: Mon Aug 25 06:26:02 2014
New Revision: 1620260
URL: http://svn.apache.org/r1620260
Log:
Merged latest trunk changes
Modified:
ofbiz/branches/framework-api-cleanup/ (props changed)
ofbiz/branches/framework-api-cleanup/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
ofbiz/branches/framework-api-cleanup/framework/common/src/org/ofbiz/common/UrlServletHelper.java
ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
ofbiz/branches/framework-api-cleanup/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
Propchange: ofbiz/branches/framework-api-cleanup/
------------------------------------------------------------------------------
Merged /ofbiz/trunk:r1619853-1620257
Modified: ofbiz/branches/framework-api-cleanup/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java?rev=1620260&r1=1620259&r2=1620260&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/base/src/org/ofbiz/base/util/cache/UtilCache.java Mon Aug 25 06:26:02 2014
@@ -190,19 +190,17 @@ public class UtilCache<K, V> implements
public static String getPropertyParam(ResourceBundle res, String[] propNames, String parameter) {
try {
- for (String propName: propNames) {
- if(res.containsKey(propName+ '.' + parameter)) {
- try {
- return res.getString(propName + '.' + parameter);
- } catch (MissingResourceException e) {}
- }
+ for (String propName : propNames) {
+ String key = propName.concat(".").concat(parameter);
+ if (res.containsKey(key)) {
+ try {
+ return res.getString(key);
+ } catch (MissingResourceException e) {
+ }
+ }
}
- // don't need this, just return null
- //if (value == null) {
- // throw new MissingResourceException("Can't find resource for bundle", res.getClass().getName(), Arrays.asList(propNames) + "." + parameter);
- //}
} catch (Exception e) {
- Debug.logWarning(e, "Error getting " + parameter + " value from cache.properties file for propNames: " + propNames, module);
+ Debug.logWarning(e, "Error getting " + parameter + " value from ResourceBundle for propNames: " + propNames, module);
}
return null;
}
@@ -212,7 +210,11 @@ public class UtilCache<K, V> implements
}
public void setPropertiesParams(String[] propNames) {
- ResourceBundle res = ResourceBundle.getBundle("cache");
+ setPropertiesParams("cache", propNames);
+ }
+
+ public void setPropertiesParams(String settingsResourceName, String[] propNames) {
+ ResourceBundle res = ResourceBundle.getBundle(settingsResourceName);
if (res != null) {
String value = getPropertyParam(res, propNames, "maxSize");
Modified: ofbiz/branches/framework-api-cleanup/framework/common/src/org/ofbiz/common/UrlServletHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/common/src/org/ofbiz/common/UrlServletHelper.java?rev=1620260&r1=1620259&r2=1620260&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/common/src/org/ofbiz/common/UrlServletHelper.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/common/src/org/ofbiz/common/UrlServletHelper.java Mon Aug 25 06:26:02 2014
@@ -32,7 +32,6 @@ import javax.servlet.http.HttpServletRes
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
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;
@@ -50,8 +49,8 @@ public class UrlServletHelper extends Co
public static void setRequestAttributes(ServletRequest request, Delegator delegator, ServletContext servletContext) {
HttpServletRequest httpRequest = (HttpServletRequest) request;
// check if multi tenant is enabled
- String useMultitenant = UtilProperties.getPropertyValue("general.properties", "multitenant");
- if ("Y".equals(useMultitenant)) {
+ boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
+ if (useMultitenant) {
// get tenant delegator by domain name
String serverName = request.getServerName();
try {
Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java?rev=1620260&r1=1620259&r2=1620260&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityDataLoader.java Mon Aug 25 06:26:02 2014
@@ -105,8 +105,8 @@ public class EntityDataLoader {
}
readerName = readerName.trim();
- // ignore the "tenant" reader if the multitenant property is "N"
- if ("tenant".equals(readerName) && "N".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
+ // ignore the "tenant" reader if multitenant is disabled
+ if ("tenant".equals(readerName) && !EntityUtil.isMultiTenantEnabled()) {
continue;
}
Modified: ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java?rev=1620260&r1=1620259&r2=1620260&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entity/src/org/ofbiz/entity/util/EntityUtil.java Mon Aug 25 06:26:02 2014
@@ -35,6 +35,7 @@ import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.UtilDateTime;
import org.ofbiz.base.util.UtilGenerics;
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.GenericEntity;
@@ -539,4 +540,13 @@ public class EntityUtil {
return fieldList;
}
+
+ /**
+ * Returns <code>true</code> if multi-tenant has been enabled.
+ * <p>Multi-tenant features are enabled by setting the <code>multitenant</code>
+ * property in <code>general.properties</code> to "Y".</p>
+ */
+ public static boolean isMultiTenantEnabled() {
+ return "Y".equalsIgnoreCase(UtilProperties.getPropertyValue("general.properties", "multitenant"));
+ }
}
Modified: ofbiz/branches/framework-api-cleanup/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java?rev=1620260&r1=1620259&r2=1620260&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/entityext/src/org/ofbiz/entityext/data/EntityDataLoadContainer.java Mon Aug 25 06:26:02 2014
@@ -37,7 +37,6 @@ import org.ofbiz.base.container.Containe
import org.ofbiz.base.util.Debug;
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilMisc;
-import org.ofbiz.base.util.UtilProperties;
import org.ofbiz.base.util.UtilURL;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.entity.Delegator;
@@ -51,6 +50,7 @@ import org.ofbiz.entity.datasource.Gener
import org.ofbiz.entity.jdbc.DatabaseUtil;
import org.ofbiz.entity.model.ModelEntity;
import org.ofbiz.entity.util.EntityDataLoader;
+import org.ofbiz.entity.util.EntityUtil;
import org.ofbiz.service.ServiceDispatcher;
@@ -206,8 +206,8 @@ public class EntityDataLoadContainer imp
*/
public boolean start() throws ContainerException {
if("all-tenants".equals(this.overrideDelegator)) {
- if ("N".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
- Debug.logWarning("Please enable multitenant. (e.g. general.properties --> multitenant=Y)", module);
+ if (!EntityUtil.isMultiTenantEnabled()) {
+ Debug.logWarning("Multitenant is disabled. Please enable multitenant. (e.g. general.properties --> multitenant=Y)", module);
return true;
}
ContainerConfig.Container cfg = ContainerConfig.getContainer(name, configFile);
@@ -317,7 +317,7 @@ public class EntityDataLoadContainer imp
}
// load specify components
List<String> loadComponents = FastList.newInstance();
- if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId()) && "Y".equals(UtilProperties.getPropertyValue("general.properties", "multitenant"))) {
+ if (UtilValidate.isNotEmpty(delegator.getDelegatorTenantId()) && EntityUtil.isMultiTenantEnabled()) {
try {
List<EntityExpr> exprs = new ArrayList<EntityExpr>();
exprs.add(EntityCondition.makeCondition("rootLocation", EntityOperator.NOT_LIKE, "%hot-deploy%"));
Modified: ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java?rev=1620260&r1=1620259&r2=1620260&view=diff
==============================================================================
--- ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java (original)
+++ ofbiz/branches/framework-api-cleanup/framework/webapp/src/org/ofbiz/webapp/control/ContextFilter.java Mon Aug 25 06:26:02 2014
@@ -254,8 +254,8 @@ public class ContextFilter implements Fi
}
// check if multi tenant is enabled
- String useMultitenant = UtilProperties.getPropertyValue("general.properties", "multitenant");
- if ("Y".equals(useMultitenant)) {
+ boolean useMultitenant = EntityUtil.isMultiTenantEnabled();
+ if (useMultitenant) {
// get tenant delegator by domain name
String serverName = httpRequest.getServerName();
try {