All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javax.faces.view.facelets.FaceletCache Maven / Gradle / Ivy

/*
 * 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 javax.faces.view.facelets;

import java.io.IOException;
import java.net.URL;

/**
 * 
 * @author Leonardo Uribe
 * @since 2.1
 */
public abstract class FaceletCache
{
    private FaceletCache.MemberFactory _faceletFactory;
    private FaceletCache.MemberFactory _viewMetadataFaceletFactory;
    
    public abstract V getFacelet(URL url) throws IOException;
    
    public abstract boolean isFaceletCached(URL url);
    
    public abstract V getViewMetadataFacelet(URL url) throws IOException;
    
    public abstract boolean isViewMetadataFaceletCached(URL url);
    
    protected void setMemberFactories(FaceletCache.MemberFactory faceletFactory,
                                      FaceletCache.MemberFactory viewMetadataFaceletFactory)
    {
        if (faceletFactory == null)
        {
            throw new NullPointerException("faceletFactory is null");
        }
        if  (viewMetadataFaceletFactory == null)
        {
            throw new NullPointerException("viewMetadataFaceletFactory is null");
        }
        _faceletFactory = faceletFactory;
        _viewMetadataFaceletFactory = viewMetadataFaceletFactory;
    }

    protected FaceletCache.MemberFactory getMemberFactory()
    {
        return _faceletFactory;
    }
    
    protected FaceletCache.MemberFactory getMetadataMemberFactory()
    {
        return _viewMetadataFaceletFactory;
    }
    
    public static interface MemberFactory
    {
        V newInstance(URL key) throws IOException;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy