myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwald...@apache.org
Subject svn commit: r1547514 [1/2] - in /myfaces/trinidad/trunk: trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/ trinidad-impl/src/main/java/org/apache/myfaces/trinida...
Date Tue, 03 Dec 2013 18:31:34 GMT
Author: jwaldman
Date: Tue Dec  3 18:31:33 2013
New Revision: 1547514

URL: http://svn.apache.org/r1547514
Log:
TRINIDAD-2433 unnecessary use of FacesContext in SkinProvider API
Thanks to Anand Nath for the patch.

Modified:
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/CustomMetadata.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinFactory.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinMetadata.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinProvider.java
    myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/TranslationsResourceLoader.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinUtils.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/pregen/SkinPregenerationService.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/ExternalSkinProvider.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/TrinidadBaseSkinProvider.java
    myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/provider/TrinidadSkinProvider.java
    myfaces/trinidad/trunk/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/renderkit/RenderKitTestCase.java

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/CustomMetadata.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/CustomMetadata.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/CustomMetadata.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/CustomMetadata.java Tue Dec  3 18:31:33 2013
@@ -24,7 +24,7 @@ import java.util.Map;
 
 /**
  * CustomMetadata represents the metadata associated with a Skin.
- * This API makes it convinient to read the content of metadata tag in trinidad-skins.xml
+ * This API makes it convenient to read the content of metadata tag in trinidad-skins.xml
  * such as:
  * <metadata>
  *    <visibility>deprecated</visibility>

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinFactory.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinFactory.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinFactory.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinFactory.java Tue Dec  3 18:31:33 2013
@@ -22,29 +22,31 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.WeakHashMap;
 
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 
 
 /**
- * All methods in this class dealing with skin management activities such as loading, creating, managing
- * and disposing skins are deprecated. It is recommended to use SkinProvider instead of SkinFactory
- * for the deprecated APIs. SkinProvider introduces lazy / on-demand loading of skins as opposed to eager
- * loading done by SkinFactory. SkinProvider also introduces the flexibility to create and manage external
- * skin repositories. Thus we have better manageability of Skins and clear separation of external skins and
- * trinidad provided / supported skins.
+ * All methods in this class dealing with skin management activities such as loading, creating,
+ * managing and disposing skins are deprecated. It is recommended to use SkinProvider instead of
+ * SkinFactory for the deprecated APIs. SkinProvider introduces lazy / on-demand loading of skins as
+ * opposed to eager loading done by SkinFactory. SkinProvider also introduces the flexibility to
+ * create and manage external skin repositories. Thus we have better manageability of Skins and
+ * clear separation of external skins and trinidad provided / supported skins.
  * <p/>
  * SkinFactory exists today to provide SkinProvider implementers an easy way to create a Skin object
- * without having to implement Skin interface.This is done using SkinFactory#createSkin API.
- * Skin object created using this API can be used by the SkinProvider implementation's SkinProvider#getSkin methods.
- * SkinProvider implementation should take care of managing the skin and destroy it when required.
+ * without having to implement Skin interface.This is done using SkinFactory#createSkin API. Skin
+ * object created using this API can be used by the SkinProvider implementation's
+ * SkinProvider#getSkin methods. SkinProvider implementation should take care of managing the skin
+ * and destroy it when required.
  * <p/>
- * Creating a Skin using this SkinFactory#createSkin API is different from adding a Skin into SkinFactory using
- * SkinFactory#addSkin.
- * With SkinFactory#createSkin the responsibility of managing the Skin and returning is in response to
- * SkinProvider#getSkin calls is with the SkinProvider and with SkinFactory#addSkin, this responsibility is
- * with the SkinFactory.
+ * Creating a Skin using this SkinFactory#createSkin API is different from adding a Skin into
+ * SkinFactory using SkinFactory#addSkin. With SkinFactory#createSkin the responsibility of managing
+ * the Skin and returning is in response to SkinProvider#getSkin calls is with the SkinProvider and
+ * with SkinFactory#addSkin, this responsibility is with the SkinFactory.
+ *
  * @see SkinProvider
  * @see Skin
  * @see SkinMetadata
@@ -81,108 +83,112 @@ abstract public class SkinFactory
   }
 
   /**
-   * Creates a Skin based on the supplied base skin information and skinMetadata information.
-   * This API can be used by SkinProvider implementers to create Skin objects which their SkinProvider implementation
-   * supports. As a minimum, the user of this API should pass information to obtain the base skin through
-   * 'baseSkinMetadata' and provide information such as id, family, renderkit etc for the new skin through
-   * 'skinMetadata'.
-   * @param context
-   * @param baseSkinMetadata {@link SkinMetadata} metadata to find the base skin for the new skin to be created.
-   *                                             The user should pass enough information to pick the base skin
-   *                                             with id / family / version / renderkit.
-   *                                             Base skin is obtained using SkinProvider#getSkin API.
-   * @param skinMetadata {@link SkinMetadata} metadata to create new Skin. The user should pass
-   *                                         all information such as id, family, version, renderkit,
-   *                                         styleSheetName, features, metadata etc. for the new skin.
-   * @return a new skin {@link Skin} object created using the skinMetadata {@link SkinMetadata} supplied
-   * @throws IllegalArgumentException if the baseSkinId contained in the supplied skinMetadata
-   *         did not match the id of the baseSkin obtained using baseSkinMetadata
-   * @throws ClassCastException if SkinProvider does not provide as matching base skin as
-   *                            per metadata passed in baseSkinMetadata
-   */
-  public Skin createSkin(FacesContext context, SkinMetadata baseSkinMetadata, SkinMetadata skinMetadata)
-  {
-    throw new UnsupportedOperationException(_LOG.getMessage("SKIN_FACTORY_NO_CREATE_SKIN_SUPPORT", this));
+   * Creates a Skin based on the supplied base skin information and skinMetadata information. This
+   * API can be used by SkinProvider implementers to create Skin objects which their SkinProvider
+   * implementation supports. As a minimum, the user of this API should pass information to obtain
+   * the base skin through 'baseSkinMetadata' and provide information such as id, family, renderkit
+   * etc for the new skin through 'skinMetadata'.
+   *
+   * @param externalContext  valid ExternalContext
+   * @param baseSkinMetadata {@link SkinMetadata} metadata to find the base skin for the new skin to
+   *                         be created. The user should pass enough information to pick the base
+   *                         skin with id / family / version / renderkit. Base skin is obtained
+   *                         using SkinProvider#getSkin API.
+   * @param skinMetadata     {@link SkinMetadata} metadata to create new Skin. The user should pass
+   *                         all information such as id, family, version, renderkit, styleSheetName,
+   *                         features, metadata etc. for the new skin.
+   * @return a new skin {@link Skin} object created using the skinMetadata {@link SkinMetadata}
+   * supplied
+   * @throws IllegalArgumentException if the baseSkinId contained in the supplied skinMetadata did
+   *                                  not match the id of the baseSkin obtained using
+   *                                  baseSkinMetadata
+   * @throws ClassCastException       if SkinProvider does not provide as matching base skin as per
+   *                                  metadata passed in baseSkinMetadata
+   */
+  public Skin createSkin(
+    ExternalContext externalContext,
+    SkinMetadata baseSkinMetadata,
+    SkinMetadata skinMetadata)
+  {
+    throw new UnsupportedOperationException(_LOG.getMessage("SKIN_FACTORY_NO_CREATE_SKIN_SUPPORT",
+                                                            this));
   }
 
   /**
-   * Creates a Skin based on the supplied base skin information and skinMetadata information.
-   * This API can be used by SkinProvider implementers to create Skin objects which their SkinProvider implementation
-   * supports. As a minimum, the user of this API should pass information such as baseSkinId,
-   * id, family, renderkit etc for the new skin through 'skinMetadata'.
-   * @param context
-   * @param skinMetadata {@link SkinMetadata} metadata to create new Skin. The user should pass
-   *                                         all information such as baseSkinId, id, family, version, renderkit,
-   *                                         styleSheetName, features, metadata etc. for the new skin.
-   *                                         baseSkinId is mandatory, since it is used to query the base skin
-   *                                         for the new skin using SkinProvider#getSkin API.
-   * @return a new skin {@link Skin} object created using the skinMetadata {@link SkinMetadata} supplied
-   * @throws IllegalArgumentException if the baseSkinId contained in the supplied
-   *         skinMetadata did not match the id of the baseSkin obtained from SkinProvider#getSkin
-   */
-  public Skin createSkin(FacesContext context, SkinMetadata skinMetadata)
-  {
-    throw new UnsupportedOperationException(_LOG.getMessage("SKIN_FACTORY_NO_CREATE_SKIN_SUPPORT", this));
+   * Creates a Skin based on the supplied base skin information and skinMetadata information. This
+   * API can be used by SkinProvider implementers to create Skin objects which their SkinProvider
+   * implementation supports. As a minimum, the user of this API should pass information such as
+   * baseSkinId, id, family, renderkit etc for the new skin through 'skinMetadata'.
+   *
+   * @param externalContext valid ExternalContext
+   * @param skinMetadata    {@link SkinMetadata} metadata to create new Skin. The user should
+   *                        pass all information such as baseSkinId, id, family, version, renderkit,
+   *                        styleSheetName, features, metadata etc. for the new skin. baseSkinId is
+   *                        mandatory, since it is used to query the base skin for the new skin
+   *                        using SkinProvider#getSkin API.
+   * @return a new skin {@link Skin} object created using the skinMetadata {@link SkinMetadata}
+   * supplied
+   * @throws IllegalArgumentException if the baseSkinId contained in the supplied skinMetadata did
+   *                                  not match the id of the baseSkin obtained from
+   *                                  SkinProvider#getSkin
+   */
+  public Skin createSkin(ExternalContext externalContext, SkinMetadata skinMetadata)
+  {
+    throw new UnsupportedOperationException(_LOG.getMessage("SKIN_FACTORY_NO_CREATE_SKIN_SUPPORT",
+                                                            this));
   }
 
   /**
-   * Reloads the skins that was registered with this factory.
-   * Subclassers can choose to provide the implementation.
-   * @deprecated use SkinProvider SPI to deal with externals skins
-   * this functionality will now be replaced by having the SkinProvider
-   * implementations reloading skins themselves as and when required.
+   * Reloads the skins that was registered with this factory. Subclassers can choose to provide the
+   * implementation.
+   *
+   * @deprecated use SkinProvider SPI to deal with externals skins this functionality will now be
+   * replaced by having the SkinProvider implementations reloading skins themselves as and when
+   * required.
    */
   @Deprecated
   public void reload()
   {
     _LOG.warning("SKIN_FACTORY_NO_RELOAD_SUPPORT", this);
   }
-  
+
   /**
-   * <p>Register the specified {@link Skin} instance, associated with
-   * the specified <code>skinId</code>, to be supported by this
-   * {@link SkinFactory}, replacing any previously registered
-   * {@link Skin} for this identifier.</p>
+   * <p>Register the specified {@link Skin} instance, associated with the specified
+   * <code>skinId</code>, to be supported by this {@link SkinFactory}, replacing any previously
+   * registered {@link Skin} for this identifier.</p>
    *
    * @param skinId Identifier of the {@link Skin} to register
-   * @param skin {@link Skin} instance that we are registering
-   * @deprecated use SkinProvider SPI to deal with externals skins
-   * Implementing SkinProvider and exposing skins using SkinProvider#getSkin()
-   * method is recommended than using this API to make skins available at runtime.
+   * @param skin   {@link Skin} instance that we are registering
+   * @deprecated use SkinProvider SPI to deal with externals skins Implementing SkinProvider and
+   * exposing skins using SkinProvider#getSkin() method is recommended than using this API to make
+   * skins available at runtime.
    */
   @Deprecated
   public abstract void addSkin(String skinId, Skin skin);
 
 
   /**
-   * <p>Return a {@link Skin} instance for the specified skinId. 
-   * If there is no registered {@link
-   * Skin} for the specified identifier, return
-   * <code>null</code>.  The set of available skin identifiers
-   * is available via the <code>getSkinIds()</code> method.</p>
-   *
-   * @param context FacesContext for the request currently being
-   * processed, or <code>null</code> if none is available.
-   * @param skinId Skin identifier of the requested
-   *  {@link Skin} instance
+   * <p>Return a {@link Skin} instance for the specified skinId. If there is no registered {@link
+   * Skin} for the specified identifier, return <code>null</code>.  The set of available skin
+   * identifiers is available via the <code>getSkinIds()</code> method.</p>
+   *
+   * @param context FacesContext for the request currently being processed, or <code>null</code> if
+   *                none is available.
+   * @param skinId  Skin identifier of the requested {@link Skin} instance
    * @deprecated use SkinProvider#getSkin method to query skins
    */
   @Deprecated
   public abstract Skin getSkin(FacesContext context, String skinId);
 
   /**
-   * <p>Return a {@link Skin} instance for the specified skinFamily and
-   * renderKitId. 
-   * If there is no registered {@link
-   * Skin} for the specified identifier, return
-   * <code>null</code>.  The set of available skin identifiers
-   * is available via the <code>getSkinIds()</code> method.</p>
-   *
-   * @param context FacesContext for the request currently being
-   * processed, or <code>null</code> if none is available.
-   * @param family family of the requested {@link Skin} instance
-   * @param renderKitId RenderKit identifier of the requested
-   *  {@link Skin} instance
+   * <p>Return a {@link Skin} instance for the specified skinFamily and renderKitId. If there is no
+   * registered {@link Skin} for the specified identifier, return <code>null</code>.  The set of
+   * available skin identifiers is available via the <code>getSkinIds()</code> method.</p>
+   *
+   * @param context     FacesContext for the request currently being processed, or <code>null</code>
+   *                    if none is available.
+   * @param family      family of the requested {@link Skin} instance
+   * @param renderKitId RenderKit identifier of the requested {@link Skin} instance
    * @deprecated use SkinProvider#getSkin method to query skins
    */
   @Deprecated
@@ -190,24 +196,22 @@ abstract public class SkinFactory
     FacesContext context,
     String family,
     String renderKitId);
-  
+
+
 
   /**
-   * <p>Return a {@link Skin} instance for the specified skinFamily and
-   * renderKitId, and skin version. The best matched skin is returned. 
-   * If there is no registered {@link
-   * Skin} for the specified identifier, return
-   * <code>null</code>.  The set of available skin identifiers
-   * is available via the <code>getSkinIds()</code> method.</p>
-   *
-   * @param context FacesContext for the request currently being
-   * processed, or <code>null</code> if none is available.
-   * @param family family of the requested {@link Skin} instance
-   * @param renderKitId RenderKit identifier of the requested
-   *  {@link Skin} instance
-   *  @param version A string that denotes the skin version name. It can be "default" or
-   *  the name of the version (see the Skin's SkinVersion#getName) or null which
-   *  returns the skin with no version set.
+   * <p>Return a {@link Skin} instance for the specified skinFamily and renderKitId, and skin
+   * version. The best matched skin is returned. If there is no registered {@link Skin} for the
+   * specified identifier, return <code>null</code>.  The set of available skin identifiers is
+   * available via the <code>getSkinIds()</code> method.</p>
+   *
+   * @param context     FacesContext for the request currently being processed, or <code>null</code>
+   *                    if none is available.
+   * @param family      family of the requested {@link Skin} instance
+   * @param renderKitId RenderKit identifier of the requested {@link Skin} instance
+   * @param version     A string that denotes the skin version name. It can be "default" or the name
+   *                    of the version (see the Skin's SkinVersion#getName) or null which returns
+   *                    the skin with no version set.
    * @deprecated use SkinProvider#getSkin method to query skins
    */
   @Deprecated
@@ -216,11 +220,11 @@ abstract public class SkinFactory
     String family,
     String renderKitId,
     String version);
