docs: @Override
      public BeanInfo getComponentMetadata(FacesContext context, Resource componentResource)
      {
          BeanInfo beanInfo = null;
  
          checkNull(context, "context");
  
          try
          {
              Facelet compositeComponentFacelet;
              FaceletFactory.setInstance(_faceletFactory);
              try
              {
                  compositeComponentFacelet
                          = _faceletFactory.getCompositeComponentMetadataFacelet(componentResource.getURL());
              }
              finally
              {
                  FaceletFactory.setInstance(null);
              }
              //context.getAttributes().put(BUILDING_COMPOSITE_COMPONENT_METADATA, Boolean.TRUE);
  
              // Create a temporal tree where all components will be put, but we are only
              // interested in metadata.
              UINamingContainer compositeComponentBase
                      = (UINamingContainer) context.getApplication().createComponent(
                      context, UINamingContainer.COMPONENT_TYPE, null);
  
              // Fill the component resource key, because this information should be available
              // on metadata to recognize which is the component used as composite component base.
              // Since this method is called from Application.createComponent(FacesContext,Resource),
              // and in that specific method this key is updated, this is the best option we
              // have for recognize it (also this key is used by UIComponent.isCompositeComponent)
              compositeComponentBase.getAttributes().put(Resource.COMPONENT_RESOURCE_KEY, componentResource);
  
              // According to UserTagHandler, in this point we need to wrap the facelet
              // VariableMapper, so local changes are applied on "page context", but
              // data is retrieved from full context
              FaceletContext faceletContext = (FaceletContext) context.
                      getAttributes().get(FaceletContext.FACELET_CONTEXT_KEY);
              VariableMapper orig = faceletContext.getVariableMapper();
              try
              {
                  faceletContext.setVariableMapper(new VariableMapperWrapper(orig));
  
                  compositeComponentBase.pushComponentToEL(context, compositeComponentBase);
  
                  compositeComponentFacelet.apply(context, compositeComponentBase);
  
                  compositeComponentBase.popComponentFromEL(context);
              }
              finally
              {
                  faceletContext.setVariableMapper(orig);
              }
  
              beanInfo = (BeanInfo) compositeComponentBase.getAttributes().get(UIComponent.BEANINFO_KEY);
          }
          catch (IOException e)
          {
              throw new FacesException(e);
          }
          //finally
          //{
          //context.getAttributes().remove(BUILDING_COMPOSITE_COMPONENT_METADATA);
          //}
  
          return beanInfo;
      }