|
Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/ofbiz-component.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/ofbiz-component.xml (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/ofbiz-component.xml Tue Jun 19 21:36:11 2012 @@ -31,7 +31,7 @@ under the License. <entity-resource type="data" reader-name="seed" loader="main" location="data/WorkEffortTypeData.xml"/> <entity-resource type="data" reader-name="demo" loader="main" location="data/WorkEffortDemoData.xml"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/WorkEffortPortletData.xml"/> - <entity-resource type="data" reader-name="seed" loader="main" location="data/WorkEffortSecurityData.xml"/> + <entity-resource type="data" reader-name="security" loader="main" location="data/WorkEffortSecurityData.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/> <service-resource type="model" loader="main" location="servicedef/services_timesheet.xml"/> <service-resource type="model" loader="main" location="servicedef/services_upgrade.xml"/> Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/content/WorkEffortContentWrapper.java Tue Jun 19 21:36:11 2012 @@ -52,7 +52,7 @@ public class WorkEffortContentWrapper im public static final String module = WorkEffortContentWrapper.class.getName(); public static final String CACHE_KEY_SEPARATOR = "::"; - public static UtilCache<String, String> workEffortContentCache = UtilCache.createUtilCache("workeffort.content.rendered", true); + private static final UtilCache<String, String> workEffortContentCache = UtilCache.createUtilCache("workeffort.content.rendered", true); protected LocalDispatcher dispatcher; protected GenericValue workEffort; @@ -110,7 +110,7 @@ public class WorkEffortContentWrapper im if (workEffortContent != null) { GenericValue content; try { - content = workEffortContent.getRelatedOne("Content"); + content = workEffortContent.getRelatedOne("Content", false); } catch (GeneralException e) { Debug.logError(e, module); return null; @@ -143,7 +143,7 @@ public class WorkEffortContentWrapper im if (workEffortContent != null) { GenericValue content; try { - content = workEffortContent.getRelatedOne("Content"); + content = workEffortContent.getRelatedOne("Content", false); } catch (GeneralException e) { Debug.logError(e, module); return null; @@ -151,7 +151,7 @@ public class WorkEffortContentWrapper im if (content != null) { GenericValue dataResource; try { - dataResource = content.getRelatedOne("DataResource"); + dataResource = content.getRelatedOne("DataResource", false); } catch (GeneralException e) { Debug.logError(e, module); return null; @@ -236,18 +236,18 @@ public class WorkEffortContentWrapper im } try { - if (useCache && workEffortContentCache.get(cacheKey) != null) { - return workEffortContentCache.get(cacheKey); + if (useCache) { + String cachedValue = workEffortContentCache.get(cacheKey); + if (cachedValue != null) { + return cachedValue; + } } Writer outWriter = new StringWriter(); getWorkEffortContentAsText(contentId, null, workEffort, workEffortContentTypeId, locale, mimeTypeId, delegator, dispatcher, outWriter); String outString = outWriter.toString(); if (outString.length() > 0) { - if (workEffortContentCache != null) { - workEffortContentCache.put(cacheKey, outString); - } - return outString; + return workEffortContentCache.putIfAbsentAndGet(cacheKey, outString); } else { String candidateOut = workEffort.getModelEntity().isField(candidateFieldName) ? workEffort.getString(candidateFieldName): ""; return candidateOut == null? "" : candidateOut; Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalConverter.java Tue Jun 19 21:36:11 2012 @@ -352,7 +352,7 @@ public class ICalConverter { alarmProps = alarm.getProperties(); alarmProps.add(new XProperty(reminderXPropName, reminderId)); } - GenericValue contactMech = reminder.getRelatedOne("ContactMech"); + GenericValue contactMech = reminder.getRelatedOne("ContactMech", false); if (contactMech != null && "EMAIL_ADDRESS".equals(contactMech.get("contactMechTypeId"))) { try { alarmProps.add(new Attendee(contactMech.getString("infoString"))); @@ -571,7 +571,7 @@ public class ICalConverter { protected static Calendar makeCalendar(GenericValue workEffort, Map<String, Object> context) throws GenericEntityException { String iCalData = null; - GenericValue iCalValue = workEffort.getRelatedOne("WorkEffortIcalData"); + GenericValue iCalValue = workEffort.getRelatedOne("WorkEffortIcalData", false); if (iCalValue != null) { iCalData = iCalValue.getString("icalData"); } @@ -763,7 +763,7 @@ public class ICalConverter { } } Map<String, ? extends Object> serviceMap = UtilMisc.toMap("workEffortId", context.get("workEffortId"), "icalData", calendar.toString()); - GenericValue iCalData = publishProperties.getRelatedOne("WorkEffortIcalData"); + GenericValue iCalData = publishProperties.getRelatedOne("WorkEffortIcalData", false); Map<String, Object> serviceResult = null; if (iCalData == null) { serviceResult = invokeService("createWorkEffortICalData", serviceMap, context); Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/ICalWorker.java Tue Jun 19 21:36:11 2012 @@ -134,7 +134,7 @@ public class ICalWorker { String workEffortId = (String) request.getAttribute("workEffortId"); Delegator delegator = (Delegator) request.getAttribute("delegator"); GenericValue publishProperties = delegator.findOne("WorkEffort", UtilMisc.toMap("workEffortId", workEffortId), false); - GenericValue iCalData = publishProperties.getRelatedOne("WorkEffortIcalData"); + GenericValue iCalData = publishProperties.getRelatedOne("WorkEffortIcalData", false); if (iCalData != null) { return iCalData.getTimestamp("lastUpdatedStamp"); } else { @@ -290,11 +290,11 @@ public class ICalWorker { request.setAttribute("userLogin", userLogin); session.setAttribute("userLogin", userLogin); VisitHandler.getVisitor(request, response); - GenericValue person = userLogin.getRelatedOne("Person"); + GenericValue person = userLogin.getRelatedOne("Person", false); if (person != null) { request.setAttribute("person", person); } else { - GenericValue partyGroup = userLogin.getRelatedOne("PartyGroup"); + GenericValue partyGroup = userLogin.getRelatedOne("PartyGroup", false); if (partyGroup != null) { request.setAttribute("partyGroup", partyGroup); } Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortKeywordIndex.java Tue Jun 19 21:36:11 2012 @@ -95,7 +95,7 @@ public class WorkEffortKeywordIndex { List<GenericValue> workEffortContentAndInfos = delegator.findByAnd("WorkEffortContentAndInfo", UtilMisc.toMap("workEffortId", workEffortId, "workEffortContentTypeId", workEffortContentTypeId), null, false); for (GenericValue workEffortContentAndInfo: workEffortContentAndInfos) { addWeightedDataResourceString(workEffortContentAndInfo, weight, strings, delegator, workEffort); - List<GenericValue> alternateViews = workEffortContentAndInfo.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate")); + List<GenericValue> alternateViews = workEffortContentAndInfo.getRelated("ContentAssocDataResourceViewTo", UtilMisc.toMap("caContentAssocTypeId", "ALTERNATE_LOCALE"), UtilMisc.toList("-caFromDate"), false); alternateViews = EntityUtil.filterByDate(alternateViews, UtilDateTime.nowTimestamp(), "caFromDate", "caThruDate", true); for (GenericValue thisView: alternateViews) { addWeightedDataResourceString(thisView, weight, strings, delegator, workEffort); Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/src/org/ofbiz/workeffort/workeffort/WorkEffortServices.java Tue Jun 19 21:36:11 2012 @@ -921,7 +921,7 @@ public class WorkEffortServices { int currentCount = reminder.get("currentCount") == null ? 0 : reminder.getLong("currentCount").intValue(); GenericValue workEffort = null; try { - workEffort = reminder.getRelatedOne("WorkEffort"); + workEffort = reminder.getRelatedOne("WorkEffort", false); } catch (GenericEntityException e) { Debug.logWarning("Error while getting work effort: " + e, module); } @@ -1041,7 +1041,7 @@ public class WorkEffortServices { GenericValue reminder = (GenericValue) context.get("reminder"); GenericValue contactMech = null; try { - contactMech = reminder.getRelatedOne("ContactMech"); + contactMech = reminder.getRelatedOne("ContactMech", false); } catch (GenericEntityException e) { Debug.logError(e, module); } @@ -1083,7 +1083,7 @@ public class WorkEffortServices { @Deprecated protected static void processEventReminder(DispatchContext ctx, GenericValue reminder, Map<String, Object> parameters) throws GenericEntityException { LocalDispatcher dispatcher = ctx.getDispatcher(); - GenericValue contactMech = reminder.getRelatedOne("ContactMech"); + GenericValue contactMech = reminder.getRelatedOne("ContactMech", false); if (contactMech != null && "EMAIL_ADDRESS".equals(contactMech.get("contactMechTypeId"))) { String screenLocation = UtilProperties.getPropertyValue("EventReminders", "eventReminders.emailScreenWidgetLocation"); String fromAddress = UtilProperties.getPropertyValue("EventReminders", "eventReminders.emailFromAddress"); Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/calendar/upcoming.ftl Tue Jun 19 21:36:11 2012 @@ -35,7 +35,7 @@ under the License. <tr<#if alt_row> class="alternate-row"</#if>> <td><#if workEffort.actualStartDate?exists>${workEffort.actualStartDate}<#else>${workEffort.estimatedStartDate}</#if></td> <td><#if workEffort.actualCompletionDate?exists>${workEffort.actualCompletionDate}<#else>${workEffort.estimatedCompletionDate}</#if></td> - <td>${workEffort.getRelatedOne("WorkEffortType").get("description",locale)}</td> + <td>${workEffort.getRelatedOne("WorkEffortType", false).get("description",locale)}</td> <td class="button-col"><a href="<@ofbizUrl>EditWorkEffort?workEffortId=${workEffort.workEffortId}${addlParam?if_exists}</@ofbizUrl>">${workEffort.workEffortName}</a></td> </tr> <#assign alt_row = !alt_row> Modified: ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl (original) +++ ofbiz/branches/20120329_portletWidget/applications/workeffort/webapp/workeffort/workeffort/EventReminderEmail.ftl Tue Jun 19 21:36:11 2012 @@ -64,11 +64,11 @@ under the License. <#list partyAssignments as wepa> <tr> <td>${wepa.groupName?if_exists}${wepa.firstName?if_exists} ${wepa.lastName?if_exists}</td> - <td>${(wepa.getRelatedOne("RoleType").description)?default(" ")}</td> + <td>${(wepa.getRelatedOne("RoleType", false).description)?default(" ")}</td> <td>${wepa.fromDate?default(" ")}</td> <td>${wepa.thruDate?default(" ")}</td> - <td>${(wepa.getRelatedOne("AssignmentStatusItem").description)?default(" ")}</td> - <td>${(wepa.getRelatedOne("DelegateReasonEnumeration").description)?default(" ")}</td> + <td>${(wepa.getRelatedOne("AssignmentStatusItem", false).description)?default(" ")}</td> + <td>${(wepa.getRelatedOne("DelegateReasonEnumeration", false).description)?default(" ")}</td> </tr> </#list> </tbody> @@ -92,8 +92,8 @@ under the License. <td>${wefa.fixedAssetName?default(" ")}</td> <td>${wefa.fromDate?default(" ")}</td> <td>${wefa.thruDate?default(" ")}</td> - <td>${(wefa.getRelatedOne("StatusItem").description)?default(" ")}</td> - <td>${(wefa.getRelatedOne("AvailabilityStatusItem").description)?default(" ")}</td> + <td>${(wefa.getRelatedOne("StatusItem", false).description)?default(" ")}</td> + <td>${(wefa.getRelatedOne("AvailabilityStatusItem", false).description)?default(" ")}</td> <td>${wefa.allocatedCost?default(" ")}</td> <td>${wefa.comments?default(" ")}</td> </tr> Modified: ofbiz/branches/20120329_portletWidget/build.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/build.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/build.xml (original) +++ ofbiz/branches/20120329_portletWidget/build.xml Tue Jun 19 21:36:11 2012 @@ -86,6 +86,8 @@ under the License. description="Clean all downloaded files"> <delete> <fileset dir="framework/base/lib" includes="cobertura-*.jar"/> + <fileset dir="framework/base/lib" includes="asm*.jar"/> + <fileset dir="framework/base/lib" includes="oro*.jar"/> <fileset dir="framework/base/lib" includes="sonar-*.jar"/> <fileset dir="framework/entity/lib/jdbc" includes="postgresql-*.jar"/> </delete> @@ -394,7 +396,7 @@ under the License. </java> </target> <target name="start-debug" - description="Start OFBiz in debugging mode"> + description="Start OFBiz in debugging mode. It uses the 8091 port by default"> <java jar="ofbiz.jar" fork="true"> <jvmarg value="${memory.initial.param}"/> <jvmarg value="${memory.max.param}"/> @@ -828,13 +830,12 @@ under the License. <delete file="runtime/tmp/tmpUserLogin.xml"/> </target> <target name="load-tenant-data-readers" - description="Load data of given data-readers in the tenant database"> + description="Load data of given data-readers in the tenant database. Example: ./ant load-tenant-data-readers -Ddata-readers=seed,seed-initial -DtenantId=demo"> <echo>------------------------------------</echo> <echo message="Loading selected data-readers in tenant databaset"/> <echo message="Delegator = default#${tenantId}"/> <echo message="Data-readers = ${data-readers}"/> <echo>------------------------------------</echo> - <input addproperty="continueYN" message="Continue Y or N" validargs="N,n,Y,y"/> <java jar="ofbiz.jar" fork="true"> <jvmarg value="${memory.initial.param}"/> <jvmarg value="${memory.max.param}"/> Modified: ofbiz/branches/20120329_portletWidget/common.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/common.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/common.xml (original) +++ ofbiz/branches/20120329_portletWidget/common.xml Tue Jun 19 21:36:11 2012 @@ -134,7 +134,7 @@ under the License. <taskdef resource="tasks.properties"> <classpath> <fileset dir="${ofbiz.home.dir}/framework/base/lib"> - <include name="cobertura-1.9.3.jar" /> + <include name="cobertura-1.9.4.1.jar" /> <include name="log4j-1.2.16.jar" /> </fileset> <fileset dir="${ofbiz.home.dir}/framework/base/lib/scripting"> Modified: ofbiz/branches/20120329_portletWidget/debian/move-files.pl URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/debian/move-files.pl?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/debian/move-files.pl (original) +++ ofbiz/branches/20120329_portletWidget/debian/move-files.pl Tue Jun 19 21:36:11 2012 @@ -25,8 +25,8 @@ use File::Copy; my %dirs; my %bases = ( - 'ofbiz' => 'debian/ofbiz', - 'specialpurpose' => 'debian/ofbiz-specialpurpose', + 'ofbiz' => 'debian/ofbiz', + 'specialpurpose' => 'debian/ofbiz-specialpurpose', ); my $appDirsRe = qw/(applications|framework|specialpurpose)/; @@ -48,7 +48,6 @@ framework/example/webapp/webapp.txt framework/logs/README framework/images/webapp/images/catalog/dirholder.txt framework/appserver/README -framework/shark/lib/README framework/data/README README .classpath @@ -66,132 +65,132 @@ my @unknown; my %scripts; sub basename($) { - my $target = $_[0]; - $target =~ s,/[^/]+$,,; - return $target; + my $target = $_[0]; + $target =~ s,/[^/]+$,,; + return $target; } sub _mkdir($) { - return mkdir($_[0]) || !system('mkdir', '-p', $_[0]); + return mkdir($_[0]) || !system('mkdir', '-p', $_[0]); } sub copylink($$$) { - my ($base, $destdir, $file) = @_; - my $target = "$base$destdir/$file"; - #print("Symlinking ($file) ($target)\n"); - if (-f $file) { - _mkdir(basename($target)) || die("a"); - link($file, $target) || die("b"); - } else { - _mkdir($target) || die("c"); - } - my $symlink = "$base/usr/share/ofbiz/$file"; - _mkdir(basename($symlink)); - symlink("$destdir/$file", $symlink) || die("f: $symlink: $!"); + my ($base, $destdir, $file) = @_; + my $target = "$base$destdir/$file"; + #print("Symlinking ($file) ($target)\n"); + if (-f $file) { + _mkdir(basename($target)) || die("a"); + link($file, $target) || die("b"); + } else { + _mkdir($target) || die("c"); + } + my $symlink = "$base/usr/share/ofbiz/$file"; + _mkdir(basename($symlink)); + symlink("$destdir/$file", $symlink) || die("f: $symlink: $!"); } system('rm', '-rf', 'debian/ofbiz', 'debian/ofbiz-specialpurpose'); open(FIND, '-|', qw(find -not -path */.git/* -not -name .gitignore -printf %P\0)) || die("Couldn't run find"); $/ = "\0"; while (<FIND>) { - chomp; - #print("{$_}\n"); - next if (m,^debian/,); - next if (exists($ignore{$_})); -# next if (m,^(LICENSE|NOTICE|OPTIONAL_LIBRARIES|ant(\.bat)?|\.(project|classpath)|(stop|start)ofbiz\.sh|startofbiz\.bat|(ij|rc)\.ofbiz)$,); - next if (m,(^|.*/)build\.xml$,); - #print("1\n"); - next if (m,^$appDirsRe/[^/]+/(build/classes|src|testdef)/.*,); - next if (m,^$appDirsRe/[^/]+/build/lib/[^/]+-test\.jar$,); - next if (m,^runtime/(catalina/work|data/derby|logs)/.*,); - next if (m,^framework/appserver/templates(|/.*)$,); - next if (m,^\.(hg|pc)(|/.*),); - #print("2\n"); - my $type = undef; - if ($_ eq 'framework/entity/config/entityengine.xml') { - $type = 'ucf'; - } elsif (-f m,(^|.*/)[^/]+\.css$,) { - $type = 'conffile'; - } elsif (m,^$appDirsRe/[^/]+/webapp/.*/WEB-INF/(controller|web|regions)\.xml$,) { - $type = 'conffile'; - } elsif ($_ eq 'specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/facility-controller.xml') { - $type = 'conffile'; - } elsif ($_ eq 'runtime/data/derby.properties') { - $type = 'conffile'; - } elsif (m,^$appDirsRe/[^/]+/email/[^/]+/[^/]+\.ftl$,) { - $type = 'conffile'; - } elsif (m,^$appDirsRe/[^/]+/data/[^/]+\.xml$,) { - $type = 'conffile'; - } elsif (m,^$appDirsRe/[^/]+/ofbiz-component\.xml$,) { - $type = 'conffile'; - } elsif (m,^$appDirsRe/component-load\.xml$,) { - $type = 'conffile'; - } elsif (-f && m,^$appDirsRe/[^/]+/servicedef/services.*\.xml$,) { - $type = 'conffile'; - } elsif (-f && m,^$appDirsRe/[^/]+/(dtd|entitydef|script|servicedef|widget)/.*$,) { - $type = 'code'; - } elsif (m,^$appDirsRe/[^/]+/webapp/.*/[^/]+(\.(bsh|ftl|jsp|gif|htc|ico|jar|jpg|js|png)|(Forms?|Menus)\.xml)$,) { - $type = 'code'; - } elsif (m,^$appDirsRe/[^/]+/webapp/.*/WEB-INF/[^/]+\.tld$,) { - $type = 'code'; - } elsif (-f && m,^$appDirsRe/[^/]+/(config|templates|fieldtype)/.*$,) { - $type = 'conffile'; - } elsif (m,^$appDirsRe/[^/]+/(build/lib/[^/]+\.jar|lib/.*\.jar)$,) { - $type = 'code'; - } elsif (m,^framework/common/webcommon/.*\.ftl$,) { - $type = 'code'; - } elsif (-f && m,^specialpurpose/pos/screens/.*$,) { - $type = 'code'; - } elsif ($_ eq 'startofbiz.sh') { - $type = 'conffile'; - } elsif ($_ eq 'applications/content/template/survey/genericsurvey.ftl') { - $type = 'code'; - } elsif ($_ eq 'ofbiz.jar') { - $type = 'code'; - } elsif (-f && m,^runtime/(logs|catalina|data)/README$,) { - next; - } elsif ($_ eq 'runtime/catalina/catalina-users.xml') { - $type = 'varlib'; - } elsif (m,^runtime/catalina/[^/]+$,) { - $type = 'varcache'; - } elsif (-d && $_ eq 'runtime/logs') { - $type = 'varlog'; - } elsif (m,^runtime/logs/.*$,) { - next; - } elsif (-d && m,^runtime/tmp$,) { - $type = 'varlib'; - } elsif (m,^runtime/(data|output)/.*$,) { - $type = 'varlib'; - } elsif (-f) { - $type = 'code'; - } elsif ($_ eq 'rc.ofbiz.for.debian') { - next; - } else { - next; - } - my $pkg; - if (m,^specialpurpose/.*,) { - $pkg = 'ofbiz-specialpurpose'; - } elsif (m,^applications/.*,) { - $pkg = 'ofbiz-applications'; - } else { - $pkg = 'ofbiz-framework'; - } - my $base = 'debian/' . $pkg; - my $file = $_; - print(STDERR "$type: $file\n") if ($file =~ m/^.*runtime.*/); - if ($type eq 'code') { - my $target = "$base/usr/share/ofbiz/$file"; - #print("Copying ($file) ($target)\n"); - _mkdir(basename($target)) || die("1"); - link($file, $target) || die("2"); - } elsif ($type eq 'conffile') { # && $file =~ m,^.*/(ofbiz-component|component-load|data/.*)\.xml$,) { - copylink($base, '/etc/ofbiz', $file); - } elsif ($type eq 'ucf') { - copylink($base, '/etc/ofbiz', $file); - _mkdir(basename("$base/usr/share/ofbiz/ucf/$file")); - rename("$base/etc/ofbiz/$file", "$base/usr/share/ofbiz/ucf/$file"); - my $postinst = <<_EOF_; + chomp; + #print("{$_}\n"); + next if (m,^debian/,); + next if (exists($ignore{$_})); +# next if (m,^(LICENSE|NOTICE|OPTIONAL_LIBRARIES|ant(\.bat)?|\.(project|classpath)|(stop|start)ofbiz\.sh|startofbiz\.bat|(ij|rc)\.ofbiz)$,); + next if (m,(^|.*/)build\.xml$,); + #print("1\n"); + next if (m,^$appDirsRe/[^/]+/(build/classes|src|testdef)/.*,); + next if (m,^$appDirsRe/[^/]+/build/lib/[^/]+-test\.jar$,); + next if (m,^runtime/(catalina/work|data/derby|logs)/.*,); + next if (m,^framework/appserver/templates(|/.*)$,); + next if (m,^\.(hg|pc)(|/.*),); + #print("2\n"); + my $type = undef; + if ($_ eq 'framework/entity/config/entityengine.xml') { + $type = 'ucf'; + } elsif (-f m,(^|.*/)[^/]+\.css$,) { + $type = 'conffile'; + } elsif (m,^$appDirsRe/[^/]+/webapp/.*/WEB-INF/(controller|web|regions)\.xml$,) { + $type = 'conffile'; + } elsif ($_ eq 'specialpurpose/assetmaint/webapp/assetmaint/WEB-INF/facility-controller.xml') { + $type = 'conffile'; + } elsif ($_ eq 'runtime/data/derby.properties') { + $type = 'conffile'; + } elsif (m,^$appDirsRe/[^/]+/email/[^/]+/[^/]+\.ftl$,) { + $type = 'conffile'; + } elsif (m,^$appDirsRe/[^/]+/data/[^/]+\.xml$,) { + $type = 'conffile'; + } elsif (m,^$appDirsRe/[^/]+/ofbiz-component\.xml$,) { + $type = 'conffile'; + } elsif (m,^$appDirsRe/component-load\.xml$,) { + $type = 'conffile'; + } elsif (-f && m,^$appDirsRe/[^/]+/servicedef/services.*\.xml$,) { + $type = 'conffile'; + } elsif (-f && m,^$appDirsRe/[^/]+/(dtd|entitydef|script|servicedef|widget)/.*$,) { + $type = 'code'; + } elsif (m,^$appDirsRe/[^/]+/webapp/.*/[^/]+(\.(bsh|ftl|jsp|gif|htc|ico|jar|jpg|js|png)|(Forms?|Menus)\.xml)$,) { + $type = 'code'; + } elsif (m,^$appDirsRe/[^/]+/webapp/.*/WEB-INF/[^/]+\.tld$,) { + $type = 'code'; + } elsif (-f && m,^$appDirsRe/[^/]+/(config|templates|fieldtype)/.*$,) { + $type = 'conffile'; + } elsif (m,^$appDirsRe/[^/]+/(build/lib/[^/]+\.jar|lib/.*\.jar)$,) { + $type = 'code'; + } elsif (m,^framework/common/webcommon/.*\.ftl$,) { + $type = 'code'; + } elsif (-f && m,^specialpurpose/pos/screens/.*$,) { + $type = 'code'; + } elsif ($_ eq 'startofbiz.sh') { + $type = 'conffile'; + } elsif ($_ eq 'applications/content/template/survey/genericsurvey.ftl') { + $type = 'code'; + } elsif ($_ eq 'ofbiz.jar') { + $type = 'code'; + } elsif (-f && m,^runtime/(logs|catalina|data)/README$,) { + next; + } elsif ($_ eq 'runtime/catalina/catalina-users.xml') { + $type = 'varlib'; + } elsif (m,^runtime/catalina/[^/]+$,) { + $type = 'varcache'; + } elsif (-d && $_ eq 'runtime/logs') { + $type = 'varlog'; + } elsif (m,^runtime/logs/.*$,) { + next; + } elsif (-d && m,^runtime/tmp$,) { + $type = 'varlib'; + } elsif (m,^runtime/(data|output)/.*$,) { + $type = 'varlib'; + } elsif (-f) { + $type = 'code'; + } elsif ($_ eq 'rc.ofbiz.for.debian') { + next; + } else { + next; + } + my $pkg; + if (m,^specialpurpose/.*,) { + $pkg = 'ofbiz-specialpurpose'; + } elsif (m,^applications/.*,) { + $pkg = 'ofbiz-applications'; + } else { + $pkg = 'ofbiz-framework'; + } + my $base = 'debian/' . $pkg; + my $file = $_; + print(STDERR "$type: $file\n") if ($file =~ m/^.*runtime.*/); + if ($type eq 'code') { + my $target = "$base/usr/share/ofbiz/$file"; + #print("Copying ($file) ($target)\n"); + _mkdir(basename($target)) || die("1"); + link($file, $target) || die("2"); + } elsif ($type eq 'conffile') { # && $file =~ m,^.*/(ofbiz-component|component-load|data/.*)\.xml$,) { + copylink($base, '/etc/ofbiz', $file); + } elsif ($type eq 'ucf') { + copylink($base, '/etc/ofbiz', $file); + _mkdir(basename("$base/usr/share/ofbiz/ucf/$file")); + rename("$base/etc/ofbiz/$file", "$base/usr/share/ofbiz/ucf/$file"); + my $postinst = <<_EOF_; trap 'rm -f "\$tmpconffile"' EXIT tmpconffile=`tempfile -m 644` munge_conffile "\$tmpconffile" "$file" @@ -200,33 +199,33 @@ ucfr ofbiz /etc/ofbiz/$file rm -f "\$tmpconffile" trap '' EXIT _EOF_ - push(@{$scripts{$pkg}->{'postinst'}->{'configure'}}, $postinst); - my $postrm = <<_EOF_; + push(@{$scripts{$pkg}->{'postinst'}->{'configure'}}, $postinst); + my $postrm = <<_EOF_; for ext in '~' '%' .bak .dpkg-tmp .dpkg-new .dpkg-old .dpkg-dist; do rm -f /etc/ofbiz/$file\$ext; done rm -f /etc/ofbiz/$file if which ucf >/dev/null; then ucf --debconf-ok --purge /etc/ofbiz/$file; fi if which ucfr >/dev/null; then ucfr --purge ofbiz /etc/ofbiz/$file; fi _EOF_ - push(@{$scripts{$pkg}->{'postrm'}->{'purge'}}, $postrm); - } elsif ($type =~ m/^var(cache|lib|log|tmp)$/) { - my $new = "/var/$1/ofbiz"; - copylink($base, $new, $file); - my $postrm = <<_EOF_; + push(@{$scripts{$pkg}->{'postrm'}->{'purge'}}, $postrm); + } elsif ($type =~ m/^var(cache|lib|log|tmp)$/) { + my $new = "/var/$1/ofbiz"; + copylink($base, $new, $file); + my $postrm = <<_EOF_; if dpkg-statoverride --list "$new/$file" > /dev/null; then dpkg-statoverride --remove "$new/$file"; fi rm -rf "$new/$file" _EOF_ - push(@{$scripts{$pkg}->{'postrm'}->{'purge'}}, $postrm); - my $postinst = <<_EOF_; + push(@{$scripts{$pkg}->{'postrm'}->{'purge'}}, $postrm); + my $postinst = <<_EOF_; if ! dpkg-statoverride --list "$new/$file" > /dev/null; then - dpkg-statoverride --add ofbiz ofbiz 2775 "$new/$file" - chown ofbiz:ofbiz "$new/$file" - chmod 2755 "$new/$file" + dpkg-statoverride --add ofbiz ofbiz 2775 "$new/$file" + chown ofbiz:ofbiz "$new/$file" + chmod 2755 "$new/$file" fi _EOF_ - push(@{$scripts{$pkg}->{'postinst'}->{'configure'}}, $postinst); - } else { - die("Unknown type($type) on file($file)"); - } + push(@{$scripts{$pkg}->{'postinst'}->{'configure'}}, $postinst); + } else { + die("Unknown type($type) on file($file)"); + } } @@ -234,24 +233,24 @@ close(FIND); my $postinst = ''; push(@{$scripts{'ofbiz-framework'}->{'postinst'}->{'configure'}}, $postinst); foreach my $pkg (keys(%scripts)) { - foreach my $script (keys(%{$scripts{$pkg}})) { - open(SCRIPT, ">> debian/$pkg.$script.debhelper"); - print(SCRIPT "case \"\$1\" in\n"); - my $segments = $scripts{$pkg}->{$script}; - foreach my $arg (keys(%$segments)) { - my $label = $arg; - if ($label eq 'configure') { - print(SCRIPT "\t(reconfigure|configure)\n"); - } elsif ($arg =~ m/[\s|]/) { - print(SCRIPT "\t(\"$arg\")\n"); - } else { - print(SCRIPT "\t($arg)\n"); - } - print(SCRIPT join('', map("\t\t$_\n", split(/\n/, join("\n", @{$segments->{$arg}}))))); - print(SCRIPT "\t;;\n"); - } - print(SCRIPT "esac\n"); - close(SCRIPT); - } + foreach my $script (keys(%{$scripts{$pkg}})) { + open(SCRIPT, ">> debian/$pkg.$script.debhelper"); + print(SCRIPT "case \"\$1\" in\n"); + my $segments = $scripts{$pkg}->{$script}; + foreach my $arg (keys(%$segments)) { + my $label = $arg; + if ($label eq 'configure') { + print(SCRIPT "\t(reconfigure|configure)\n"); + } elsif ($arg =~ m/[\s|]/) { + print(SCRIPT "\t(\"$arg\")\n"); + } else { + print(SCRIPT "\t($arg)\n"); + } + print(SCRIPT join('', map("\t\t$_\n", split(/\n/, join("\n", @{$segments->{$arg}}))))); + print(SCRIPT "\t;;\n"); + } + print(SCRIPT "esac\n"); + close(SCRIPT); + } } print(join('', map("$_\n", @unknown))); Modified: ofbiz/branches/20120329_portletWidget/framework/base/config/both-containers.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/config/both-containers.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/config/both-containers.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/config/both-containers.xml Tue Jun 19 21:36:11 2012 @@ -76,19 +76,6 @@ under the License. </container> --> - <!-- load Shark Workflow Engine --> - <!-- NOTE: before uncommenting this please see the instructions in the ofbiz/OPTIONAL_LIBRARIES file. - <container name="shark-container" class="org.ofbiz.shark.container.SharkContainer"> - <property name="engine-name" value="Shark"/> - <property name="delegator-name" value="default"/> - <property name="dispatcher-name" value="WFDispatcher"/> - <property name="admin-user" value="system"/> - <property name="admin-pass" value="ofbiz"/> - <property name="iiop-host" value="127.0.0.1"/> - <property name="iiop-port" value="2000"/> - </container> - --> - <!-- load catalina (tomcat) and all web applications --> <container name="catalina-container" class="org.ofbiz.catalina.container.CatalinaContainer"> <!-- static configuration for tomcat --> Modified: ofbiz/branches/20120329_portletWidget/framework/base/config/log4j.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/config/log4j.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/config/log4j.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/config/log4j.xml Tue Jun 19 21:36:11 2012 @@ -31,7 +31,7 @@ <appender-ref ref="ofbiz-html"/> <appender-ref ref="debug"/> <appender-ref ref="error"/> - <!--<appender-ref ref="socket"/>--> + <!-- <appender-ref ref="socket"/> --> <!-- <appender-ref ref="email"/> --> </appender> @@ -47,7 +47,7 @@ <appender name="ofbiz-file" class="org.apache.log4j.RollingFileAppender"> <param name="maxFileSize" value="1000KB"/> <param name="maxBackupIndex" value="10"/> - <param name="File" value="runtime/logs/ofbiz.log"/> + <param name="File" value="${ofbiz.home}/runtime/logs/ofbiz.log"/> <param name="threshold" value="info"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d (%t) [%24F:%-3L:%-5p]%x %m%n"/> @@ -58,7 +58,7 @@ <appender name="ofbiz-html" class="org.apache.log4j.RollingFileAppender"> <param name="maxFileSize" value="500KB"/> <param name="maxBackupIndex" value="1"/> - <param name="File" value="runtime/logs/ofbiz.html"/> + <param name="File" value="${ofbiz.home}/runtime/logs/ofbiz.html"/> <param name="threshold" value="info"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="<div class="%p">%d (%t) [%24F:%-3L:%-5p]%x %m </div>%n"/> @@ -69,7 +69,7 @@ <appender name="debug" class="org.apache.log4j.RollingFileAppender"> <param name="maxFileSize" value="10000KB"/> <param name="maxBackupIndex" value="10"/> - <param name="File" value="runtime/logs/debug.log"/> + <param name="File" value="${ofbiz.home}/runtime/logs/debug.log"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d (%t) [%24F:%-3L:%-5p]%x %m%n"/> @@ -85,7 +85,7 @@ <appender name="error" class="org.apache.log4j.RollingFileAppender"> <param name="maxFileSize" value="10000KB"/> <param name="maxBackupIndex" value="10"/> - <param name="File" value="runtime/logs/error.log"/> + <param name="File" value="${ofbiz.home}/runtime/logs/error.log"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d (%t) [%24F:%-3L:%-5p]%x %m%n"/> @@ -97,17 +97,6 @@ </filter> </appender> - <!-- special minerva log --> - <appender name="minerva-log" class="org.apache.log4j.RollingFileAppender"> - <param name="maxFileSize" value="5000KB"/> - <param name="maxBackupIndex" value="10"/> - <param name="File" value="runtime/logs/minerva.log"/> - <param name="Append" value="false"/> - <layout class="org.apache.log4j.PatternLayout"> - <param name="ConversionPattern" value="%d (%t) [%24F:%-3L:%-5p]%x %m%n"/> - </layout> - </appender> - <!-- chainsaw remote socket log monitor --> <appender name="socket" class="org.apache.log4j.net.SocketHubAppender"> <param name="port" value="4445"/> @@ -126,11 +115,11 @@ </layout> </appender> - <!-- special fop log --> + <!-- special appenders for subcomponents --> <appender name="fop-log" class="org.apache.log4j.RollingFileAppender"> <param name="maxFileSize" value="5000KB"/> <param name="maxBackupIndex" value="10"/> - <param name="File" value="runtime/logs/fop.log"/> + <param name="File" value="${ofbiz.home}/runtime/logs/fop.log"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d (%t) [%24F:%-3L:%-5p]%x %m%n"/> @@ -140,7 +129,17 @@ <appender name="freemarker-log" class="org.apache.log4j.RollingFileAppender"> <param name="maxFileSize" value="5000KB"/> <param name="maxBackupIndex" value="10"/> - <param name="File" value="runtime/logs/freemarker.log"/> + <param name="File" value="${ofbiz.home}/runtime/logs/freemarker.log"/> + <param name="Append" value="false"/> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%d (%t) [%24F:%-3L:%-5p]%x %m%n"/> + </layout> + </appender> + + <appender name="tomcat-log" class="org.apache.log4j.RollingFileAppender"> + <param name="maxFileSize" value="5000KB"/> + <param name="maxBackupIndex" value="10"/> + <param name="File" value="${ofbiz.home}/runtime/logs/tomcat.log"/> <param name="Append" value="false"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d (%t) [%24F:%-3L:%-5p]%x %m%n"/> @@ -155,10 +154,6 @@ <priority value="warn"/> </category> - <category name="org.apache.catalina"> - <priority value="warn"/> - </category> - <category name="org.apache.commons.digester"> <priority value="warn"/> </category> @@ -175,30 +170,22 @@ <priority value="warn"/> </category> - <!-- log4j category --> - <category name="org.apache.log4j"> + <category name="org.apache.geronimo.transaction"> <priority value="warn"/> </category> - <category name="org.apache.tomcat"> + <category name="org.apache.log4j"> <priority value="warn"/> </category> - <!-- log minerva to the special log > - <category name="org.ofbiz.minerva"> - <priority value="warn"/> - <appender-ref ref="minerva-log"/> - </category--> - - <!-- geronimo transaction logging --> - <category name="org.apache.geronimo.transaction"> + <!-- special category/loggers --> + <category name="org.apache.catalina"> <priority value="warn"/> - <appender-ref ref="minerva-log"/> + <appender-ref ref="tomcat-log"/> </category> - <!-- fop rendering logging --> <category name="org.apache.fop"> - <priority value="info"/> + <priority value="warn"/> <appender-ref ref="fop-log"/> </category> Modified: ofbiz/branches/20120329_portletWidget/framework/base/config/ofbiz-containers.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/config/ofbiz-containers.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/config/ofbiz-containers.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/config/ofbiz-containers.xml Tue Jun 19 21:36:11 2012 @@ -74,6 +74,13 @@ under the License. </container> --> + <!-- Load embedded Jackrabbit content repository. Since this container depends + upon JNDI, it must be started after the naming-container container.--> + <container name="jcr-container" class="org.ofbiz.jcr.loader.JCRContainer"> + <property name="configFilePath" value="framework/jcr/config/jcr-config.xml"/> + <property name="removeOnShutdown" value="false"/> + </container> + <!-- load catalina (tomcat) and all web applications --> <container name="catalina-container" class="org.ofbiz.catalina.container.CatalinaContainer"> <!-- static configuration for tomcat --> Modified: ofbiz/branches/20120329_portletWidget/framework/base/config/rmi-containers.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/config/rmi-containers.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/config/rmi-containers.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/config/rmi-containers.xml Tue Jun 19 21:36:11 2012 @@ -69,17 +69,4 @@ under the License. </container> --> - <!-- load Shark Workflow Engine --> - <!-- NOTE: before uncommenting this please see the instructions in the ofbiz/OPTIONAL_LIBRARIES file. - <container name="shark-container" class="org.ofbiz.shark.container.SharkContainer"> - <property name="engine-name" value="Shark"/> - <property name="delegator-name" value="default"/> - <property name="dispatcher-name" value="WFDispatcher"/> - <property name="admin-user" value="system"/> - <property name="admin-pass" value="ofbiz"/> - <property name="iiop-host" value="127.0.0.1"/> - <property name="iiop-port" value="2000"/> - </container> - --> - </ofbiz-containers> Modified: ofbiz/branches/20120329_portletWidget/framework/base/config/test-containers.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/config/test-containers.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/config/test-containers.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/config/test-containers.xml Tue Jun 19 21:36:11 2012 @@ -50,6 +50,13 @@ under the License. <property name="ssl-client-auth" value="true"/> </container> + <!-- Load embedded Jackrabbit content repository. Since this container depends + upon JNDI, it must be started after the naming-container container.--> + <container name="jcr-container" class="org.ofbiz.jcr.loader.JCRContainer"> + <property name="configFilePath" value="framework/jcr/config/jcr-test-config.xml"/> + <property name="removeRepositoryOnShutdown" value="true"/> + </container> + <!-- load catalina (tomcat) and all web applications --> <container name="catalina-container" class="org.ofbiz.catalina.container.CatalinaContainer"> <!-- static configuration for tomcat --> Propchange: ofbiz/branches/20120329_portletWidget/framework/base/lib/ ------------------------------------------------------------------------------ --- svn:ignore (original) +++ svn:ignore Tue Jun 19 21:36:11 2012 @@ -1,2 +1,5 @@ plugin.jar -cobertura-1.9.3.jar +cobertura-1.9.4.1.jar +asm-3.0.jar +oro-2.0.8.jar +asm-tree-3.0.jar Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/config/ResourceLoader.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/config/ResourceLoader.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/config/ResourceLoader.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/config/ResourceLoader.java Tue Jun 19 21:36:11 2012 @@ -35,7 +35,7 @@ import org.w3c.dom.Element; public abstract class ResourceLoader { public static final String module = ResourceLoader.class.getName(); - protected static UtilCache<String, Object> loaderCache = UtilCache.createUtilCache("resource.ResourceLoaders", 0, 0); + private static final UtilCache<String, Object> loaderCache = UtilCache.createUtilCache("resource.ResourceLoaders", 0, 0); protected String name; protected String prefix; @@ -61,19 +61,14 @@ public abstract class ResourceLoader { ResourceLoader loader = (ResourceLoader) loaderCache.get(xmlFilename + "::" + loaderName); if (loader == null) { - synchronized (ResourceLoader.class) { - loader = (ResourceLoader) loaderCache.get(xmlFilename + "::" + loaderName); - if (loader == null) { - Element rootElement = getXmlRootElement(xmlFilename); - - Element loaderElement = UtilXml.firstChildElement(rootElement, "resource-loader", "name", loaderName); - - loader = makeLoader(loaderElement); - - if (loader != null) { - loaderCache.put(xmlFilename + "::" + loaderName, loader); - } - } + Element rootElement = getXmlRootElement(xmlFilename); + + Element loaderElement = UtilXml.firstChildElement(rootElement, "resource-loader", "name", loaderName); + + loader = makeLoader(loaderElement); + + if (loader != null) { + loader = (ResourceLoader) loaderCache.putIfAbsentAndGet(xmlFilename + "::" + loaderName, loader); } } @@ -98,29 +93,24 @@ public abstract class ResourceLoader { Document document = (Document) loaderCache.get(xmlFilename); if (document == null) { - synchronized (ResourceLoader.class) { - document = (Document) loaderCache.get(xmlFilename); - if (document == null) { - URL confUrl = UtilURL.fromResource(xmlFilename); - - if (confUrl == null) { - throw new GenericConfigException("ERROR: could not find the [" + xmlFilename + "] XML file on the classpath"); - } - - try { - document = UtilXml.readXmlDocument(confUrl); - } catch (org.xml.sax.SAXException e) { - throw new GenericConfigException("Error reading " + xmlFilename + "", e); - } catch (javax.xml.parsers.ParserConfigurationException e) { - throw new GenericConfigException("Error reading " + xmlFilename + "", e); - } catch (java.io.IOException e) { - throw new GenericConfigException("Error reading " + xmlFilename + "", e); - } - - if (document != null) { - loaderCache.put(xmlFilename, document); - } - } + URL confUrl = UtilURL.fromResource(xmlFilename); + + if (confUrl == null) { + throw new GenericConfigException("ERROR: could not find the [" + xmlFilename + "] XML file on the classpath"); + } + + try { + document = UtilXml.readXmlDocument(confUrl); + } catch (org.xml.sax.SAXException e) { + throw new GenericConfigException("Error reading " + xmlFilename + "", e); + } catch (javax.xml.parsers.ParserConfigurationException e) { + throw new GenericConfigException("Error reading " + xmlFilename + "", e); + } catch (java.io.IOException e) { + throw new GenericConfigException("Error reading " + xmlFilename + "", e); + } + + if (document != null) { + document = (Document) loaderCache.putIfAbsentAndGet(xmlFilename, document); } } return document; Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/BshUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/BshUtil.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/BshUtil.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/BshUtil.java Tue Jun 19 21:36:11 2012 @@ -46,7 +46,7 @@ public final class BshUtil { public static final String module = BshUtil.class.getName(); protected static FastMap<ClassLoader, BshClassManager> masterClassManagers = FastMap.newInstance(); - public static UtilCache<String, Interpreter.ParsedScript> parsedScripts = UtilCache.createUtilCache("script.BshLocationParsedCache", 0, 0, false); + private static final UtilCache<String, Interpreter.ParsedScript> parsedScripts = UtilCache.createUtilCache("script.BshLocationParsedCache", 0, 0, false); /** * Evaluate a BSH condition or expression @@ -134,19 +134,14 @@ public final class BshUtil { Interpreter.ParsedScript script = null; script = parsedScripts.get(location); if (script == null) { - synchronized (OfbizBshBsfEngine.class) { - script = parsedScripts.get(location); - if (script == null) { - URL scriptUrl = FlexibleLocation.resolveLocation(location); - if (scriptUrl == null) { - throw new GeneralException("Could not find bsh script at [" + location + "]"); - } - Reader scriptReader = new InputStreamReader(scriptUrl.openStream()); - script = interpreter.parseScript(location, scriptReader); - if (Debug.verboseOn()) Debug.logVerbose("Caching BSH script at: " + location, module); - parsedScripts.put(location, script); - } + URL scriptUrl = FlexibleLocation.resolveLocation(location); + if (scriptUrl == null) { + throw new GeneralException("Could not find bsh script at [" + location + "]"); } + Reader scriptReader = new InputStreamReader(scriptUrl.openStream()); + script = interpreter.parseScript(location, scriptReader); + if (Debug.verboseOn()) Debug.logVerbose("Caching BSH script at: " + location, module); + script = parsedScripts.putIfAbsentAndGet(location, script); } return interpreter.evalParsedScript(script); Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/CompilerMatcher.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/CompilerMatcher.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/CompilerMatcher.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/CompilerMatcher.java Tue Jun 19 21:36:11 2012 @@ -33,7 +33,7 @@ public class CompilerMatcher { public static final String module = CompilerMatcher.class.getName(); - public static UtilCache<String, Pattern> compiledPatterns = UtilCache.createUtilCache("regularExpression.compiledPatterns", false); + private static final UtilCache<String, Pattern> compiledPatterns = UtilCache.createUtilCache("regularExpression.compiledPatterns", false); private Perl5Compiler compiler = new Perl5Compiler(); private Perl5Matcher matcher = new Perl5Matcher(); Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/GroovyUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/GroovyUtil.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/GroovyUtil.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/GroovyUtil.java Tue Jun 19 21:36:11 2012 @@ -46,7 +46,7 @@ public class GroovyUtil { public static final String module = GroovyUtil.class.getName(); - public static UtilCache<String, Class<?>> parsedScripts = UtilCache.createUtilCache("script.GroovyLocationParsedCache", 0, 0, false); + private static final UtilCache<String, Class<?>> parsedScripts = UtilCache.createUtilCache("script.GroovyLocationParsedCache", 0, 0, false); /** * Evaluate a Groovy condition or expression Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/JNDIContextFactory.java Tue Jun 19 21:36:11 2012 @@ -34,7 +34,7 @@ import org.ofbiz.base.util.cache.UtilCac public class JNDIContextFactory { public static final String module = JNDIContextFactory.class.getName(); - static UtilCache<String, InitialContext> contexts = UtilCache.createUtilCache("entity.JNDIContexts", 0, 0); + private static final UtilCache<String, InitialContext> contexts = UtilCache.createUtilCache("entity.JNDIContexts", 0, 0); /** * Return the initial context according to the entityengine.xml parameters that correspond to the given prefix @@ -44,45 +44,39 @@ public class JNDIContextFactory { InitialContext ic = contexts.get(jndiServerName); if (ic == null) { - synchronized (JNDIContextFactory.class) { - ic = contexts.get(jndiServerName); + JNDIConfigUtil.JndiServerInfo jndiServerInfo = JNDIConfigUtil.getJndiServerInfo(jndiServerName); - if (ic == null) { - JNDIConfigUtil.JndiServerInfo jndiServerInfo = JNDIConfigUtil.getJndiServerInfo(jndiServerName); + if (jndiServerInfo == null) { + throw new GenericConfigException("ERROR: no jndi-server definition was found with the name " + jndiServerName + " in jndiservers.xml"); + } + + try { + if (UtilValidate.isEmpty(jndiServerInfo.contextProviderUrl)) { + ic = new InitialContext(); + } else { + Hashtable<String, Object> h = new Hashtable<String, Object>(); + + h.put(Context.INITIAL_CONTEXT_FACTORY, jndiServerInfo.initialContextFactory); + h.put(Context.PROVIDER_URL, jndiServerInfo.contextProviderUrl); + if (UtilValidate.isNotEmpty(jndiServerInfo.urlPkgPrefixes)) + h.put(Context.URL_PKG_PREFIXES, jndiServerInfo.urlPkgPrefixes); + + if (UtilValidate.isNotEmpty(jndiServerInfo.securityPrincipal)) + h.put(Context.SECURITY_PRINCIPAL, jndiServerInfo.securityPrincipal); + if (UtilValidate.isNotEmpty(jndiServerInfo.securityCredentials)) + h.put(Context.SECURITY_CREDENTIALS, jndiServerInfo.securityCredentials); - if (jndiServerInfo == null) { - throw new GenericConfigException("ERROR: no jndi-server definition was found with the name " + jndiServerName + " in jndiservers.xml"); - } - - try { - if (UtilValidate.isEmpty(jndiServerInfo.contextProviderUrl)) { - ic = new InitialContext(); - } else { - Hashtable<String, Object> h = new Hashtable<String, Object>(); - - h.put(Context.INITIAL_CONTEXT_FACTORY, jndiServerInfo.initialContextFactory); - h.put(Context.PROVIDER_URL, jndiServerInfo.contextProviderUrl); - if (UtilValidate.isNotEmpty(jndiServerInfo.urlPkgPrefixes)) - h.put(Context.URL_PKG_PREFIXES, jndiServerInfo.urlPkgPrefixes); - - if (UtilValidate.isNotEmpty(jndiServerInfo.securityPrincipal)) - h.put(Context.SECURITY_PRINCIPAL, jndiServerInfo.securityPrincipal); - if (UtilValidate.isNotEmpty(jndiServerInfo.securityCredentials)) - h.put(Context.SECURITY_CREDENTIALS, jndiServerInfo.securityCredentials); - - ic = new InitialContext(h); - } - } catch (Exception e) { - String errorMsg = "Error getting JNDI initial context for server name " + jndiServerName; - - Debug.logError(e, errorMsg, module); - throw new GenericConfigException(errorMsg, e); - } - - if (ic != null) { - contexts.put(jndiServerName, ic); - } + ic = new InitialContext(h); } + } catch (Exception e) { + String errorMsg = "Error getting JNDI initial context for server name " + jndiServerName; + + Debug.logError(e, errorMsg, module); + throw new GenericConfigException(errorMsg, e); + } + + if (ic != null) { + ic = contexts.putIfAbsentAndGet(jndiServerName, ic); } } Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/OfbizBshBsfEngine.java Tue Jun 19 21:36:11 2012 @@ -61,7 +61,7 @@ public class OfbizBshBsfEngine extends B protected Interpreter interpreter; protected boolean installedApplyMethod; - public static UtilCache<String, Interpreter.ParsedScript> parsedScripts = UtilCache.createUtilCache("script.BshBsfParsedCache", 0, 0, false); + private static final UtilCache<String, Interpreter.ParsedScript> parsedScripts = UtilCache.createUtilCache("script.BshBsfParsedCache", 0, 0, false); @SuppressWarnings("unchecked") @Override @@ -177,14 +177,9 @@ public class OfbizBshBsfEngine extends B if (UtilValidate.isNotEmpty(source)) { script = parsedScripts.get(source); if (script == null) { - synchronized (OfbizBshBsfEngine.class) { - script = parsedScripts.get(source); - if (script == null) { - script = interpreter.parseScript(source, new StringReader((String) expr)); - Debug.logVerbose("Caching BSH script at: " + source, module); - parsedScripts.put(source, script); - } - } + script = interpreter.parseScript(source, new StringReader((String) expr)); + Debug.logVerbose("Caching BSH script at: " + source, module); + script = parsedScripts.putIfAbsentAndGet(source, script); } } else { script = interpreter.parseScript(source, new StringReader((String) expr)); Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/ScriptUtil.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/ScriptUtil.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/ScriptUtil.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/ScriptUtil.java Tue Jun 19 21:36:11 2012 @@ -336,11 +336,11 @@ public final class ScriptUtil { */ public static Object executeScript(String filePath, String functionName, Map<String, Object> context, Object[] args) { try { - /* Enable this to run Groovy data preparation scripts using GroovyUtil rather than the generic JSR223 that doesn't support debug mode + // Enabled to run Groovy data preparation scripts using GroovyUtil rather than the generic JSR223 that doesn't support debug mode + // and does not return a stack trace with line number on error if (filePath.endsWith(".groovy")) { return GroovyUtil.runScriptAtLocation(filePath, functionName, context); } - */ return executeScript(filePath, functionName, createScriptContext(context), args); } catch (Exception e) { String errMsg = "Error running script at location [" + filePath + "]: " + e.toString(); Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/UtilProperties.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/UtilProperties.java Tue Jun 19 21:36:11 2012 @@ -68,12 +68,12 @@ public class UtilProperties implements S /** An instance of the generic cache for storing the non-locale-specific properties. * Each Properties instance is keyed by the resource String. */ - protected static UtilCache<String, Properties> resourceCache = UtilCache.createUtilCache("properties.UtilPropertiesResourceCache"); + private static final UtilCache<String, Properties> resourceCache = UtilCache.createUtilCache("properties.UtilPropertiesResourceCache"); /** An instance of the generic cache for storing the non-locale-specific properties. * Each Properties instance is keyed by the file's URL. */ - protected static UtilCache<String, Properties> urlCache = UtilCache.createUtilCache("properties.UtilPropertiesUrlCache"); + private static final UtilCache<String, Properties> urlCache = UtilCache.createUtilCache("properties.UtilPropertiesUrlCache"); protected static Locale fallbackLocale = null; protected static Set<Locale> defaultCandidateLocales = null; @@ -302,8 +302,7 @@ public class UtilProperties implements S if (url == null) return null; - properties = getProperties(url); - resourceCache.put(cacheKey, properties); + properties = resourceCache.putIfAbsentAndGet(cacheKey, getProperties(url)); } catch (MissingResourceException e) { Debug.logInfo(e, module); } @@ -1006,7 +1005,7 @@ public class UtilProperties implements S * properties file format. */ public static class UtilResourceBundle extends ResourceBundle { - protected static UtilCache<String, UtilResourceBundle> bundleCache = UtilCache.createUtilCache("properties.UtilPropertiesBundleCache"); + private static final UtilCache<String, UtilResourceBundle> bundleCache = UtilCache.createUtilCache("properties.UtilPropertiesBundleCache"); protected Properties properties = null; protected Locale locale = null; protected int hashCode = hashCode(); Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/cache/test/UtilCacheTests.java Tue Jun 19 21:36:11 2012 @@ -344,11 +344,21 @@ public class UtilCacheTests extends Gene Listener<String, String> gotListener = createListener(cache); Listener<String, String> wantedListener = new Listener<String, String>(); wantedListener.noteKeyAddition(cache, "key", "value"); + wantedListener.noteKeyAddition(cache, "anotherKey", "anotherValue"); assertNull("no-get", cache.get("key")); assertEquals("putIfAbsentAndGet", "value", cache.putIfAbsentAndGet("key", "value")); assertHasSingleKey(cache, "key", "value"); assertEquals("putIfAbsentAndGet", "value", cache.putIfAbsentAndGet("key", "newValue")); assertHasSingleKey(cache, "key", "value"); + String anotherValueAddedToCache = new String("anotherValue"); + String anotherValueNotAddedToCache = new String("anotherValue"); + assertEquals(anotherValueAddedToCache, anotherValueNotAddedToCache); + assertNotSame(anotherValueAddedToCache, anotherValueNotAddedToCache); + String cachedValue = cache.putIfAbsentAndGet("anotherKey", anotherValueAddedToCache); + assertSame(cachedValue, anotherValueAddedToCache); + cachedValue = cache.putIfAbsentAndGet("anotherKey", anotherValueNotAddedToCache); + assertNotSame(cachedValue, anotherValueNotAddedToCache); + assertSame(cachedValue, anotherValueAddedToCache); cache.removeListener(gotListener); assertEquals("listener", wantedListener, gotListener); } Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/FreeMarkerWorker.java Tue Jun 19 21:36:11 2012 @@ -75,10 +75,19 @@ public class FreeMarkerWorker { public static final String module = FreeMarkerWorker.class.getName(); // use soft references for this so that things from Content records don't kill all of our memory, or maybe not for performance reasons... hmmm, leave to config file... - public static UtilCache<String, Template> cachedTemplates = UtilCache.createUtilCache("template.ftl.general", 0, 0, false); - private static final BeansWrapper defaultOfbizWrapper = new BeansWrapper(); + private static final UtilCache<String, Template> cachedTemplates = UtilCache.createUtilCache("template.ftl.general", 0, 0, false); + private static final BeansWrapper defaultOfbizWrapper = configureBeansWrapper(new BeansWrapper()); private static final Configuration defaultOfbizConfig = makeConfiguration(defaultOfbizWrapper); + public static BeansWrapper getDefaultOfbizWrapper() { + return defaultOfbizWrapper; + } + + public static <T extends BeansWrapper> T configureBeansWrapper(T wrapper) { + wrapper.setNullWildcards(true); + return wrapper; + } + public static Configuration makeConfiguration(BeansWrapper wrapper) { Configuration newConfig = new Configuration(); @@ -118,10 +127,6 @@ public class FreeMarkerWorker { return newConfig; } - public static BeansWrapper getDefaultOfbizWrapper() { - return defaultOfbizWrapper; - } - /** * Protected helper method. */ @@ -195,49 +200,34 @@ public class FreeMarkerWorker { public static Environment renderTemplateFromString(String templateString, String templateLocation, Map<String, Object> context, Appendable outWriter) throws TemplateException, IOException { Template template = cachedTemplates.get(templateLocation); if (template == null) { - synchronized (cachedTemplates) { - template = cachedTemplates.get(templateLocation); - if (template == null) { - Reader templateReader = new StringReader(templateString); - template = new Template(templateLocation, templateReader, defaultOfbizConfig); - templateReader.close(); - cachedTemplates.put(templateLocation, template); - } - } + Reader templateReader = new StringReader(templateString); + template = new Template(templateLocation, templateReader, defaultOfbizConfig); + templateReader.close(); + template = cachedTemplates.putIfAbsentAndGet(templateLocation, template); } return renderTemplate(template, context, outWriter); } public static Environment renderTemplateFromString(String templateString, String templateLocation, Map<String, Object> context, Appendable outWriter, boolean useCache) throws TemplateException, IOException { Template template = null; - if (useCache){ + if (useCache) { template = cachedTemplates.get(templateLocation); - } - if (template == null) { - if (useCache){ - synchronized (cachedTemplates) { - template = cachedTemplates.get(templateLocation); - if (template == null) { - Reader templateReader = new StringReader(templateString); - template = new Template(templateLocation, templateReader, defaultOfbizConfig); - templateReader.close(); - cachedTemplates.put(templateLocation, template); - } - } - } else { + if (template == null) { Reader templateReader = new StringReader(templateString); template = new Template(templateLocation, templateReader, defaultOfbizConfig); templateReader.close(); + template = cachedTemplates.putIfAbsentAndGet(templateLocation, template); } + } else { + Reader templateReader = new StringReader(templateString); + template = new Template(templateLocation, templateReader, defaultOfbizConfig); + templateReader.close(); } - return renderTemplate(template, context, outWriter); } public static void clearTemplateFromCache(String templateLocation) { - synchronized (cachedTemplates) { - cachedTemplates.remove(templateLocation); - } + cachedTemplates.remove(templateLocation); } /** @@ -336,16 +326,11 @@ public class FreeMarkerWorker { public static Template getTemplate(String templateLocation, UtilCache<String, Template> cache, Configuration config) throws TemplateException, IOException { Template template = cache.get(templateLocation); if (template == null) { - synchronized (cache) { - template = cache.get(templateLocation); - if (template == null) { - // only make the reader if we need it, and then close it right after! - Reader templateReader = makeReader(templateLocation); - template = new Template(templateLocation, templateReader, config); - templateReader.close(); - cache.put(templateLocation, template); - } - } + // only make the reader if we need it, and then close it right after! + Reader templateReader = makeReader(templateLocation); + template = new Template(templateLocation, templateReader, config); + templateReader.close(); + template = cache.putIfAbsentAndGet(templateLocation, template); } return template; } Modified: ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/XslTransform.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/XslTransform.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/XslTransform.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/base/src/org/ofbiz/base/util/template/XslTransform.java Tue Jun 19 21:36:11 2012 @@ -56,7 +56,7 @@ import javax.xml.transform.stream.Stream public final class XslTransform { public static final String module = XslTransform.class.getName(); - public static UtilCache<String, Templates> xslTemplatesCache = UtilCache.createUtilCache("XsltTemplates", 0, 0); + private static final UtilCache<String, Templates> xslTemplatesCache = UtilCache.createUtilCache("XsltTemplates", 0, 0); /** * @param template the content or url of the xsl template @@ -116,7 +116,7 @@ public final class XslTransform { Source templateSource = getSource(templateDocument, templateUrl, templateString); translet = tFactory.newTemplates(templateSource); if (UtilValidate.isNotEmpty(templateName)) { - xslTemplatesCache.put(templateName, translet); + translet = xslTemplatesCache.putIfAbsentAndGet(templateName, translet); } } if (translet != null) { Modified: ofbiz/branches/20120329_portletWidget/framework/bi/ofbiz-component.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/bi/ofbiz-component.xml?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/bi/ofbiz-component.xml (original) +++ ofbiz/branches/20120329_portletWidget/framework/bi/ofbiz-component.xml Tue Jun 19 21:36:11 2012 @@ -25,7 +25,7 @@ under the License. <classpath type="dir" location="config"/> <classpath type="jar" location="build/lib/*"/> <entity-resource type="data" reader-name="seed" loader="main" location="data/BiTypeData.xml"/> - <entity-resource type="data" reader-name="seed" loader="main" location="data/BiSecurityData.xml"/> + <entity-resource type="data" reader-name="security" loader="main" location="data/BiSecurityData.xml"/> <service-resource type="model" loader="main" location="servicedef/services.xml"/> Modified: ofbiz/branches/20120329_portletWidget/framework/birt/src/org/ofbiz/birt/BirtWorker.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/framework/birt/src/org/ofbiz/birt/BirtWorker.java?rev=1351866&r1=1351865&r2=1351866&view=diff ============================================================================== --- ofbiz/branches/20120329_portletWidget/framework/birt/src/org/ofbiz/birt/BirtWorker.java (original) +++ ofbiz/branches/20120329_portletWidget/framework/birt/src/org/ofbiz/birt/BirtWorker.java Tue Jun 19 21:36:11 2012 @@ -140,7 +140,7 @@ public class BirtWorker { /** * set web context objects - * @param engine + * @param appContext * @param request * @param response */ |
| Free forum by Nabble | Edit this page |