-  
+
   /**
-   * <p>Return an <code>Iterator</code> over the set of skin
-   * identifiers registered with this factory.
-   * </p>
+   * <p>Return an <code>Iterator</code> over the set of skin identifiers registered with this
+   * factory. </p>
+   *
    * @deprecated use SkinProvider#getSkinMetadata to get the list of skins supported
    */
   @Deprecated
@@ -232,8 +236,8 @@ abstract public class SkinFactory
     return Thread.currentThread().getContextClassLoader();
   }
 
-  static private final Map<ClassLoader, SkinFactory> _FACTORIES = 
+  private static final Map<ClassLoader, SkinFactory> _FACTORIES =
     new WeakHashMap<ClassLoader, SkinFactory>();
-  private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(
-    SkinFactory.class);
+  private static final TrinidadLogger                _LOG       =
+    TrinidadLogger.createTrinidadLogger(SkinFactory.class);
 }

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinMetadata.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinMetadata.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinMetadata.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinMetadata.java Tue Dec  3 18:31:33 2013
@@ -24,31 +24,37 @@ import java.util.Map;
 import javax.el.ValueExpression;
 
 /**
- * SkinMetadata encapsulates information about a skin. SkinMetadata is instantiated using the nested Builder class.
+ * SkinMetadata encapsulates information about a skin. SkinMetadata is instantiated using the nested
+ * Builder class.
  * <pre>
  * {@code
- * SkinMetadata mySkinMetadata = new SkinMetadata.Builder().baseSkinId("alta-v1.desktop").id("mySkin.desktop")
- *                               .family("mySkin").renderKitId(SkinMetadata.RenderKit.DESKTOP)
- *                              .styleSheetName("my/css/location.css").version(new SkinVersion("v1")).build();
+ * SkinMetadata mySkinMetadata = new SkinMetadata.Builder()
+ *                                    .baseSkinId("alta-v1.desktop")
+ *                                    .id("mySkin.desktop")
+ *                                    .family("mySkin")
+ *                                    .renderKitId(SkinMetadata.RenderKit.DESKTOP)
+ *                                    .styleSheetName("my/css/location.css")
+ *                                    .version(new SkinVersion("v1"))
+ *                                    .build();
  * }
  * </pre>
- * SkinMetadata is used mainly in two ways:
- * First, as a representation of a Skin.
- * Second, as a means to query Skins.
+ * SkinMetadata is used mainly in two ways: First, as a representation of a Skin. Second, as a means
+ * to query Skins.
  * <p/>
- * SkinProvider#getSkinMetadata returns a collection of SkinMetadata.
- * The collection returned from this method can be built by the SkinProvider implementations beforehand, so that
- * it can publish the information about the skins that it supports to callers. Creation of SkinMetadata is a far
- * less costly process than creating a Skin. SkinMetadata created for this purpose should contain all relevant
- * information.
- * SkinProviders can also use SkinMetadata objects to create the actual Skin objects using SkinFactory#createSkin
- * API as well. In this case, SkinMetadata should be well formed with all relevant information so that SkinFactory
- * can create the skin.
+ * SkinProvider#getSkinMetadata returns a collection of SkinMetadata. The collection returned from
+ * this method can be built by the SkinProvider implementations beforehand, so that it can publish
+ * the information about the skins that it supports to callers. Creation of SkinMetadata is a far
+ * less costly process than creating a Skin. SkinMetadata created for this purpose should contain
+ * all relevant information. SkinProviders can also use SkinMetadata objects to create the actual
+ * Skin objects using SkinFactory#createSkin API as well. In this case, SkinMetadata should be well
+ * formed with all relevant information so that SkinFactory can create the skin.
  * <p/>
- * SkinMetadata is used as query object to retrieve Skin from a SkinProvider#getSkin. Querying Skins are based on
- * id, family, version and renderkit. For querying Skins, user should set either id or family as mandatory.
- * Other information (even if present) are not relevant while searching for a skin.
+ * SkinMetadata is used as query object to retrieve Skin from a SkinProvider#getSkin. Querying Skins
+ * are based on id, family, version and renderkit. For querying Skins, user should set either id or
+ * family as mandatory. Other information (even if present) are not relevant while searching for a
+ * skin.
  * <p/>
+ *
  * @see SkinProvider
  * @see Builder
  * @see Skin
@@ -114,9 +120,8 @@ public final class SkinMetadata
   }
 
   /**
-   * @return styleSheetName for the Skin. This points to the actual Skin file
-   * and is loaded using NameResolver
-   * {@link org.apache.myfaces.trinidad.share.io.NameResolver} implementation.
+   * @return styleSheetName for the Skin. This points to the actual Skin file and is loaded using
+   * NameResolver {@link org.apache.myfaces.trinidad.share.io.NameResolver} implementation.
    */
   public String getStyleSheetName()
   {
@@ -124,9 +129,9 @@ public final class SkinMetadata
   }
 
   /**
-   * @return resource bundle name for the Skin which contains the translations.
-   * If both translationSource and resourceBundleName is provided,
-   * resourceBundleName takes the preceedence.
+   * @return resource bundle name for the Skin which contains the translations. If both
+   * translationSource and resourceBundleName is provided, resourceBundleName takes the
+   * precedence.
    */
   public String getResourceBundleName()
   {
@@ -134,9 +139,9 @@ public final class SkinMetadata
   }
 
   /**
-   * @return translation source for the Skin, alternate way to specify the translations.
-   * If both translationSource and resourceBundleName is provided,
-   * resourceBundleName takes the preceedence.
+   * @return translation source for the Skin, alternate way to specify the translations. If both
+   * translationSource and resourceBundleName is provided, resourceBundleName takes the
+   * precedence.
    */
   public ValueExpression getTranslationSource()
   {
@@ -178,14 +183,24 @@ public final class SkinMetadata
 
     if (_id != null ? !_id.equals(that._id) : that._id != null) return false;
     if (_family != null ? !_family.equals(that._family) : that._family != null) return false;
-    if (_renderKitId != null ? !_renderKitId.equals(that._renderKitId) : that._renderKitId != null) return false;
-    if (_resourceBundleName != null ? !_resourceBundleName.equals(that._resourceBundleName) : that._resourceBundleName != null) return false;
-    if (_styleSheetName != null ? !_styleSheetName.equals(that._styleSheetName) : that._styleSheetName != null) return false;
-    if (_translationSource != null ? !_translationSource.equals(that._translationSource) : that._translationSource != null) return false;
+    if (_renderKitId != null ? !_renderKitId.equals(that._renderKitId) : that._renderKitId != null)
+      return false;
+    if (_resourceBundleName != null
+        ? !_resourceBundleName.equals(that._resourceBundleName)
+        : that._resourceBundleName != null) return false;
+    if (_styleSheetName != null
+        ? !_styleSheetName.equals(that._styleSheetName)
+        : that._styleSheetName != null) return false;
+    if (_translationSource != null
+        ? !_translationSource.equals(that._translationSource)
+        : that._translationSource != null) return false;
     if (_version != null ? !_version.equals(that._version) : that._version != null) return false;
-    if (_baseSkinId != null ? !_baseSkinId.equals(that._baseSkinId) : that._baseSkinId != null) return false;
-    if (_features != null ? !_features.equals(that._features) : that._features != null) return false;
-    if (_metadata != null ? !_metadata.equals(that._metadata) : that._metadata != null) return false;
+    if (_baseSkinId != null ? !_baseSkinId.equals(that._baseSkinId) : that._baseSkinId != null)
+      return false;
+    if (_features != null ? !_features.equals(that._features) : that._features != null)
+      return false;
+    if (_metadata != null ? !_metadata.equals(that._metadata) : that._metadata != null)
+      return false;
 
     return true;
   }
