You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by an...@apache.org on 2014/10/16 12:16:58 UTC
svn commit: r1632265 [1/5] - in /myfaces/trinidad/trunk:
trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/util/
trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/
trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/ tr...
Author: andys
Date: Thu Oct 16 10:16:54 2014
New Revision: 1632265
URL: http://svn.apache.org/r1632265
Log:
TRINIDAD-2515 Avoid caching skins from external SkinProviders and make LRU cache concurrent
Thanks for the patch Anand.
Added:
myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/ConcurrentMapTestCase.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/CopyOnWriteArrayMap.java
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/skin/custom/
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/skin/custom/CustomSkinProvider1.java
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/skin/custom/CustomSkinProvider2.java
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/skin/provider/
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/skin/provider/SkinProviderTest.java
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/util/CopyOnWriteArrayMapTest.java
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/util/LRUCopyOnWriteArrayMapTest.java
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/META-INF/services/org.apache.myfaces.trinidad.skin.SkinProvider
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/META-INF/trinidad-skins.xml
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/CustomStyles.css
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/beach.css
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnBottom-bg.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnDisabledBottom-bg.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnDisabledEnd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnDisabledStart.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnDisabledTop-bg.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnEnd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnStart.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/btnTop-bg.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/checkdc.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/checkdn.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/checkrc.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/checkrn.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/document.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/errorl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/infol.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/jdev.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/menuBar-bg.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/menuTabsEnabledBackground.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/menuTabsSelectedBackground.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/otn_logo_small.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/searchPanelGroup-bg.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-bot-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-bot-end-selected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-bot-mid-selected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-bot-start-selected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-end-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-end-join-deselected-to-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-end-join-selected-to-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-end-selected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-mid-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-mid-selected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-start-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-start-join-deselected-to-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-start-join-selected-to-deselected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-start-join-selected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/tabbeach-start-selected.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/warnl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/yellow-folder-closed.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/beach/images/yellow-folder-open.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btnbb.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btndbb.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btnde.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btnds.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btndtb.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btne.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btns.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/btntb.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/checkdc.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/checkdn.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/checkrc.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/checkrn.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/collapsed.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/dateButtonPurple.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/dateButtonPurpleRTL.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/errorl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/expanded.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/infol.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsEnabledBackground.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsEnabledBackgroundGrdt.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsEnabledEnd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsEnabledJoin.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsEnabledSelectedJoin.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsEnabledStart.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsSelectedBackground.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsSelectedEnabledJoin.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsSelectedEnd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/menuTabsSelectedStart.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/next.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/nextDisabled.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/panelBoxEnd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/panelBoxStart.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/prev.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/prevDisabled.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/shuttleOrderBottom.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/shuttleOrderDown.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/shuttleOrderTop.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/shuttleOrderUp.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/images/warnl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/purpleBigFontSkin.css
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/purpleBigFontSkinFour.css
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/purpleBigFontSkinThree.css
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/purpleBigFontSkinTwo.css
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/purple/purpleSkin.css
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/asort.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/bltdscn.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/bltdscs.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/cccdts.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/ccclts.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/cccmts.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/ccctts.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/cfso.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/cseparator.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/cseparator4x.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/csnb.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/csnbld.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/csnbr.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/ctruj.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/ctrumore.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/dp.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/dprtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/dsort.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/err.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/errorl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/focus.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/hgrid_crumbs.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/hsd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/hsu.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/info.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/lovi.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/lovirtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd0.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd10.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd100.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd10rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd15.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd15rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd20.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd20rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd25.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd25rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd30.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd30rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd35.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd35rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd40.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd40rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd45.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd45rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd5.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd50.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd50rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd55.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd55rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd5rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd60.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd60rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd65.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd65rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd70.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd70rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd75.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd75rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd80.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd80rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd85.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd85rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd90.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd90rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd95.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsInd95rtl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/pgsIndAnm.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/smv.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/smvall.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/srb.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/srd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/srmv.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/srmvall.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/srt.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/sru.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/t.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tfold.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tip.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tline.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tminusa.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tnavn.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tnavnd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tnavp.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tnavpd.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/tplusa.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trUnVisStop.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trVisStop.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trVisStopA.png (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trprev.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trsubl.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trsubr.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trvj.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/trvmore.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/images/warn.gif (with props)
myfaces/trinidad/trunk/trinidad-impl/src/test/resources/org/apache/myfaces/trinidadinternal/skin/suede/suede.css
Modified:
myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/util/ValueMapTest.java
myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/ArrayMapTest.java
myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MapTestCase.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/image/cache/CacheUtils.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseSkin.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/BaseSkinProvider.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/SkinProviderRegistry.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/TrinidadSkinProvider.java
myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/style/util/CSSUtils.java
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java
myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/util/SubKeyMapTest.java
Modified: myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/util/ValueMapTest.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/util/ValueMapTest.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/util/ValueMapTest.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/bean/util/ValueMapTest.java Thu Oct 16 10:16:54 2014
@@ -56,4 +56,11 @@ public class ValueMapTest extends org.ap
{
return new ValueMap(new TestBean());
}
+
+ @Override
+ protected Map<LameKey, Object> createMapWithLameKey()
+ {
+ return null;
+ }
+
}
Modified: myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/ArrayMapTest.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/ArrayMapTest.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/ArrayMapTest.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidad/util/ArrayMapTest.java Thu Oct 16 10:16:54 2014
@@ -43,4 +43,10 @@ public class ArrayMapTest extends org.ap
{
return new ArrayMap<String, Object>();
}
+
+ @Override
+ protected Map<LameKey, Object> createMapWithLameKey()
+ {
+ return new ArrayMap<LameKey, Object>();
+ }
}
Added: myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/ConcurrentMapTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/ConcurrentMapTestCase.java?rev=1632265&view=auto
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/ConcurrentMapTestCase.java (added)
+++ myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/ConcurrentMapTestCase.java Thu Oct 16 10:16:54 2014
@@ -0,0 +1,139 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.trinidadbuild.test;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+public abstract class ConcurrentMapTestCase extends MapTestCase
+{
+ public ConcurrentMapTestCase(String testName)
+ {
+ super(testName);
+ }
+
+ public void testRemoveKeyValue()
+ {
+ ConcurrentMap<String, Object> cache = createMap();
+ _putTwo(cache);
+ boolean bool = cache.remove(A_STR, "aStr");
+ assertFalse(bool);
+ assertEquals("Remove operation did not work as expected.", 2, cache.size());
+ assertNotNull("Entry with key 'aaa' expected to be available.",
+ cache.get(A_STR));
+ bool = cache.remove(A_STR, ONE);
+ assertTrue(bool);
+ assertEquals("Remove operation did not work as expected.", 1, cache.size());
+ assertNull("Entry with key 'aaa' expected to be removed.",
+ cache.get(A_STR));
+ }
+
+ public void testReplace()
+ {
+ ConcurrentMap<String, Object> cache = createMap();
+ _putTwo(cache);
+ Object val = cache.replace(C_STR, ONE);
+ assertNull(val);
+ assertEquals("Replace operation did not work as expected.", 2, cache.size());
+ assertEquals(ONE, cache.get(A_STR));
+ assertEquals(TWO, cache.get(B_STR));
+
+ val = cache.replace(A_STR, "aaaString");
+ assertEquals(ONE, val);
+ assertEquals("Replace operation did not work as expected.", 2, cache.size());
+ assertEquals("aaaString", cache.get(A_STR));
+
+ boolean bool = cache.replace(B_STR, "bb", "newValue");
+ assertFalse(bool);
+ assertEquals("Replace operation did not work as expected.", 2, cache.size());
+ assertEquals(TWO, cache.get(B_STR));
+
+ bool = cache.replace(B_STR, TWO, "newValue");
+ assertTrue(bool);
+ assertEquals("Replace operation did not work as expected.", 2, cache.size());
+ assertEquals("newValue", cache.get(B_STR));
+ }
+
+ public void testPutIfAbsent()
+ {
+ ConcurrentMap<String, Object> cache = createMap();
+ Object val = cache.putIfAbsent(A_STR, ONE);
+ assertEquals("putIfAbsent operation did not work as expected.", 1, cache.size());
+ assertNull(val);
+ val = cache.putIfAbsent(A_STR, "newVal");
+ assertEquals(ONE, val);
+ val = cache.putIfAbsent(B_STR, TWO);
+ assertNull(val);
+ assertEquals("putIfAbsent operation did not work as expected.", 2, cache.size());
+ }
+
+ public void testPutIfAbsentWithClashingHashCode()
+ {
+ ConcurrentMap<LameKey, Object> cache = createMapWithLameKey();
+
+ if (cache == null)
+ return;
+
+ cache.putIfAbsent(AAA, ONE);
+ cache.putIfAbsent(ABB, TWO);
+ cache.putIfAbsent(AAA, FOUR);
+ cache.putIfAbsent(ACC, THREE);
+ cache.putIfAbsent(ABB, THREE);
+ assertEquals(3, cache.size());
+ assertEquals(ONE, cache.get(AAA));
+ assertEquals(TWO, cache.get(ABB));
+ assertEquals(THREE, cache.get(ACC));
+
+ cache = createMapWithLameKey();
+ cache.putIfAbsent(AAA, ONE);
+ cache.putIfAbsent(BAA, TWO);
+ cache.putIfAbsent(BAA, FOUR);
+ cache.putIfAbsent(BBB, THREE);
+ cache.putIfAbsent(BBB, ONE);
+ assertEquals(3, cache.size());
+ assertEquals(ONE, cache.get(AAA));
+ assertEquals(TWO, cache.get(BAA));
+ assertEquals(THREE, cache.get(BBB));
+
+ cache = createMapWithLameKey();
+ cache.putIfAbsent(BAA, ONE);
+ cache.putIfAbsent(BAA, TWO);
+ cache.putIfAbsent(AAA, TWO);
+ cache.putIfAbsent(AAA, FOUR);
+ cache.putIfAbsent(BBB, THREE);
+ assertEquals(3, cache.size());
+ assertEquals(ONE, cache.get(BAA));
+ assertEquals(TWO, cache.get(AAA));
+ assertEquals(THREE, cache.get(BBB));
+ }
+
+ abstract protected ConcurrentMap<String, Object> createMap();
+ abstract protected ConcurrentMap<LameKey, Object> createMapWithLameKey();
+
+ private void _putTwo(ConcurrentMap<String, Object> map)
+ {
+ map.put(A_STR, ONE);
+ map.put(B_STR, TWO);
+ }
+
+ protected static final String A_STR = "aaa";
+ protected static final String B_STR = "bbb";
+ protected static final String C_STR = "ccc";
+ protected static final String D_STR = "ddd";
+}
Modified: myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MapTestCase.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MapTestCase.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MapTestCase.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/test/java/org/apache/myfaces/trinidadbuild/test/MapTestCase.java Thu Oct 16 10:16:54 2014
@@ -78,9 +78,9 @@ abstract public class MapTestCase extend
map.putAll(hashMap);
assertEquals(2, map.size());
assertTrue(map.containsKey("first"));
- assertEquals(new Integer(1), map.get("first"));
+ assertEquals(ONE, map.get("first"));
assertTrue(map.containsKey("second"));
- assertEquals(new Integer(2), map.get("second"));
+ assertEquals(TWO, map.get("second"));
}
@@ -151,7 +151,7 @@ abstract public class MapTestCase extend
Map.Entry<String, Object> entry = iterator.next();
if (entry.getKey().equals("second"))
{
- entry.setValue(new Integer(3));
+ entry.setValue(THREE);
}
else if (entry.getKey().equals("first"))
{
@@ -176,7 +176,7 @@ abstract public class MapTestCase extend
assertTrue(!map.containsKey("first"));
}
- assertEquals(new Integer(3), map.get("second"));
+ assertEquals(THREE, map.get("second"));
map.clear();
assertTrue(map.isEmpty());
@@ -219,14 +219,14 @@ abstract public class MapTestCase extend
Map<String, Object> map = createMap();
_putTwo(map);
assertNull(map.remove("NOTTHERE"));
- assertEquals(new Integer(2), map.remove("second"));
+ assertEquals(TWO, map.remove("second"));
assertEquals(1, map.size());
assertTrue(!map.containsKey("second"));
assertNull(map.remove("second"));
assertEquals(1, map.size());
- assertEquals(new Integer(1), map.remove("first"));
+ assertEquals(ONE, map.remove("first"));
assertTrue(map.isEmpty());
assertNull(map.remove("first"));
}
@@ -263,8 +263,8 @@ abstract public class MapTestCase extend
_putTwo(map);
Collection<Object> values = map.values();
assertEquals(2, values.size());
- assertTrue(values.contains(new Integer(1)));
- assertTrue(values.contains(new Integer(2)));
+ assertTrue(values.contains(ONE));
+ assertTrue(values.contains(TWO));
// Can't really assert that this values collection is equal to
// any other, because we can't rely on the order of the collection
@@ -275,6 +275,81 @@ abstract public class MapTestCase extend
}
+ public void testPutAndGetWithClashingHashCode()
+ {
+ Map<LameKey, Object> cache = createMapWithLameKey();
+
+ if (cache == null)
+ return;
+
+ cache.put(AAA, ONE);
+ cache.put(ABB, TWO);
+ cache.put(ACC, THREE);
+ assertEquals(ONE, cache.get(AAA));
+ assertEquals(TWO, cache.get(ABB));
+ assertEquals(THREE, cache.get(ACC));
+
+ cache = createMapWithLameKey();
+ cache.put(AAA, ONE);
+ cache.put(BAA, TWO);
+ cache.put(BBB, THREE);
+ assertEquals(ONE, cache.get(AAA));
+ assertEquals(TWO, cache.get(BAA));
+ assertEquals(THREE, cache.get(BBB));
+
+ cache = createMapWithLameKey();
+ cache.put(BAA, ONE);
+ cache.put(AAA, TWO);
+ cache.put(BBB, THREE);
+ assertEquals(ONE, cache.get(BAA));
+ assertEquals(TWO, cache.get(AAA));
+ assertEquals(THREE, cache.get(BBB));
+ }
+
+ public void testRemoveWithClashingHashCode()
+ {
+ Map<LameKey, Object> cache = createMapWithLameKey();
+
+ if (cache == null)
+ return;
+
+ cache.put(AAA, ONE);
+ cache.put(ABB, TWO);
+ cache.put(ACC, THREE);
+ cache.remove(AAA);
+ assertEquals(2, cache.size());
+ assertContains(cache, ABB, ACC);
+
+ cache = createMapWithLameKey();
+
+ cache.put(AAA, ONE);
+ cache.put(BAA, TWO);
+ cache.put(BBB, THREE);
+ cache.remove(BAA);
+ assertEquals(2, cache.size());
+ assertContains(cache, AAA, BBB);
+
+ cache.put(BAA, ONE);
+ cache.put(AAA, TWO);
+ cache.put(BBB, THREE);
+ cache.remove(BBB);
+ assertEquals(2, cache.size());
+ assertContains(cache, AAA, BAA);
+ }
+
+ protected void assertContains(Map<String, Object> cache, String... keys)
+ {
+ for (String key : keys)
+ assertTrue("Object with key '" + key + "' expected to be available in the cache.",
+ cache.containsKey(key));
+ }
+
+ protected void assertContains(Map<LameKey, Object> cache, LameKey... keys)
+ {
+ for (LameKey key : keys)
+ assertTrue("Object with key '" + key + "' expected to be available in the cache.",
+ cache.containsKey(key));
+ }
protected boolean isNullRemove()
{
@@ -296,6 +371,50 @@ abstract public class MapTestCase extend
return true;
}
+ /**
+ * Key with lame, but stable hashing. The key uses the first code point of the String
+ * as its hashCode
+ */
+ protected static class LameKey
+ {
+ public LameKey(String key)
+ {
+ _key = key;
+ _hashCode = key.codePointAt(0);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _hashCode;
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof LameKey))
+ return false;
+
+ return _key.equals(((LameKey)o)._key);
+ }
+
+ @Override
+ public String toString()
+ {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append('(');
+ sb.append(_key.charAt(0));
+ sb.append(')');
+ sb.append(_key.substring(1));
+
+ return sb.toString();
+ }
+
+ private final String _key;
+ private final int _hashCode;
+ }
+
private void _assertIteratorSize(Iterator<?> iterator, int count)
{
for (int i = 0; i < count; i++)
@@ -309,9 +428,40 @@ abstract public class MapTestCase extend
private void _putTwo(Map<String, Object> map)
{
- map.put("first", new Integer(1));
- map.put("second", new Integer(2));
+ map.put("first", ONE);
+ map.put("second", TWO);
}
+ /**
+ * @return map with minimum size 3
+ */
abstract protected Map<String, Object> createMap();
+
+ /**
+ * @return map with minimum size 3, or
+ * null when not applicable
+ */
+ abstract protected Map<LameKey, Object> createMapWithLameKey();
+
+ protected static final Object ONE = new Integer(1);
+ protected static final Object TWO = new Integer(2);
+ protected static final Object THREE = new Integer(3);
+ protected static final Object FOUR = new Integer(4);
+
+ protected static final LameKey AAA = new LameKey("aaa");
+ protected static final LameKey ABB = new LameKey("abb");
+ protected static final LameKey ACC = new LameKey("acc");
+ protected static final LameKey ADD = new LameKey("add");
+ protected static final LameKey BAA = new LameKey("baa");
+ protected static final LameKey BBB = new LameKey("bbb");
+ protected static final LameKey BCC = new LameKey("bcc");
+ protected static final LameKey BDD = new LameKey("bdd");
+ protected static final LameKey CAA = new LameKey("caa");
+ protected static final LameKey CBB = new LameKey("cbb");
+ protected static final LameKey CCC = new LameKey("ccc");
+ protected static final LameKey CDD = new LameKey("cdd");
+ protected static final LameKey DAA = new LameKey("daa");
+ protected static final LameKey DBB = new LameKey("dbb");
+ protected static final LameKey DCC = new LameKey("dcc");
+ protected static final LameKey DDD = new LameKey("ddd");
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/image/cache/CacheUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/image/cache/CacheUtils.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/image/cache/CacheUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/image/cache/CacheUtils.java Thu Oct 16 10:16:54 2014
@@ -20,10 +20,10 @@ package org.apache.myfaces.trinidadinter
import java.awt.Color;
-import java.util.Collections;
import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
-import org.apache.myfaces.trinidadinternal.util.LRUCache;
+import org.apache.myfaces.trinidadinternal.util.CopyOnWriteArrayMap;
import org.apache.myfaces.trinidadinternal.util.nls.LocaleUtils;
import org.apache.myfaces.trinidad.context.LocaleContext;
@@ -133,9 +133,9 @@ class CacheUtils
font.getStyle(),
font.getSize());
- _sFontProxyCache.put(sharedFont, sharedFont);
+ FontProxy existing = _sFontProxyCache.putIfAbsent(sharedFont, sharedFont);
- return sharedFont;
+ return (existing != null) ? existing : sharedFont;
}
/**
@@ -168,8 +168,7 @@ class CacheUtils
return buffer.toString();
}
- private static final Map<FontProxy, FontProxy> _sFontProxyCache =
- Collections.synchronizedMap(new LRUCache<FontProxy, FontProxy>(50));
+ private static final ConcurrentMap<FontProxy, FontProxy> _sFontProxyCache = CopyOnWriteArrayMap.newLRUConcurrentMap(50);
// Characters for base 64 encodings
private static final char[] _BASE_64_CHARS =
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseSkin.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseSkin.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseSkin.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/skin/BaseSkin.java Thu Oct 16 10:16:54 2014
@@ -59,4 +59,13 @@ public class BaseSkin extends SkinImpl
public Map<String,String> getSkinFeatures(){
return null;
}
+
+ /**
+ * @return true, since this skin implementation is internal
+ */
+ @Override
+ public boolean isCacheable()
+ {
+ return true;
+ }
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinExtension.java Thu Oct 16 10:16:54 2014
@@ -37,6 +37,7 @@ import org.apache.myfaces.trinidad.loggi
import org.apache.myfaces.trinidad.skin.Icon;
import org.apache.myfaces.trinidad.skin.Skin;
import org.apache.myfaces.trinidad.skin.SkinAddition;
+import org.apache.myfaces.trinidad.skin.SkinFeatures;
import org.apache.myfaces.trinidad.skin.SkinMetadata;
import org.apache.myfaces.trinidad.skin.SkinVersion;
import org.apache.myfaces.trinidad.util.ToStringHelper;
@@ -54,7 +55,8 @@ public class SkinExtension extends SkinI
{
/**
* Constructs a SkinExtension of id and family and renderKitId. It also
- * sets the styleSheetname and a resourceBundle name.
+ * sets the styleSheetname and a resourceBundle name. Since this constructor
+ * is only used ot create internal skins, cacheabilty will be set to true
*
* @param baseSkin The base Skin that this custom
* Skin "extends". If it is a Skin designed for "org.apache.myfaces.trinidad.desktop"
@@ -80,8 +82,9 @@ public class SkinExtension extends SkinI
* to be used to translate strings that a renderer renders.
* @throws NullPointerException if baseSkin, id, or family is null.
- *
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
*/
+ @Deprecated
public SkinExtension(
Skin baseSkin,
String id,
@@ -94,40 +97,29 @@ public class SkinExtension extends SkinI
String resourceBundleName
)
{
- if (baseSkin == null)
- throw new NullPointerException("Null baseSkin");
- if (id == null)
- throw new NullPointerException(_LOG.getMessage(
- "NULL_SKIN_ID"));
- if (family == null)
- throw new NullPointerException("Null family");
- if (renderKitId == null)
- renderKitId = _DEFAULT_RENDERKIT;
- if (version == null)
- version = SkinVersion.EMPTY_SKIN_VERSION;
-
- //Since SkinAdditionParser makes sure both the bundle and EL are not set, we
- //do not need to do it here
-
- baseSkin = _ensureBaseSkinType(baseSkin);
-
- //bundle-name takes precedence over translation-source, prevent both from being set
- if(resourceBundleName != null && translationSourceValueExpression != null)
- {
- translationSourceValueExpression = null;
- }
-
- _baseSkin = baseSkin;
- _id = id;
- _family = family;
- _renderKitId = renderKitId;
- _styleSheetName = styleSheetName;
- _bundleName = resourceBundleName;
- _translationSourceVE = translationSourceValueExpression;
- _version = version;
- _skinFeatures = features;
+ this(baseSkin,
+ new SkinMetadata.Builder().id(id)
+ .family(family)
+ .renderKitId(SkinMetadata.RenderKitId.fromId(renderKitId))
+ .styleSheetName(styleSheetName)
+ .translationSource(translationSourceValueExpression)
+ .version(version)
+ .features(new SkinFeatures(features))
+ .resourceBundleName(resourceBundleName)
+ .build(),
+ true);
}
+ /**
+ * Since this constructor is only used ot create internal skins, cacheabilty will be set to true
+ * @param baseSkin
+ * @param id
+ * @param family
+ * @param renderKitId
+ * @param styleSheetName
+ * @param resourceBundleName
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
+ */
@Deprecated
public SkinExtension(
Skin baseSkin,
@@ -141,7 +133,18 @@ public class SkinExtension extends SkinI
this(baseSkin, id, family, renderKitId, styleSheetName,
resourceBundleName, SkinVersion.EMPTY_SKIN_VERSION);
}
-
+
+ /**
+ * Since this constructor is only used ot create internal skins, cacheabilty will be set to true
+ * @param baseSkin
+ * @param id
+ * @param family
+ * @param renderKitId
+ * @param styleSheetName
+ * @param resourceBundleName
+ * @param version
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
+ */
@Deprecated
public SkinExtension(
Skin baseSkin,
@@ -153,30 +156,28 @@ public class SkinExtension extends SkinI
SkinVersion version
)
{
- if (baseSkin == null)
- throw new NullPointerException("Null baseSkin");
- if (id == null)
- throw new NullPointerException(_LOG.getMessage(
- "NULL_SKIN_ID"));
- if (family == null)
- throw new NullPointerException("Null family");
- if (renderKitId == null)
- renderKitId = _DEFAULT_RENDERKIT;
- if (version == null)
- version = SkinVersion.EMPTY_SKIN_VERSION;
-
- baseSkin = _ensureBaseSkinType(baseSkin);
+ this(baseSkin,
+ new SkinMetadata.Builder().id(id)
+ .family(family)
+ .renderKitId(SkinMetadata.RenderKitId.fromId(renderKitId))
+ .styleSheetName(styleSheetName)
+ .resourceBundleName(resourceBundleName)
+ .version(version)
+ .build(),
+ true);
- _baseSkin = baseSkin;
- _id = id;
- _family = family;
- _renderKitId = renderKitId;
- _styleSheetName = styleSheetName;
- _bundleName = resourceBundleName;
- _translationSourceVE = null;
- _version = version;
}
+ /**
+ * Since this constructor is only used ot create internal skins, cacheabilty will be set to true
+ * @param baseSkin
+ * @param id
+ * @param family
+ * @param renderKitId
+ * @param styleSheetName
+ * @param translationSourceValueExpression
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
+ */
@Deprecated
public SkinExtension(
Skin baseSkin,
@@ -190,7 +191,18 @@ public class SkinExtension extends SkinI
this(baseSkin, id, family, renderKitId, styleSheetName,
translationSourceValueExpression, SkinVersion.EMPTY_SKIN_VERSION);
}
-
+
+ /**
+ * Since this constructor is only used ot create internal skins, cacheabilty will be set to true
+ * @param baseSkin
+ * @param id
+ * @param family
+ * @param renderKitId
+ * @param styleSheetName
+ * @param translationSourceValueExpression
+ * @param version
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
+ */
@Deprecated
public SkinExtension(
Skin baseSkin,
@@ -202,30 +214,26 @@ public class SkinExtension extends SkinI
SkinVersion version
)
{
- if (baseSkin == null)
- throw new NullPointerException("Null baseSkin");
- if (id == null)
- throw new NullPointerException(_LOG.getMessage(
- "NULL_SKIN_ID"));
- if (family == null)
- throw new NullPointerException("Null family");
- if (renderKitId == null)
- renderKitId = _DEFAULT_RENDERKIT;
- if (version == null)
- version = SkinVersion.EMPTY_SKIN_VERSION;
-
- baseSkin = _ensureBaseSkinType(baseSkin);
-
- _baseSkin = baseSkin;
- _id = id;
- _family = family;
- _renderKitId = renderKitId;
- _styleSheetName = styleSheetName;
- _bundleName = null;
- _translationSourceVE = translationSourceValueExpression;
- _version = version;
- }
+ this(baseSkin,
+ new SkinMetadata.Builder().id(id)
+ .family(family)
+ .renderKitId(SkinMetadata.RenderKitId.fromId(renderKitId))
+ .styleSheetName(styleSheetName)
+ .translationSource(translationSourceValueExpression)
+ .version(version)
+ .build(),
+ true);
+ }
+ /**
+ * Since this constructor is only used ot create internal skins, cacheabilty will be set to true
+ * @param baseSkin
+ * @param id
+ * @param family
+ * @param renderKitId
+ * @param styleSheetName
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
+ */
@Deprecated
public SkinExtension(
Skin baseSkin,
@@ -238,8 +246,16 @@ public class SkinExtension extends SkinI
this(baseSkin, id, family, renderKitId, styleSheetName, SkinVersion.EMPTY_SKIN_VERSION);
}
- /*
+ /**
* SkinExtension without the resource bundle information, but with the version information.
+ * Since this constructor is only used ot create internal skins, cacheabilty will be set to true
+ * @param baseSkin
+ * @param id
+ * @param family
+ * @param renderKitId
+ * @param styleSheetName
+ * @param version
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
*/
@Deprecated
public SkinExtension(
@@ -251,11 +267,70 @@ public class SkinExtension extends SkinI
SkinVersion version
)
{
+ this(baseSkin,
+ new SkinMetadata.Builder().id(id)
+ .family(family)
+ .renderKitId(SkinMetadata.RenderKitId.fromId(renderKitId))
+ .styleSheetName(styleSheetName)
+ .version(version)
+ .build(),
+ true);
+ }
+
+ /**
+ * Since this constructor is only used ot create internal skins, cacheabilty will be set to true
+ * @param baseSkin
+ * @param id
+ * @param family
+ * @param renderKitId
+ * @deprecated Use SkinExtension(baseSkin, metadata, cacheability)
+ */
+ @Deprecated
+ public SkinExtension(
+ Skin baseSkin,
+ String id,
+ String family,
+ String renderKitId
+ )
+ {
+ this(baseSkin, id, family, renderKitId, null);
+ }
+
+ /**
+ * Creates SkinExtension from SkinMetadata and base Skin
+ * This constructor is used for creating skins for external SkinProvider implementations.
+ * We keep skins thus created as not-cacheable.
+ * @see org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl
+ * @param baseSkin
+ * @param skinMetadata
+ */
+ public SkinExtension(Skin baseSkin, SkinMetadata skinMetadata)
+ {
+ this(baseSkin, skinMetadata, false);
+ }
+
+ /**
+ * Creates SkinExtension from SkinMetadata, base Skin and cacheability
+ * This constructor is used only for INTERNAL skins
+ * @see org.apache.myfaces.trinidadinternal.skin.provider.TrinidadSkinProvider
+ * @param baseSkin
+ * @param skinMetadata
+ */
+ public SkinExtension(Skin baseSkin, SkinMetadata skinMetadata, boolean isCacheable)
+ {
+ String id = skinMetadata.getId();
+ String family = skinMetadata.getFamily();
+ String renderKitId = skinMetadata.getRenderKitId();
+ String styleSheetName = skinMetadata.getStyleSheetName();
+ ValueExpression translationSourceValueExpression = skinMetadata.getTranslationSource();
+ SkinVersion version = skinMetadata.getVersion();
+ Map<String,String> features = skinMetadata.getFeatures().getFeatures();
+ String resourceBundleName = skinMetadata.getResourceBundleName();
+
if (baseSkin == null)
throw new NullPointerException("Null baseSkin");
if (id == null)
- throw new NullPointerException(_LOG.getMessage(
- "NULL_SKIN_ID"));
+ throw new NullPointerException(_LOG.getMessage("NULL_SKIN_ID"));
if (family == null)
throw new NullPointerException("Null family");
if (renderKitId == null)
@@ -265,38 +340,24 @@ public class SkinExtension extends SkinI
baseSkin = _ensureBaseSkinType(baseSkin);
+ //bundle-name takes precedence over translation-source
+ if(resourceBundleName != null && translationSourceValueExpression != null)
+ {
+ translationSourceValueExpression = null;
+ }
+
_baseSkin = baseSkin;
_id = id;
_family = family;
_renderKitId = renderKitId;
_styleSheetName = styleSheetName;
- _bundleName = null;
- _translationSourceVE = null;
+ _bundleName = resourceBundleName;
+ _translationSourceVE = translationSourceValueExpression;
_version = version;
- }
-
-
- @Deprecated
- public SkinExtension(
- Skin baseSkin,
- String id,
- String family,
- String renderKitId
- )
- {
- this(baseSkin, id, family, renderKitId, null);
- }
-
- public SkinExtension(Skin baseSkin, SkinMetadata skinMetadata)
- {
- this(baseSkin,
- skinMetadata.getId(), skinMetadata.getFamily(), skinMetadata.getRenderKitId(),
- skinMetadata.getStyleSheetName(), skinMetadata.getTranslationSource(), skinMetadata.getVersion(),
- skinMetadata.getFeatures().getFeatures(), skinMetadata.getResourceBundleName());
+ _skinFeatures = features;
+ _isCacheable = isCacheable;
}
-
-
/**
* Returns the base Skin which this custom Skin "extends".
* Note that in order to avoid infinite call loop the implementation of getBaseSkin() in this
@@ -407,10 +468,12 @@ public class SkinExtension extends SkinI
* Returns the name of the bundle for this SkinExtension.
* @deprecated Use the constructor that takes a resourceBundleName instead
*/
+ @Deprecated
public void setBundleName(String bundleName)
{
// TODO take out method once sufficient time has past since deprecation
- // in July, 2007
+ // TODO in July, 2007
+ // TODO also make _bundleName final
_bundleName = bundleName;
}
@@ -465,7 +528,7 @@ public class SkinExtension extends SkinI
String key
) throws MissingResourceException
{
- // Look for the skin's translated value
+ // Look for the skin's translated value
// -first Skin's translation source, then SkinAddition translation sources.
// A translation source is either a bundleName or
// a translationSourceValueExpression
@@ -583,8 +646,11 @@ public class SkinExtension extends SkinI
* Sets the name of the style sheet for this Skin.
* @deprecated Use the SkinExtension constructor that takes a styleSheetName instead.
*/
+ @Deprecated
public void setStyleSheetName(String styleSheetName)
{
+ // TODO take out method once sufficient time has past since deprecation
+ // TODO also make _styleSheetName final
_styleSheetName = styleSheetName;
}
@@ -650,24 +716,13 @@ public class SkinExtension extends SkinI
getBaseSkin().setDirty(dirty);
}
- /**
- * extracts the skin out if we pass a RequestSkinWrapper
- * ensures that the baseSkin is of SkinImpl type
- * @param baseSkin
- * @return SkinImpl object
- */
- private Skin _ensureBaseSkinType(Skin baseSkin)
+ @Override
+ public boolean isCacheable()
{
- while (baseSkin instanceof RequestSkinWrapper)
- baseSkin = ((RequestSkinWrapper) baseSkin).getWrappedSkin();
-
- if (!(baseSkin instanceof SkinImpl))
- throw new ClassCastException("Base skin is expected to be of type SkinImpl. Obtain the base skin from SkinProvider.");
-
- return baseSkin;
+ return _isCacheable;
}
-
- @Override
+
+ @Override
protected void addPropertiesToString(ToStringHelper helper)
{
super.addPropertiesToString(helper);
@@ -685,6 +740,23 @@ public class SkinExtension extends SkinI
}
/**
+ * extracts the skin out if we pass a RequestSkinWrapper
+ * ensures that the baseSkin is of SkinImpl type
+ * @param baseSkin
+ * @return SkinImpl object
+ */
+ private Skin _ensureBaseSkinType(Skin baseSkin)
+ {
+ while (baseSkin instanceof RequestSkinWrapper)
+ baseSkin = ((RequestSkinWrapper) baseSkin).getWrappedSkin();
+
+ if (!(baseSkin instanceof SkinImpl))
+ throw new ClassCastException("Base skin is expected to be of type SkinImpl. Obtain the base skin from SkinProvider.");
+
+ return baseSkin;
+ }
+
+ /**
* Find the actual icon
* @param refIcon a ReferenceIcon instance
* @param referencedIconStack The stack of reference icon names which have
@@ -762,9 +834,6 @@ public class SkinExtension extends SkinI
return stack.contains(value);
}
- private SkinExtension() {}
-
-
// Icon class that we use as a placeholder for null icons
private static class NullIcon extends Icon
{
@@ -778,17 +847,19 @@ public class SkinExtension extends SkinI
// null icons don't render anything
}
}
-
- private String _id;
- private String _family;
- private String _renderKitId;
- private Skin _baseSkin;
- private String _styleSheetName;
- private ValueExpression _translationSourceVE;
- private String _bundleName;
- private SkinVersion _version;
- private Map<String, String> _skinFeatures;
-
+
+ private final String _id;
+ private final String _family;
+ private final String _renderKitId;
+ private final Skin _baseSkin;
+ private final ValueExpression _translationSourceVE;
+ private final SkinVersion _version;
+ private final Map<String, String> _skinFeatures;
+ private final boolean _isCacheable;
+
+ // TODO make these final after the deprecated setter is removed
+ private String _styleSheetName;
+ private String _bundleName;
// The StyleSheetDocument for the base LookAndFeel's style sheet
private StyleSheetDocument _baseStyleSheetDocument;
@@ -802,13 +873,9 @@ public class SkinExtension extends SkinI
private StyleSheetDocument _fullStyleSheetDocument;
// Placeholder for null icons
- private static final Icon _NULL_ICON = new NullIcon();
-
- private static final String _DEFAULT_RENDERKIT =
- "org.apache.myfaces.trinidad.desktop";
-
+ private static final Icon _NULL_ICON = new NullIcon();
+ private static final String _DEFAULT_RENDERKIT = "org.apache.myfaces.trinidad.desktop";
// Error messages
- private static final String _CIRCULAR_INCLUDE_ERROR =
- "Circular dependency detected in skin reference icon ";
- private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(SkinExtension.class);
+ private static final String _CIRCULAR_INCLUDE_ERROR = "Circular dependency detected in skin reference icon ";
+ private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(SkinExtension.class);
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinImpl.java Thu Oct 16 10:16:54 2014
@@ -63,8 +63,9 @@ import org.apache.myfaces.trinidadintern
* This implementation class adds the details that should
* not be exposed outside of this API.
*
- * @see SkinFactory
- * @see org.apache.myfaces.trinidadinternal.ui.UIXRenderingContext#getSkinFactory
+ * @see org.apache.myfaces.trinidad.skin.SkinFactory
+ * @see org.apache.myfaces.trinidad.skin.SkinProvider
+ * @see org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl#reloadSkins
*
* @version $Name: $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/skin/Skin.java#0 $) $Date: 10-nov-2005.18:58:54 $
*/
@@ -72,11 +73,11 @@ abstract public class SkinImpl extends S
{
/**
- * Returns an string identifier which uniquely identies this Skin implementation. Skin
+ * Returns an string identifier which uniquely identifies this Skin implementation. Skin
* implementations can be retrieved by id via SkinFactory.getSkin().
* Note that in order to avoid infinite call loop the implementation of getId() in this class or
* sub classes should not call toString().
- * @see org.apache.myfaces.trinidadinternal.skin.SkinFactory#getSkin
+ * @see org.apache.myfaces.trinidadinternal.skin.SkinFactoryImpl#getSkin
*/
@Override
public String getId()
@@ -392,6 +393,7 @@ abstract public class SkinImpl extends S
* @see #addSkinAddition(SkinAddition)
* @deprecated Use addSkinAddition instead
*/
+ @Deprecated
@Override
public void registerStyleSheet(String styleSheetName)
{
@@ -455,7 +457,7 @@ abstract public class SkinImpl extends S
{
_dirty = dirty;
}
-
+
/**
* @inheritDoc
* Note that in order to avoid infinite call loop the implementation of getId(), getVersion(),
@@ -475,6 +477,12 @@ abstract public class SkinImpl extends S
}
/**
+ * Used by SkinStyleProvider to decide whether to cache the StyleProvider or not.
+ * @return true if skin is internal to the framework.
+ */
+ public abstract boolean isCacheable();
+
+ /**
* Returns a translated value in the LocaleContext's translation Locale, or null
* if the key could not be found.
* This value may or may not be a String, and developers should avoid
@@ -1363,14 +1371,10 @@ abstract public class SkinImpl extends S
// Optional features for rendering
protected Map<String, String> _skinFeatures;
-
// HashMap of Skin properties
- private ConcurrentHashMap<Object, Object> _properties= new ConcurrentHashMap<Object, Object>();
+ private final ConcurrentHashMap<Object, Object> _properties = new ConcurrentHashMap<Object, Object>();
- private boolean _dirty;
+ private volatile boolean _dirty;
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(SkinImpl.class);
-
- private static final String _FORCE_DISABLE_CONTENT_COMPRESSION_PARAM="org.apache.myfaces.trinidad.skin.disableStyleCompression";
-
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinNotAvailable.java Thu Oct 16 10:16:54 2014
@@ -77,4 +77,13 @@ public class SkinNotAvailable extends Sk
public Map<String, String> getSkinFeatures() {
return null;
}
+
+ /**
+ * @return false, since this represents a null skin
+ */
+ @Override
+ public boolean isCacheable()
+ {
+ return false;
+ }
}
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinStyleProvider.java Thu Oct 16 10:16:54 2014
@@ -18,7 +18,6 @@
*/
package org.apache.myfaces.trinidadinternal.skin;
-import java.util.Map;
import java.util.concurrent.ConcurrentMap;
import javax.faces.context.FacesContext;
@@ -26,12 +25,14 @@ import javax.faces.context.FacesContext;
import org.apache.myfaces.trinidad.context.RequestContext;
import org.apache.myfaces.trinidad.logging.TrinidadLogger;
import org.apache.myfaces.trinidad.skin.Skin;
+import org.apache.myfaces.trinidad.util.Args;
+import org.apache.myfaces.trinidad.util.ToStringHelper;
import org.apache.myfaces.trinidadinternal.style.StyleContext;
import org.apache.myfaces.trinidadinternal.style.StyleProvider;
import org.apache.myfaces.trinidadinternal.style.cache.FileSystemStyleCache;
import org.apache.myfaces.trinidadinternal.style.xml.StyleSheetDocumentUtils;
import org.apache.myfaces.trinidadinternal.style.xml.parse.StyleSheetDocument;
-import org.apache.myfaces.trinidadinternal.util.LRUCache;
+import org.apache.myfaces.trinidadinternal.util.CopyOnWriteArrayMap;
/**
@@ -83,35 +84,59 @@ public class SkinStyleProvider extends F
targetDirectoryPath);
// Get our cache of existing StyleProviders
- Map<ProviderKey, StyleProvider> providers = _getProviders();
+ ConcurrentMap<ProviderKey, StyleProvider> providers = _getProviders();
+ StyleProvider provider = providers.get(key);
- StyleProvider provider = null;
-
- synchronized (providers)
+ if (provider != null)
{
- provider = providers.get(key);
+ _LOG.fine("Style provider served from cache {0}", provider);
+ return provider;
+ }
- if (provider == null)
- {
- // If we haven't created an instance for this skin/custom style sheet
- // yet, try creating it now.
- provider = new SkinStyleProvider(skin,
- targetDirectoryPath);
- if (_LOG.isFine())
- {
- _LOG.fine("Create a new SkinStyleProvider for skin {0} and targetDirectoryPath {1}",
- new Object[]{skin.getId(), targetDirectoryPath});
- }
+ // If we haven't created an instance for this skin/custom style sheet
+ // yet, create it now.
+ provider = new SkinStyleProvider(skin,
+ targetDirectoryPath);
+ // assume caching is "on"
+ boolean cacheStyleProvider = true;
+ boolean logStyleProviderCreated = false;
- // Store the provider in our cache
- providers.put(key, provider);
- }
+ // skin framework caches only internal skins.
+ // Internal skins are marked by internal SkinProviders.
+ // So essentially skins created by external SkinProviders or using
+ // SkinFactory.createSkin are not internal skins.
+ if (skin instanceof SkinImpl && !((SkinImpl) skin).isCacheable())
+ {
+ cacheStyleProvider = false;
+ logStyleProviderCreated = true;
}
+ // Store the provider in our cache
+ if (cacheStyleProvider)
+ {
+ StyleProvider existing = providers.putIfAbsent(key, provider);
+ if (existing != null)
+ provider = existing;
+ else
+ logStyleProviderCreated = true;
+ }
+
+ if (logStyleProviderCreated && _LOG.isFine())
+ _LOG.fine("Create a new SkinStyleProvider for skin {0} and targetDirectoryPath {1}. Skin cacheability is: {2}",
+ new Object[]{skin.getId(), targetDirectoryPath, cacheStyleProvider});
+
return provider;
}
- /**
+ @Override
+ public String toString()
+ {
+ return new ToStringHelper(this)
+ .append("skinId", _skin.getId())
+ .toString();
+ }
+
+ /**
* Creates SkinStyleProvider instance.
* Only subclasses should call this method. All other
* clients should use getSkinStyleProvider().
@@ -224,39 +249,41 @@ public class SkinStyleProvider extends F
}
// Returns a Map which hashes ProviderKeys to shared instances of SkinStyleProviders.
- private static Map<ProviderKey, StyleProvider> _getProviders()
+ private static ConcurrentMap<ProviderKey, StyleProvider> _getProviders()
{
ConcurrentMap<String, Object> appMap =
RequestContext.getCurrentInstance().getApplicationScopedConcurrentMap();
- Map<ProviderKey, StyleProvider> styleProviders =
- (Map<ProviderKey, StyleProvider>)appMap.get(_SKIN_PROVIDERS_KEY);
+ ConcurrentMap<ProviderKey, StyleProvider> styleProviders =
+ (ConcurrentMap<ProviderKey, StyleProvider>)appMap.get(_SKIN_PROVIDERS_KEY);
if (styleProviders == null)
{
- styleProviders = _createProvidersMap();
-
- Map<ProviderKey, StyleProvider> oldStyleProviders =
- (Map<ProviderKey, StyleProvider>)appMap.putIfAbsent(_SKIN_PROVIDERS_KEY, styleProviders);
-
+ styleProviders = _createProvidersCache();
+
+ ConcurrentMap<ProviderKey, StyleProvider> oldStyleProviders =
+ (ConcurrentMap<ProviderKey, StyleProvider>)appMap.putIfAbsent(_SKIN_PROVIDERS_KEY, styleProviders);
+
if (oldStyleProviders != null)
- {
styleProviders = oldStyleProviders;
- }
}
return styleProviders;
}
- private static Map<ProviderKey, StyleProvider> _createProvidersMap()
+ private static ConcurrentMap<ProviderKey, StyleProvider> _createProvidersCache()
+ {
+ return CopyOnWriteArrayMap.newLRUConcurrentMap(_getCacheSize());
+ }
+
+ private static int _getCacheSize()
{
FacesContext context = FacesContext.getCurrentInstance();
- String lruCacheSize = context.getExternalContext().getInitParameter(_MAX_SKINS_CACHED);
-
+ String lruCacheSize = context.getExternalContext().getInitParameter(_MAX_SKINS_CACHED);
int lruCacheSizeInt = _MAX_SKINS_CACHED_DEFAULT;
boolean invalidInt = false;
- if (lruCacheSize != null && !lruCacheSize.equals(""))
+ if (lruCacheSize != null && !lruCacheSize.isEmpty())
{
try
{
@@ -271,21 +298,18 @@ public class SkinStyleProvider extends F
invalidInt = true;
}
}
-
- // The user typed in an invalid integer ( <=0 or a value that couldn't be formatted to a number)
+
+ // Invalid number or number less than zero specified by used in context parameter
// so log a warning
if (invalidInt)
{
- lruCacheSizeInt = _MAX_SKINS_CACHED_DEFAULT;
-
if (_LOG.isWarning())
- {
- _LOG.warning("INVALID_INTEGER_MAX_SKINS_CACHED",
- new Object[]{lruCacheSize, _MAX_SKINS_CACHED_DEFAULT});
- }
+ _LOG.warning("INVALID_INTEGER_MAX_SKINS_CACHED", new Object[]{lruCacheSize, _MAX_SKINS_CACHED_DEFAULT});
+ // re-initialize to max size because it could have been assigned to a negative number above while parsing
+ lruCacheSizeInt = _MAX_SKINS_CACHED_DEFAULT;
}
-
- return new LRUCache<ProviderKey, StyleProvider>(lruCacheSizeInt);
+
+ return lruCacheSizeInt;
}
// Key that we use to retrieve a shared SkinStyleProvider
@@ -297,10 +321,22 @@ public class SkinStyleProvider extends F
String targetDirectoryPath
)
{
- _skin = skin;
+ Args.notNull(skin, "skin");
+ Args.notNull(targetDirectoryPath, "targetDirectoryPath");
+
+ _skinId = skin.getId();
_targetDirectoryPath = targetDirectoryPath;
}
+ @Override
+ public String toString()
+ {
+ return new ToStringHelper(this)
+ .append("skinId", _skinId)
+ .append("targetDirectoryPath", _targetDirectoryPath)
+ .toString();
+ }
+
// Test for equality
@Override
public boolean equals(Object o)
@@ -313,7 +349,7 @@ public class SkinStyleProvider extends F
ProviderKey key = (ProviderKey)o;
- return (_equals(_skin, key._skin) &&
+ return (_equals(_skinId, key._skinId) &&
_equals(_targetDirectoryPath, key._targetDirectoryPath));
}
@@ -321,12 +357,10 @@ public class SkinStyleProvider extends F
@Override
public int hashCode()
{
- int hashCode = _skin.hashCode();
-
- if (_targetDirectoryPath != null)
- hashCode ^= _targetDirectoryPath.hashCode();
-
- return hashCode;
+ int result = 17;
+ result = 37 * result + _skinId.hashCode();
+ result = 37 * result + _targetDirectoryPath.hashCode();
+ return result;
}
// Tests two objects for equality, taking possible nulls
@@ -339,8 +373,8 @@ public class SkinStyleProvider extends F
return o1.equals(o2);
}
- private Skin _skin;
- private String _targetDirectoryPath;
+ private final String _skinId;
+ private final String _targetDirectoryPath;
}
// The Skin which provides styles
@@ -350,7 +384,7 @@ public class SkinStyleProvider extends F
private StyleSheetDocument _skinDocument;
// Key to cache of shared SkinStyleProvider instances
- private static final String _SKIN_PROVIDERS_KEY =
+ private static final String _SKIN_PROVIDERS_KEY =
"org.apache.myfaces.trinidadinternal.skin.SKIN_PROVIDERS_KEY";
private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
SkinStyleProvider.class);
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/BaseSkinProvider.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/BaseSkinProvider.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/BaseSkinProvider.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/BaseSkinProvider.java Thu Oct 16 10:16:54 2014
@@ -89,7 +89,7 @@ abstract class BaseSkinProvider extends
}
if (_LOG.isFine())
- _LOG.fine(this + " Adding skin to cache: [" + metadata + ", " + skin + "]");
+ _LOG.fine("Adding skin to cache [metadata: {0}, skin: {1}]", new Object[] {metadata, skin});
synchronized (this)
{
@@ -171,7 +171,7 @@ abstract class BaseSkinProvider extends
if (searchMetadata == null)
throw new NullPointerException("SkinMetadata passed for search is null");
- // find a skin that is already loaded
+ // find a skin that is already loaded using the exact search metadata passed.
Skin availableSkin = _skins.get(searchMetadata);
if (availableSkin != null)
return availableSkin;
@@ -261,7 +261,7 @@ abstract class BaseSkinProvider extends
// search using family, renderkit, version
String family = search.getFamily();
- // we need atleast the family to go on with the search
+ // we need at least the family to go on with the search
if (family == null)
return null;
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/SkinProviderRegistry.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/SkinProviderRegistry.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/SkinProviderRegistry.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/SkinProviderRegistry.java Thu Oct 16 10:16:54 2014
@@ -175,6 +175,15 @@ public class SkinProviderRegistry extend
}
/**
+ * exposing providers for testability
+ * @return
+ */
+ List<SkinProvider> getProviders()
+ {
+ return _providers;
+ }
+
+ /**
* ensure sanity in the list of matches received by filtering the skins based on id, family and
* renderKit
*
Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/TrinidadSkinProvider.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/TrinidadSkinProvider.java?rev=1632265&r1=1632264&r2=1632265&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/TrinidadSkinProvider.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/TrinidadSkinProvider.java Thu Oct 16 10:16:54 2014
@@ -71,7 +71,7 @@ public final class TrinidadSkinProvider
@Override
public Collection<SkinMetadata> getSkinMetadata(ExternalContext context)
{
- // already initialized to unmodifiableCollection
+ initialize(context);
return _skinMetadata;
}
@@ -96,11 +96,9 @@ public final class TrinidadSkinProvider
{
// This cannot happen because base class checks for availability before it calls for the
// skin to be loaded
- if (_LOG.isSevere())
- _LOG.severe("SP_LOADING_UNKNOWN_SKIN", new Object[]{skinMetadata.getId()});
-
- throw new NullPointerException(_LOG.getMessage("SP_LOADING_UNKNOWN_SKIN",
- new Object[]{skinMetadata.getId()}));
+ String message = _LOG.getMessage("SP_LOADING_UNKNOWN_SKIN", skinMetadata.getId());
+ _LOG.severe(message);
+ throw new IllegalArgumentException(message);
}
String id = matchingNode.getId();
@@ -117,7 +115,6 @@ public final class TrinidadSkinProvider
if (baseSkin == null)
{
baseSkin = SkinUtils.getDefaultSkinForRenderKitId(provider, context, renderKitId);
- baseSkinId = baseSkin.getId();
}
if (id == null)
@@ -126,11 +123,8 @@ public final class TrinidadSkinProvider
if (family == null)
throw new NullPointerException("Null family");
- if (_LOG.isFine())
- _LOG.fine("Creating skin extension for : " + skinMetadata);
-
- // features object itself cannot be null
- return new SkinExtension(baseSkin, matchingNode);
+ _LOG.fine("Creating skin extension for skin metadata {0}", skinMetadata);
+ return new SkinExtension(baseSkin, matchingNode, true);
}
/**
@@ -175,8 +169,8 @@ public final class TrinidadSkinProvider
if (_LOG.isFine())
{
- _LOG.fine("trindiad-skins loaded: " + _skinMetadata.size());
- _LOG.fine("trindiad-skins additions loaded: " + _skinAdditionNodes.size());
+ _LOG.fine("Number of skin metadata loaded from trinidad-skins.xml: {0}", _skinMetadata.size());
+ _LOG.fine("Number of skin additions loaded from trinidad-skins.xml: {0}", _skinAdditionNodes.size());
}
}
}