@@ -232,7 +247,7 @@ public final class SkinMetadata
       toString.append(_features).append(", ");
     if (_metadata != null && !_metadata.isEmpty())
       toString.append(_metadata).append(", ");
-    toString.append(']') ;
+    toString.append(']');
 
     return toString.toString();
   }
@@ -279,7 +294,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Returns the RenderKit instance or <code>null</code> if no id matches or id is passed as null.
+     * Returns the RenderKit instance or <code>null</code> if no id matches or id is passed as
+     * null.
+     *
      * @param id of RenderKit to return
      * @return RenderKit with the specified id
      * @throws IllegalArgumentException if there is no enum with the specified name.
@@ -297,7 +314,8 @@ public final class SkinMetadata
       return renderKit;
     }
 
-    private static final Map<String, RenderKitId> ID_TO_RENDER_KIT = new HashMap<String, RenderKitId>();
+    private static final Map<String, RenderKitId> ID_TO_RENDER_KIT =
+      new HashMap<String, RenderKitId>();
 
     static
     {
@@ -313,13 +331,17 @@ public final class SkinMetadata
   }
 
   /**
-   * convenience builder class for SkinMetadata
-   * SkinMetadata object can be created using this:
+   * convenience builder class for SkinMetadata SkinMetadata object can be created using this:
    * <pre>
    * {@code
-   * SkinMetadata mySkinMetadata = new SkinMetadata.Builder().baseSkinId("alta-v1.desktop").id("mySkin.desktop")
-   *                               .family("mySkin").renderKitId(SkinMetadata.RenderKit.DESKTOP)
-   *                              .styleSheetName("my/css/location.css").version(new SkinVersion("v1")).build();
+   * SkinMetadata mySkinMetadata = new SkinMetadata.Builder()
+   *                                .baseSkinId("alta-v1.desktop")
+   *                                .id("mySkin.desktop")
+   *                                .family("mySkin")
+   *                                .renderKitId(SkinMetadata.RenderKit.DESKTOP)
+   *                                .styleSheetName("my/css/location.css")
+   *                                .version(new SkinVersion("v1"))
+   *                                .build();
    * }
    * </pre>
    */
@@ -333,9 +355,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Mandatory while creating a Skin using SkinFactory#createSkin
-     * can be used while querying Skin using SkinProvider#getSkin
-     * either this or family is typically set while querying Skin
+     * Mandatory while creating a Skin using SkinFactory#createSkin can be used while querying Skin
+     * using SkinProvider#getSkin either this or family is typically set while querying Skin
+     *
      * @param id
      * @return
      */
@@ -346,9 +368,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Mandatory while creating a Skin using SkinFactory#createSkin
-     * can be used while querying Skin using SkinProvider#getSkin
-     * either this or id is typically set while querying Skin
+     * Mandatory while creating a Skin using SkinFactory#createSkin can be used while querying Skin
+     * using SkinProvider#getSkin either this or id is typically set while querying Skin
+     *
      * @param family
      * @return
      */
@@ -359,8 +381,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Recommended to be set while creating a Skin using SkinFactory#createSkin
-     * can be used while querying Skin using SkinProvider#getSkin
+     * Recommended to be set while creating a Skin using SkinFactory#createSkin can be used while
+     * querying Skin using SkinProvider#getSkin
+     *
      * @param renderKitId
      * @return
      */
@@ -371,8 +394,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Mandatory while creating a Skin using SkinFactory#createSkin
-     * Not used while querying Skin using SkinProvider#getSkin
+     * Mandatory while creating a Skin using SkinFactory#createSkin Not used while querying Skin
+     * using SkinProvider#getSkin
+     *
      * @param styleSheetName
      * @return
      */
@@ -383,8 +407,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Recommended to be set while creating a Skin using SkinFactory#createSkin
-     * Not used while querying Skin using SkinProvider#getSkin
+     * Recommended to be set while creating a Skin using SkinFactory#createSkin Not used while
+     * querying Skin using SkinProvider#getSkin
+     *
      * @param resourceBundleName
      * @return
      */
@@ -395,8 +420,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Recommended to be set while creating a Skin using SkinFactory#createSkin
-     * Not used while querying Skin using SkinProvider#getSkin
+     * Recommended to be set while creating a Skin using SkinFactory#createSkin Not used while
+     * querying Skin using SkinProvider#getSkin
+     *
      * @param translationSource
      * @return
      */
@@ -407,8 +433,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Mandatory while creating a Skin using SkinFactory#createSkin
-     * Not used while querying Skin using SkinProvider#getSkin
+     * Mandatory while creating a Skin using SkinFactory#createSkin Not used while querying Skin
+     * using SkinProvider#getSkin
+     *
      * @param baseSkinId
      * @return
      */
@@ -419,8 +446,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Recommended to be set while creating a Skin using SkinFactory#createSkin
-     * can be used while querying Skin using SkinProvider#getSkin
+     * Recommended to be set while creating a Skin using SkinFactory#createSkin can be used while
+     * querying Skin using SkinProvider#getSkin
+     *
      * @param version
      * @return
      */
@@ -431,8 +459,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Recommended to be set (if applicable) while creating a Skin using SkinFactory#createSkin
-     * Not used while querying Skin using SkinProvider#getSkin
+     * Recommended to be set (if applicable) while creating a Skin using SkinFactory#createSkin Not
+     * used while querying Skin using SkinProvider#getSkin
+     *
      * @param features
      * @return
      */
@@ -447,8 +476,9 @@ public final class SkinMetadata
     }
 
     /**
-     * Recommended to be set (if applicable) while creating a Skin using SkinFactory#createSkin
-     * Not used while querying Skin using SkinProvider#getSkin
+     * Recommended to be set (if applicable) while creating a Skin using SkinFactory#createSkin Not
+     * used while querying Skin using SkinProvider#getSkin
+     *
      * @param metadata
      * @return
      */
@@ -464,6 +494,7 @@ public final class SkinMetadata
 
     /**
      * call this method after you have set all the information that you wanted to
+     *
      * @return
      */
     public SkinMetadata build()
@@ -471,26 +502,26 @@ public final class SkinMetadata
       return new SkinMetadata(this);
     }
 
-    private String _id;
-    private String _family;
-    private RenderKitId _renderKitId;
-    private String _styleSheetName;
-    private String _resourceBundleName;
+    private String          _id;
+    private String          _family;
+    private RenderKitId     _renderKitId;
+    private String          _styleSheetName;
+    private String          _resourceBundleName;
     private ValueExpression _translationSource;
-    private String _baseSkinId;
-    private SkinVersion _version;
-    private SkinFeatures _features;
-    private CustomMetadata _metadata;
+    private String          _baseSkinId;
+    private SkinVersion     _version;
+    private SkinFeatures    _features;
+    private CustomMetadata  _metadata;
   }
 
-  private String _id;
-  private String _family;
-  private RenderKitId _renderKitId;
-  private String _baseSkinId;
-  private String _styleSheetName;
-  private String _resourceBundleName;
+  private String          _id;
+  private String          _family;
+  private RenderKitId     _renderKitId;
+  private String          _baseSkinId;
+  private String          _styleSheetName;
+  private String          _resourceBundleName;
   private ValueExpression _translationSource;
-  private SkinVersion _version;
-  private SkinFeatures _features;
-  private CustomMetadata _metadata;
+  private SkinVersion     _version;
+  private SkinFeatures    _features;
+  private CustomMetadata  _metadata;
 }
\ No newline at end of file

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinProvider.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinProvider.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinProvider.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinProvider.java Tue Dec  3 18:31:33 2013
@@ -22,43 +22,44 @@ import java.util.Collection;
 import java.util.Collections;
 
 import javax.faces.context.ExternalContext;
-import javax.faces.context.FacesContext;
 
 /**
- * SkinProvider SPI is used to create, load, manage, and dispose skins. SkinProvider introduces lazy / on-demand
- * loading of skins as opposed to eager loading done by SkinFactory. SkinProvider also introduces the flexibility
- * to create and manage external skin repositories. Thus we have better manageability of Skins and clear separation of
- * external skins and trinidad provided / supported skins.
+ * SkinProvider SPI is used to create, load, manage, and dispose skins. SkinProvider introduces lazy
+ * / on-demand loading of skins as opposed to eager loading done by SkinFactory. SkinProvider also
+ * introduces the flexibility to create and manage external skin repositories. Thus we have better
+ * manageability of Skins and clear separation of external skins and trinidad provided / supported
+ * skins.
  * <p/>
- * For each such skin repository externally maintained, the user should register their SkinProvider as an SPI.
- * Classes implementing this abstraction should be listed in the jar's /META-INF/services folder
- * inside of a text file named "org.apache.myfaces.trinidad.skin.SkinProvider".
- * These services will then be run by trinidad skin framework and be used for all SkinProvider#getSkin or
+ * For each such skin repository externally maintained, the user should register their SkinProvider
+ * as an SPI. Classes implementing this abstraction should be listed in the jar's /META-INF/services
+ * folder inside of a text file named "org.apache.myfaces.trinidad.skin.SkinProvider". These
+ * services will then be run by trinidad skin framework and be used for all SkinProvider#getSkin or
  * SkinProvider#getSkinMetadata calls.
  * <p/>
- * A SkinProvider implementation shall return a Skin object in response to SkinProvider#getSkin API call,
- * if a Skin matching the skinMetadata requested is available in the particular implementation.
- * The SkinProvider implementer can make use of SkinFactory#createSkin API to create a Skin object
- * instead of implementing the abstract Skin APIs. For this, information about the new skin and its base skin
- * has to be passed to SkinFactory#createSkin. See SkinFactory#createSkin documentation for details.
- * SkinProvider#getSkin API implementation can decide to return a cached skin or a new skin object for
- * subsequent request for the same Skin. It can also choose not to return a skin for a criteria which it served
- * before (if the implementation finds that the Skin is now deleted or discontinued).
- * Thus the SkinProvider implementation needs to manage the lifecycle of the Skin by creating, modifying
- * and destroying it.
- *
- * If a Skin supported by the implementation is modified (by the Skin file change or any other change
- * in Skin properties), the SkinProvider implementation needs to convey this to trinidad skinning framework
- * so that the Skin can be reloaded. This can be done using Skin.setDirty() method.
- * Calling this method sets the Skin as dirty and trinidad skinning framework will reload the skin and
- * regenerate the css for the skin.
+ * A SkinProvider implementation shall return a Skin object in response to SkinProvider#getSkin API
+ * call, if a Skin matching the skinMetadata requested is available in the particular
+ * implementation. The SkinProvider implementer can make use of SkinFactory#createSkin API to create
+ * a Skin object instead of implementing the abstract Skin APIs. For this, information about the new
+ * skin and its base skin has to be passed to SkinFactory#createSkin. See SkinFactory#createSkin
+ * documentation for details. SkinProvider#getSkin API implementation can decide to return a cached
+ * skin or a new skin object for subsequent request for the same Skin. It can also choose not to
+ * return a skin for a criteria which it served before (if the implementation finds that the Skin is
+ * now deleted or discontinued). Thus the SkinProvider implementation needs to manage the lifecycle
+ * of the Skin by creating, modifying and destroying it.
+ * <p/>
+ * If a Skin supported by the implementation is modified (by the Skin file change or any other
+ * change in Skin properties), the SkinProvider implementation needs to convey this to trinidad
+ * skinning framework so that the Skin can be reloaded. This can be done using Skin.setDirty()
+ * method. Calling this method sets the Skin as dirty and trinidad skinning framework will reload
+ * the skin and regenerate the css for the skin.
  * <p/>
  * SkinProvider implementation can optionally publish a list of supported skins by returning a
- * Collection of SkinMetadata objects from SkinProvider#getSkinMetadata API. The collection can be built by the
- * SkinProvider implementations beforehand. This also helps in publishing the information about the skins
- * that it intends to support. See SkinMetadata documentation for details.
- * SkinMetadata created for this method should be done without creating the actual Skin objects.
- * Thus the implementation will support lazy loading of Skins.
+ * Collection of SkinMetadata objects from SkinProvider#getSkinMetadata API. The collection can be
+ * built by the SkinProvider implementations beforehand. This also helps in publishing the
+ * information about the skins that it intends to support. See SkinMetadata documentation for
+ * details. SkinMetadata created for this method should be done without creating the actual Skin
+ * objects. Thus the implementation will support lazy loading of Skins.
+ *
  * @see SkinFactory
  * @see SkinMetadata
  */
@@ -66,53 +67,52 @@ public abstract class SkinProvider
 {
   /**
    * Returns the Skin for the given skin metadata
+   * <p/>
+   * The returned skin is not cached by the framework and thus it is the responsibility of the
+   * provider to return the same instance of the skin should it desire so.
    *
-   * The returned skin is not cached by the framework and thus it
-   * is the responsibility of the provider to return the same instance
-   * of the skin should it desire so.
-   * @param context
-   * @param skinMetadata   search criteria object containing the information of skin to be queried
-   *                       id, family, renderKit, version are the information used from skin metadata
-   *                       to perform search for the skin requested.
-   *                       Other fields do not participate in the search.
+   * @param context      valid ExternalContext
+   * @param skinMetadata search criteria object containing the information of skin to be queried id,
+   *                     family, renderKit, version are the information used from skin metadata to
+   *                     perform search for the skin requested. Other fields do not participate in
+   *                     the search.
    * @return Skin matching the search criteria
    */
-  public abstract Skin getSkin(FacesContext context, SkinMetadata skinMetadata);
+  public abstract Skin getSkin(ExternalContext context, SkinMetadata skinMetadata);
 
   /**
    * A provider can optionally return information about some or all of the skins it provides.
-   * Typically this information is generated without loading the skins
-   * as this is a quick way to find out about the Skins in the provider and also thereby
-   * supporting lazy loading of Skins.
-   * SkinMetadata for a Skin should contain only features and metadata that it
-   * explicitly supports. It should not contain the features and metadata that
-   * belongs only to its parent skins.
-   * @param context
-   * @return
+   * Typically this information is generated without loading the skins as this is a quick way to
+   * find out about the Skins in the provider and also thereby supporting lazy loading of Skins.
+   * SkinMetadata for a Skin should contain only features and metadata that it explicitly supports.
+   * It should not contain the features and metadata that belongs only to its parent skins.
+   *
+   * @param context valid ExternalContext
+   * @return Collection of SkinMetadata representing the Skins supported by this SkinProvider
    */
-  public Collection<SkinMetadata> getSkinMetadata(FacesContext context)
+  public Collection<SkinMetadata> getSkinMetadata(ExternalContext context)
   {
     return Collections.emptyList();
   }
 
   /**
-   * static factory method to get hold of the current SkinProvider instance.
-   * This can be used to get a SkinProvider to query for a skin or metadata
-   * @param ec
-   * @return
+   * static factory method to get hold of the current SkinProvider instance. This can be used to get
+   * a SkinProvider to query for a skin or metadata
+   *
+   * @param externalContext valid ExternalContext
+   * @return SkinProvider instance
    */
-  public static SkinProvider getCurrentInstance(ExternalContext ec)
+  public static SkinProvider getCurrentInstance(ExternalContext externalContext)
   {
-    if (ec == null)
+    if (externalContext == null)
       throw new NullPointerException("ExternalContext is passed as null");
 
-    SkinProvider sp = (SkinProvider) ec.getApplicationMap().get(SKIN_PROVIDER_INSTANCE_KEY);
-
-    return sp;
+    return (SkinProvider) externalContext.getApplicationMap().get(SKIN_PROVIDER_INSTANCE_KEY);
   }
 
   /**
    * Key for the SkinProvider stored in ExternalContext
    */
-  public static final String SKIN_PROVIDER_INSTANCE_KEY = "org.apache.myfaces.trinidad.skin.SKIN_PROVIDER_INSTANCE";
+  public static final String SKIN_PROVIDER_INSTANCE_KEY =
+    "org.apache.myfaces.trinidad.skin.SKIN_PROVIDER_INSTANCE";
 }
\ No newline at end of file

Modified: myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java (original)
+++ myfaces/trinidad/trunk/trinidad-api/src/main/java/org/apache/myfaces/trinidad/skin/SkinVersion.java Tue Dec  3 18:31:33 2013
@@ -32,8 +32,9 @@ final public class SkinVersion
 {
   /**
    * Constructor that takes a version name.
-   * @param name the name of the version, like "v1". If name is "default" then we set default as true and name to null.
-   *             If name is null, it is converted to "".
+   *
+   * @param name the name of the version, like "v1". If name is "default" then we set default as
+   *             true and name to null. If name is null, it is converted to "".
    */
   public SkinVersion(String name)
   {
@@ -43,26 +44,28 @@ final public class SkinVersion
 
   /**
    * Constructor that takes a name and a defaultVersion.
-   * @param name the name of the version, like "v1". If name is null, it is converted to "".
-   * @param defaultVersion true if this skin is the default version for all skins with the
-   * same skin family
+   *
+   * @param name           the name of the version, like "v1". If name is null, it is converted to
+   *                       "".
+   * @param defaultVersion true if this skin is the default version for all skins with the same skin
+   *                       family
    */
   public SkinVersion(
     String  name,
     boolean defaultVersion)
   {
-    if(name == null) 
+    if (name == null)
       name = "";
-    
+
     _default = defaultVersion;
     _name = name;
   }
-  
+
   public boolean isDefault()
   {
     return _default;
   }
-  
+
   public String getName()
   {
     return _name;
@@ -77,20 +80,20 @@ final public class SkinVersion
     {
       return false;
     }
-    SkinVersion test = (SkinVersion)o;
+    SkinVersion test = (SkinVersion) o;
     return (test.isDefault() == this.isDefault()) &&
-      (test.getName().equals(this.getName()));
+             (test.getName().equals(this.getName()));
   }
-  
+
   @Override
   final public int hashCode()
   {
     int hash = 17;
-    hash = 37*hash + this.getName().hashCode();
-    hash = 37*hash + ((this.isDefault()) ? 1231 : 1237 );
+    hash = 37 * hash + this.getName().hashCode();
+    hash = 37 * hash + ((this.isDefault()) ? 1231 : 1237);
 
-    return hash; 
-  } 
+    return hash;
+  }
 
   @Override
   public String toString()
@@ -102,10 +105,10 @@ final public class SkinVersion
   }
 
   private final boolean _default;
-  private final String _name;
+  private final String  _name;
 
   // If the skin doesn't explicitly have a version, then it will return EMPTY_SKIN_VERSION
   // when skin.getVersion is called. This makes our skin picking code cleaner.
-  public static final SkinVersion EMPTY_SKIN_VERSION = new SkinVersion("");
-  private static final String _DEFAULT = "default";
+  public static final  SkinVersion EMPTY_SKIN_VERSION = new SkinVersion("");
+  private static final String      _DEFAULT           = "default";
 }
\ No newline at end of file

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/CoreRenderingContext.java Tue Dec  3 18:31:33 2013
@@ -62,13 +62,12 @@ import org.apache.myfaces.trinidadintern
 public class CoreRenderingContext extends RenderingContext
 {
   /**
-   * String marker used to indicate the style class is empty and can
-   * be ignored.
+   * String marker used to indicate the style class is empty and can be ignored.
    */
-  static public final String EMPTY_STYLE_CLASS = "";
-  
-  static public final String SKIN_ID_PARAM = "org.apache.myfaces.trinidad.skin.id";
-  static public final String SKIN_STYLESHEET_ID_PARAM = "org.apache.myfaces.trinidad.skin.stylesheet.id";
+  static public final String EMPTY_STYLE_CLASS        = "";
+  static public final String SKIN_ID_PARAM            = "org.apache.myfaces.trinidad.skin.id";
+  static public final String SKIN_STYLESHEET_ID_PARAM =
+    "org.apache.myfaces.trinidad.skin.stylesheet.id";
 
   public CoreRenderingContext()
   {
@@ -77,9 +76,7 @@ public class CoreRenderingContext extend
 
     _facesContext = context;
     _requestContext = afContext;
-    
     _properties = new HashMap<Object, Object>();
-
     _outputMode = afContext.getOutputMode();
     _agent = _initializeAgent(context,
                               afContext.getAgent(),
@@ -98,10 +95,10 @@ public class CoreRenderingContext extend
     _accessibilityProfile = afContext.getAccessibilityProfile();
     if (_accessibilityProfile == null)
       _accessibilityProfile = AccessibilityProfile.getDefaultInstance();
-    
+
     _isDesignTime = _isDesignTime(_agent);
   }
-  
+
   /**
    * Cached access to FacesContext.
    */
@@ -110,7 +107,7 @@ public class CoreRenderingContext extend
   {
     return _facesContext;
   }
-  
+
   /**
    * Cached access to RequestContext
    */
@@ -130,14 +127,12 @@ public class CoreRenderingContext extend
   }
 
   /**
-   * Called by link containers prior to rendering their children
-   * in order to suppress the rendering of the default link
-   * style class (.OraLink).  Most link containers (like tabBar,
-   * globalHeader) provide their own style classes - the default
-   * OraLink style class ends up getting in the way.
-   *
-   * Important: Each call to setDefaultLinkStyleClassDisabled(true)
-   * must be followed by a matching call to setDefaultLinkStyleClassDisabled(false).
+   * Called by link containers prior to rendering their children in order to suppress the rendering
+   * of the default link style class (.OraLink).  Most link containers (like tabBar, globalHeader)
+   * provide their own style classes - the default OraLink style class ends up getting in the way.
+   * <p/>
+   * Important: Each call to setDefaultLinkStyleClassDisabled(true) must be followed by a matching
+   * call to setDefaultLinkStyleClassDisabled(false).
    */
   public void setDefaultLinkStyleDisabled(boolean isDisabled)
   {
@@ -158,9 +153,9 @@ public class CoreRenderingContext extend
 
   /**
    * Called by link containers to force a link to render as disabled
-   *
-   * Important: Each call to setLinkDisabled(true)
-   * must be followed by a matching call to setLinkDisabled(false).
+   * <p/>
+   * Important: Each call to setLinkDisabled(true) must be followed by a matching call to
+   * setLinkDisabled(false).
    */
   public void setLinkDisabled(boolean isDisabled)
   {
@@ -168,7 +163,6 @@ public class CoreRenderingContext extend
   }
 
 
-
   // Implementation of RenderingContext
 
   @Override
@@ -264,7 +258,7 @@ public class CoreRenderingContext extend
   public Skin getSkin()
   {
     // this might switch the skin from portlet to desktop depending upon the request map parameters.
-    if(!_checkedRequestMapSkin)
+    if (!_checkedRequestMapSkin)
     {
       Skin requestedSkin = getRequestMapSkin();
       _checkedRequestMapSkin = true;
@@ -277,20 +271,21 @@ public class CoreRenderingContext extend
     }
     return _skin;
   }
-  
+
   /**
    * Return the Styles object that is attached to this RenderingContext. You can use the Styles
-   * object to retrieve a map of the skin selectors and their css properties, already resolved
-   * for this specific request. A skin has selectors for all agents, locales, etc., and there
-   * might be blocks for ie-only or gecko-only or rtl, etc., and the resolved styles are styles
-   * for the specific request (agent, locale, aliases are merged, etc).
+   * object to retrieve a map of the skin selectors and their css properties, already resolved for
+   * this specific request. A skin has selectors for all agents, locales, etc., and there might be
+   * blocks for ie-only or gecko-only or rtl, etc., and the resolved styles are styles for the
+   * specific request (agent, locale, aliases are merged, etc).
+   *
    * @return
    */
   @Override
   public Styles getStyles()
   {
     return getStyleContext().getStyles();
-  }  
+  }
 
   /**
    * Get an interface that can be used for style lookups and generation.
@@ -300,7 +295,8 @@ public class CoreRenderingContext extend
     if (_styleContext == null)
     {
       _styleContext = new StyleContextImpl(this,
-                                          getTemporaryDirectory(getFacesContext(), isDesignTime()));
+                                           getTemporaryDirectory(getFacesContext(),
+                                                                 isDesignTime()));
     }
 
     return _styleContext;
@@ -444,8 +440,7 @@ public class CoreRenderingContext extend
   }
 
   /**
-   * Return the default skin family, which is "casablanca" for the
-   * core renderkit.
+   * Return the default skin family, which is "casablanca" for the core renderkit.
    */
   protected String getDefaultSkinFamily()
   {
@@ -487,25 +482,27 @@ public class CoreRenderingContext extend
     if (isRequestedSkinSupported() || isDesignTime())
     {
       FacesContext context = getFacesContext();
+      ExternalContext externalContext = context.getExternalContext();
       Object requestedSkinId = getRequestMapSkinId(context);
       if (requestedSkinId != null)
       {
 
-        SkinProvider skinProvider = SkinProvider.getCurrentInstance(context.getExternalContext());
+        SkinProvider skinProvider = SkinProvider.getCurrentInstance(externalContext);
         if (skinProvider == null)
         {
           _LOG.warning("NO_SKIN_PROVIDER");
           return null;
         }
 
-        Skin requestedSkin = skinProvider.getSkin(context, new SkinMetadata.Builder().id(requestedSkinId.toString()).build());
+        SkinMetadata metadata = new SkinMetadata.Builder().id(requestedSkinId.toString()).build();
+        Skin requestedSkin = skinProvider.getSkin(externalContext, metadata);
         if (requestedSkin != null)
         {
           // In portlet mode, we will switch to using the requestedSkin
           // (the skin requested by the portlet's producer on the requestMap) if it exists.
           // Otherwise we'll use the portal skin.
           if (_LOG.isFine())
-            _LOG.fine("The skin " +requestedSkinId+ " specified on the requestMap will be used.");
+            _LOG.fine("The skin " + requestedSkinId + " specified on the requestMap will be used.");
           _requestMapSkin = requestedSkin;
 
           // Check here if the stylesheet ids match. This method logs a warning if we cannot
@@ -515,8 +512,10 @@ public class CoreRenderingContext extend
           // wrap in the RequestSkinWrapper, else we get property/icon
           // not found errors
           return new RequestSkinWrapper(requestedSkin);
-          // todo Should I wrap it in something that says that we don't need to compress. In FileSystemStyleCache,
-          // we could look to see what kind of skin it is??? Portal skins have a styleClassMap, but they
+          // todo Should I wrap it in something that says that we don't need to compress. In
+          // FileSystemStyleCache,
+          // we could look to see what kind of skin it is??? Portal skins have a styleClassMap,
+          // but they
           // do not want compression.
 
         }// end requestedSkin != null
@@ -524,7 +523,7 @@ public class CoreRenderingContext extend
         {
           if (_LOG.isWarning())
           {
-            _LOG.warning("REQUESTMAP_SKIN_NOT_USED_BECAUSE_NOT_EXIST",requestedSkinId);
+            _LOG.warning("REQUESTMAP_SKIN_NOT_USED_BECAUSE_NOT_EXIST", requestedSkinId);
           }
         }
       }
@@ -536,10 +535,10 @@ public class CoreRenderingContext extend
   /**
    * Look on the requestMap for "org.apache.myfaces.trinidad.skin.id", and return
    * the skin id.
-   * This is for clients who want to send to the server 
+   * This is for clients who want to send to the server
    * the skin id via a request scope rather
-  // than using the trinidad-config.xml's skin-family. The examples are the 
-  // design time and a portal container.
+   * than using the trinidad-config.xml's skin-family. The examples are the
+   * design time and a portal container.
    * @param facesContext
    * @return the skin id that is on the request map.
    */
@@ -555,10 +554,11 @@ public class CoreRenderingContext extend
 
   /**
    * This helps figure out if the portlet producer can share the portlet consumer's stylesheet.
+   *
    * @param context
    * @param requestedSkin The skin that the portlet consumer wants the producer to share.
-   * @return true if the skin stylesheet id parameter on the request map is equal to
-                  the requestedSkin's stylesheetId.
+   * @return true if the skin stylesheet id parameter on the request map is equal to the
+   * requestedSkin's stylesheetId.
    */
   public boolean isRequestMapStyleSheetIdAndSkinEqual(
     FacesContext context,
@@ -582,10 +582,10 @@ public class CoreRenderingContext extend
             // directory. Otherwise the following code would get an error when it
             // tries to getStyleDir. This could possibly be done better.
             getStyleContext().getStyleProvider();
-            
+
             String skinForPortalStyleSheetId = requestedSkin.getStyleSheetDocumentId(this);
             if (skinForPortalStyleSheetId != null &&
-              skinForPortalStyleSheetId.equals(requestMapStyleSheetId))
+                  skinForPortalStyleSheetId.equals(requestMapStyleSheetId))
             {
               _styleSheetDocumentIdMatch = Boolean.TRUE;
             }
@@ -619,11 +619,11 @@ public class CoreRenderingContext extend
   }
 
   /**
-   * Set the local variable _skin to be the Skin from the
-   * SkinFactory that best matches
-   * the <skin-family> and current render-kit-id.
-   * @param context    FacesContext
-   * @param afContext  RequestContext
+   * Set the local variable _skin to be the Skin from the SkinFactory that best matches the
+   * <skin-family> and current render-kit-id.
+   *
+   * @param context   FacesContext
+   * @param afContext RequestContext
    */
   @SuppressWarnings("unchecked")
   private void _initializeSkin(
@@ -634,7 +634,7 @@ public class CoreRenderingContext extend
     String skinFamily = afContext.getSkinFamily();
     if (skinFamily == null)
       skinFamily = getDefaultSkinFamily();
-    
+
     // get skin-version
     String skinVersionString = afContext.getSkinVersion();
 
@@ -651,17 +651,20 @@ public class CoreRenderingContext extend
       renderKitId = TrinidadRenderingConstants.APACHE_TRINIDAD_PDA;
     }
 
-
-    SkinProvider skinProvider = SkinProvider.getCurrentInstance(context.getExternalContext());
+    ExternalContext externalContext = context.getExternalContext();
+    SkinProvider skinProvider = SkinProvider.getCurrentInstance(externalContext);
     if (skinProvider == null)
     {
       _LOG.warning("NO_SKIN_PROVIDER");
       return;
     }
     // skinFamily, renderKitId, skinVersionString
+    SkinMetadata.RenderKitId renderKitIdObj = SkinMetadata.RenderKitId.fromId(renderKitId);
     SkinMetadata metadata = new SkinMetadata.Builder().family(skinFamily)
-      .renderKitId(SkinMetadata.RenderKitId.fromId(renderKitId)).version(new SkinVersion(skinVersionString)).build();
-    Skin skin = skinProvider.getSkin(context, metadata);
+                                                      .renderKitId(renderKitIdObj)
+                                                      .version(new SkinVersion(skinVersionString))
+                                                      .build();
+    Skin skin = skinProvider.getSkin(externalContext, metadata);
 
     if (skin == null)
     {
@@ -678,7 +681,6 @@ public class CoreRenderingContext extend
   }
 
 
-
   private TrinidadAgent _initializeAgent(
     FacesContext context,
     Agent        base,
@@ -705,13 +707,13 @@ public class CoreRenderingContext extend
     }
     else if (CoreRenderKit.OUTPUT_MODE_PORTLET.equals(outputMode))
     {
-      if(ExternalContextUtils.isRequestTypeSupported(RequestType.RESOURCE))
+      if (ExternalContextUtils.isRequestTypeSupported(RequestType.RESOURCE))
       {
         //Set things up for the Portlet 2.0 container.
         return AgentUtil.mergeCapabilities(agent, _ENHANCED_PORTLET_CAPABILITIES);
       }
       else
-      { 
+      {
         return AgentUtil.mergeCapabilities(agent, _PORTLET_CAPABILITIES);
       }
     }
@@ -722,7 +724,7 @@ public class CoreRenderingContext extend
     else if (CoreRenderKit.OUTPUT_MODE_WEB_CRAWLER.equals(outputMode))
     {
       return AgentUtil.mergeCapabilities(agent, _WEB_CRAWLER_CAPABILITIES);
-    }    
+    }
     else
     {
       return agent;
@@ -749,6 +751,7 @@ public class CoreRenderingContext extend
 
   /**
    * Get the directory for temporary files.
+   *
    * @todo: move into the util package?
    */
   @SuppressWarnings("unchecked")
@@ -757,7 +760,6 @@ public class CoreRenderingContext extend
     String path = null;
 
     ExternalContext external = fContext.getExternalContext();
-    
     Map<String, Object> applicationMap = external.getApplicationMap();
 
     if (applicationMap != null)
@@ -768,21 +770,21 @@ public class CoreRenderingContext extend
       // we're a portlet), we have to write to the global temporary
       // directory.  That's not good - does the portlet spec define
       // anything?
-      File tempdir = (File)
-        applicationMap.get("javax.servlet.context.tempdir");
+      File tempdir = (File) applicationMap.get("javax.servlet.context.tempdir");
       if (tempdir == null)
       {
         // In design-time land, just write to the temporary directory.
         // But what
         if (isDesignTime ||
-            !(external.getContext() instanceof ServletContext))
+              !(external.getContext() instanceof ServletContext))
         {
           tempdir = new File(System.getProperty("java.io.tmpdir"));
           path = tempdir.getAbsolutePath();
         }
         else
         {
-          _LOG.severe("The java.io.File handle (\"javax.servlet.context.tempdir\") is not set in the ServletContext");
+          _LOG.severe("The java.io.File handle (\"javax.servlet.context.tempdir\") is not set in " +
+                        "the ServletContext");
         }
       }
       else
@@ -827,25 +829,25 @@ public class CoreRenderingContext extend
   }
 
 
-  private Skin                _skin;
-  private boolean             _checkedRequestMapSkin = false;
-  private Skin                _requestMapSkin;
-  private Object              _styleSheetDocumentIdMatch;
-  private FormData            _formData;
-  private TrinidadAgent       _agent;
-  private Map<String, String> _styleMap;
-  private Map<String, String> _skinResourceKeyMap;
-  private String              _outputMode;
+  private Skin                         _skin;
+  private Skin                         _requestMapSkin;
+  private Object                       _styleSheetDocumentIdMatch;
+  private FormData                     _formData;
+  private TrinidadAgent                _agent;
+  private Map<String, String>          _styleMap;
+  private Map<String, String>          _skinResourceKeyMap;
+  private String                       _outputMode;
   private RequestContext.Accessibility _accessibilityMode;
   private AccessibilityProfile         _accessibilityProfile;
-  private boolean _animationEnabled;
-  private PartialPageContext  _pprContext;
-  private LocaleContext       _localeContext;
-  private StyleContext        _styleContext;
-  private Map<Object, Object> _properties;
-  private int                 _linkStyleDisabledCount = 0;
-  private boolean             _isLinkDisabled = false;
-  private final FacesContext _facesContext;
+  private boolean                      _animationEnabled;
+  private PartialPageContext           _pprContext;
+  private LocaleContext                _localeContext;
+  private StyleContext                 _styleContext;
+  private Map<Object, Object>          _properties;
+  private boolean _checkedRequestMapSkin  = false;
+  private int     _linkStyleDisabledCount = 0;
+  private boolean _isLinkDisabled         = false;
+  private final FacesContext   _facesContext;
   private final RequestContext _requestContext;
   private final boolean        _isDesignTime;
 
@@ -863,7 +865,7 @@ public class CoreRenderingContext extend
 
   static private final Map<Object, Object> _PORTLET_CAPABILITIES =
     new HashMap<Object, Object>();
-  
+
   static private final Map<Object, Object> _ENHANCED_PORTLET_CAPABILITIES =
     new HashMap<Object, Object>();
 
@@ -904,28 +906,28 @@ public class CoreRenderingContext extend
 
     // for now, the Web Crawler capabilities are the same as the EMail capabilities
     _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_INTRINSIC_EVENTS,
-                            Boolean.FALSE);
+                                  Boolean.FALSE);
     _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_SCRIPTING_SPEED,
-                            TrinidadAgent.SCRIPTING_SPEED_CAP_NONE);
+                                  TrinidadAgent.SCRIPTING_SPEED_CAP_NONE);
     _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_EDITING,
-                            Boolean.FALSE);
+                                  Boolean.FALSE);
     // =-= bts I wouldn't think that we would output any style sheets for a web crawler
     _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_STYLE_ATTRIBUTES,
                                   TrinidadAgent.STYLES_INTERNAL);
     _WEB_CRAWLER_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
                                   Boolean.FALSE);
-    
+
     _PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING,
-                            Boolean.FALSE);
+                              Boolean.FALSE);
     _PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_MULTIPLE_WINDOWS,
-                            Boolean.FALSE);
-    
-    _ENHANCED_PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_MULTIPLE_WINDOWS,
                               Boolean.FALSE);
-    
+
+    _ENHANCED_PORTLET_CAPABILITIES.put(TrinidadAgent.CAP_MULTIPLE_WINDOWS,
+                                       Boolean.FALSE);
+
 
     // turn off PPR
-    _ATTACHMENT_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING, Boolean.FALSE);    
+    _ATTACHMENT_CAPABILITIES.put(TrinidadAgent.CAP_PARTIAL_RENDERING, Boolean.FALSE);
   }
 
   static private final TrinidadLogger _LOG =

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/TranslationsResourceLoader.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/TranslationsResourceLoader.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/TranslationsResourceLoader.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/resource/TranslationsResourceLoader.java Tue Dec  3 18:31:33 2013
@@ -32,6 +32,7 @@ import java.util.ResourceBundle;
 import java.util.Set;
 
 import javax.faces.application.Application;
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.context.LocaleContext;
@@ -192,10 +193,12 @@ abstract public class TranslationsResour
   protected Skin getSkin(FacesContext context)
   {
     Skin skin = null;
-    SkinProvider skinProvider = SkinProvider.getCurrentInstance(context.getExternalContext());
-    Object skinIdObj = context.getExternalContext().getRequestParameterMap().get("skinId");
+    ExternalContext externalContext = context.getExternalContext();
+    SkinProvider skinProvider = SkinProvider.getCurrentInstance(externalContext);
+    Object skinIdObj = externalContext.getRequestParameterMap().get("skinId");
+
     if (skinIdObj != null)
-      skin = skinProvider.getSkin(context, new SkinMetadata.Builder().id(skinIdObj.toString()).build());
+      skin = skinProvider.getSkin(externalContext, new SkinMetadata.Builder().id(skinIdObj.toString()).build());
 
     return skin;
   }

Modified: myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java?rev=1547514&r1=1547513&r2=1547514&view=diff
==============================================================================
--- myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java (original)
+++ myfaces/trinidad/trunk/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/skin/SkinFactoryImpl.java Tue Dec  3 18:31:33 2013
@@ -23,6 +23,7 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
+import javax.faces.context.ExternalContext;
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
@@ -32,13 +33,13 @@ import org.apache.myfaces.trinidad.skin.
 import org.apache.myfaces.trinidad.skin.SkinMetadata;
 import org.apache.myfaces.trinidad.skin.SkinProvider;
 import org.apache.myfaces.trinidad.skin.SkinVersion;
-import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlConstants;
 import org.apache.myfaces.trinidadinternal.skin.provider.ExternalSkinProvider;
 
 
 /**
- * Factory for creating Skin objects.
- * To create and manage skins external to skin framework, use SkinProvider.
+ * Factory for creating Skin objects. To create and manage skins external to skin framework, use
+ * SkinProvider.
+ *
  * @see org.apache.myfaces.trinidad.skin.SkinProvider
  */
 public class SkinFactoryImpl extends SkinFactory
@@ -56,15 +57,19 @@ public class SkinFactoryImpl extends Ski
    * @inheritDoc
    */
   @Override
-  public Skin createSkin(FacesContext context, SkinMetadata baseSkinMetadata, SkinMetadata skinMetadata)
+  public Skin createSkin(
+    ExternalContext externalContext,
+    SkinMetadata baseSkinMetadata,
+    SkinMetadata skinMetadata)
   {
-    if (context == null ||  baseSkinMetadata == null || skinMetadata == null)
+    if (externalContext == null || baseSkinMetadata == null || skinMetadata == null)
       throw new NullPointerException(_LOG.getMessage("NULL_FC_SKIN_BASE_SKIN_METADATA"));
 
-    if (baseSkinMetadata.getId() != null && !baseSkinMetadata.getId().equals(skinMetadata.getBaseSkinId()))
+    if (baseSkinMetadata.getId() != null &&
+          !baseSkinMetadata.getId().equals(skinMetadata.getBaseSkinId()))
       throw new IllegalArgumentException(_LOG.getMessage("INVALID_BASE_SKIN_ID"));
 
-    Skin baseSkin = SkinProvider.getCurrentInstance(context.getExternalContext()).getSkin(context, baseSkinMetadata);
+    Skin baseSkin = SkinProvider.getCurrentInstance(externalContext).getSkin(externalContext, baseSkinMetadata);
 
     if (baseSkin == null)
       throw new IllegalArgumentException(_LOG.getMessage("INVALID_BASE_SKIN"));
@@ -76,17 +81,18 @@ public class SkinFactoryImpl extends Ski
    * @inheritDoc
    */
   @Override
-  public Skin createSkin(FacesContext context, SkinMetadata skinMetadata)
+  public Skin createSkin(ExternalContext externalContext, SkinMetadata skinMetadata)
   {
-    if (context == null || skinMetadata == null)
+    if (externalContext == null || skinMetadata == null)
       throw new NullPointerException(_LOG.getMessage("NULL_FC_SKIN_METADATA"));
 
     if (skinMetadata.getBaseSkinId() == null)
       throw new NullPointerException(_LOG.getMessage("NULL_BASE_SKIN_ID"));
 
-    SkinMetadata baseSkinMetadata = new SkinMetadata.Builder().id(skinMetadata.getBaseSkinId()).build();
+    SkinMetadata baseSkinMetadata =
+      new SkinMetadata.Builder().id(skinMetadata.getBaseSkinId()).build();
 
-    return createSkin(context, baseSkinMetadata, skinMetadata);
+    return createSkin(externalContext, baseSkinMetadata, skinMetadata);
   }
 
    /**
@@ -94,7 +100,7 @@ public class SkinFactoryImpl extends Ski
     * the specified <code>skinId</code>, to be supported by this
     * {@link SkinFactory}, replacing any previously registered
     * {@link Skin} for this identifier.</p>
-    * 
+    *
     * <p>A warning will be logged if a previously registered {@link Skin} was replaced, since it could produce
     * inconsistent results if the application cached the previously registered Skin.</p>
     *
@@ -104,9 +110,7 @@ public class SkinFactoryImpl extends Ski
     */
   @Override
   @Deprecated
-  public  void addSkin(
-    String skinId,
-    Skin   skin)
+  public void addSkin(String skinId, Skin skin)
   {
     if (skinId == null || skin == null)
     {
@@ -114,9 +118,11 @@ public class SkinFactoryImpl extends Ski
       return;
     }
 
+    SkinMetadata.RenderKitId renderKitId = SkinMetadata.RenderKitId.fromId(skin.getRenderKitId());
     SkinMetadata.Builder builder = new SkinMetadata.Builder().id(skinId)
-            .family(skin.getFamily()).version(skin.getVersion())
-            .renderKitId(SkinMetadata.RenderKitId.fromId(skin.getRenderKitId()));
+                                                             .family(skin.getFamily())
+                                                             .version(skin.getVersion())
+                                                             .renderKitId(renderKitId);
 
     if (skin.getBaseSkin() != null)
       builder.baseSkinId(skin.getBaseSkin().getId());
@@ -124,7 +130,7 @@ public class SkinFactoryImpl extends Ski
     if (skin.getSkinFeatures() != null)
       builder.features(new SkinFeatures(skin.getSkinFeatures()));
 
-    Skin previousValue = _getExternalSkinProvider(null).addSkin(builder.build(), skin);
+    Skin previousValue = _getExternalSkinProvider().addSkin(builder.build(), skin);
 
     if (previousValue != null)
       _LOG.warning("DUPLICATE_ADD_SKIN_TO_SKIN_FACTORY", skinId);
@@ -133,6 +139,7 @@ public class SkinFactoryImpl extends Ski
 
   /**
    * given the skinId, pass back the Skin.
+   *
    * @param context FacesContext. If not available, pass in null.
    * @param skinId
    * @return Skin that is in this SkinFactory and has the skinId.
@@ -140,10 +147,9 @@ public class SkinFactoryImpl extends Ski
    */
   @Deprecated
   @Override
-  public Skin getSkin(
-    FacesContext context,
-    String       skinId)
+  public Skin getSkin(FacesContext context, String skinId)
   {
+    context = SkinUtils.getNonNullFacesContext(context);
 
     if (skinId == null)
     {
@@ -151,44 +157,43 @@ public class SkinFactoryImpl extends Ski
       return null;
     }
 
-    return SkinUtils.getSkinProvider(context).getSkin(context, new SkinMetadata.Builder().id(skinId).build());
+    ExternalContext ec = context.getExternalContext();
+    SkinMetadata skinMetadata = new SkinMetadata.Builder().id(skinId).build();
+    return SkinProvider.getCurrentInstance(ec).getSkin(ec, skinMetadata);
   }
 
   /**
    * given the skinFamily and renderKitId, pass back the Skin.
-   * @param context FacesContext for the request currently being
-   * processed, or <code>null</code> if none is available.
-   * @param family skin family of the requested {@link Skin} instance
-   * @param renderKitId RenderKit identifier of the requested:
-   * XhtmlConstants.APACHE_TRINIDAD_DESKTOP, XhtmlConstants.APACHE_TRINIDAD_PDA, or
-   * XhtmlConstants.APACHE_TRINIDAD_PORTLET
-   *  {@link Skin} instance
+   *
+   * @param context     FacesContext for the request currently being processed, or <code>null</code>
+   *                    if none is available.
+   * @param family      skin family of the requested {@link Skin} instance
+   * @param renderKitId RenderKit identifier of the requested: XhtmlConstants
+   *                    .APACHE_TRINIDAD_DESKTOP, XhtmlConstants.APACHE_TRINIDAD_PDA, or
+   *                    XhtmlConstants.APACHE_TRINIDAD_PORTLET {@link Skin} instance
    * @deprecated use SkinProvider to query skins
    */
   @Deprecated
   @Override
-  public Skin getSkin(
-    FacesContext context,
-    String       family,
-    String       renderKitId)
+  public Skin getSkin(FacesContext context, String family, String renderKitId)
   {
     return getSkin(context, family, renderKitId, null);
   }
 
   /**
-   * Given the skin family, renderKitId, and version, return the best matched skin.
-   * The skin picking logic is:
-   * If an exact family, renderKitId, and version (including null or "") is found, return that skin
-   * Else if the user asks for version "default", return the skin with family and renderKitId with version marked
-   * default. If version wasn't default and does not match any version for the skins with family and renderKitId, 
-   * then return the 'default' skin if there is one marked or return the last entry in the list
-   * of matching family/renderKitId skins.
+   * Given the skin family, renderKitId, and version, return the best matched skin. The skin picking
+   * logic is: If an exact family, renderKitId, and version (including null or "") is found, return
+   * that skin Else if the user asks for version "default", return the skin with family and
+   * renderKitId with version marked default. If version wasn't default and does not match any
+   * version for the skins with family and renderKitId, then return the 'default' skin if there is
+   * one marked or return the last entry in the list of matching family/renderKitId skins.
+   *
    * @param context
    * @param family
    * @param renderKitId
-   * @param version The version of the skin you want to return. This can be 
-   *                "default", or a version name (e.g., "v1"), or null or ""
-   *                (if you want the skin that does not have a version set).
+   * @param version     The version of the skin you want to return. This can be "default", or a
+   *                    version name (e.g., "v1"), or null or "" (if you want the skin that does not
+   *                    have a version set).
    * @return the best matched Skin given the family, renderKitId, and version.
    * @deprecated use SkinProvider to query skins
    */
@@ -196,25 +201,34 @@ public class SkinFactoryImpl extends Ski
   @Override
   public Skin getSkin(
     FacesContext context,
-    String       family,
-    String       renderKitId,
-    String       version)
+    String family,
+    String renderKitId,
+    String version)
   {
+    context = SkinUtils.getNonNullFacesContext(context);
+
     // By setting the version to the empty string if version is null, we can
     // get the skin that has a matching family and renderkit and has no skin version.
     // (A Skin with no version returns SkinVersion.EMPTY_SKIN_VERSION for skin.getVersion(),
     // and getName will be "")
     if (version == null)
-        version = "";
-  
+      version = "";
+
     // given a skinFamily and a renderKitId, figure out the skinId.
     // If we don't have an exact match, use the simple skin that matches the
     // renderKitId (simple.desktop or simple.pda)
     if (family == null)
-     throw new NullPointerException("Null skin family");
+      throw new NullPointerException("Null skin family");
+
+    SkinVersion skinVersion = new SkinVersion(version);
+    SkinMetadata.RenderKitId renderKitIdObj = SkinMetadata.RenderKitId.fromId(renderKitId);
+    SkinMetadata metadata = new SkinMetadata.Builder().family(family)
+                                                      .version(skinVersion)
+                                                      .renderKitId(renderKitIdObj)
+                                                      .build();
 
-    Skin matchingSkin = SkinUtils.getSkinProvider(context).getSkin(context, new SkinMetadata.Builder().
-      family(family).version(new SkinVersion(version)).renderKitId(SkinMetadata.RenderKitId.fromId(renderKitId)).build());
+    ExternalContext ec = context.getExternalContext();
+    Skin matchingSkin = SkinProvider.getCurrentInstance(ec).getSkin(ec, metadata);
 
     return (matchingSkin == null) ? null : new RequestSkinWrapper(matchingSkin);
   }
@@ -226,7 +240,10 @@ public class SkinFactoryImpl extends Ski
   @Override
   public Iterator<String> getSkinIds()
   {
-    Collection<SkinMetadata> metadatas = _getExternalSkinProvider(null).getSkinMetadata(null);
+    FacesContext context = SkinUtils.getNonNullFacesContext(null);
+    ExternalContext extContext = context.getExternalContext();
+    ExternalSkinProvider extSkinProvider = ExternalSkinProvider.getCurrentInstance(extContext);
+    Collection<SkinMetadata> metadatas = extSkinProvider.getSkinMetadata(extContext);
     Set<String> ids = new HashSet<String>();
 
     for (SkinMetadata metadata : metadatas)
@@ -242,18 +259,14 @@ public class SkinFactoryImpl extends Ski
   @Override
   public void reload()
   {
-    _getExternalSkinProvider(null).reload();
+    _getExternalSkinProvider().reload();
   }
 
-  private ExternalSkinProvider _getExternalSkinProvider(FacesContext context)
+  private ExternalSkinProvider _getExternalSkinProvider()
   {
-    if (context == null)
-      context = FacesContext.getCurrentInstance();
-
-    if (context == null)
-      throw new NullPointerException("Cannot retrieve FacesContext. FacesContext is null.");
-
-    return ExternalSkinProvider.getCurrentInstance(context.getExternalContext());
+    FacesContext context = SkinUtils.getNonNullFacesContext(null);
+    ExternalContext extContext = context.getExternalContext();
+    return ExternalSkinProvider.getCurrentInstance(extContext);
   }
 
   static private final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(SkinFactoryImpl.class);



Mime
View raw message