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

net.jawr.web.resource.bundle.JoinableResourceBundle Maven / Gradle / Ivy

Go to download

Javascript/CSS bundling and compressing tool for java web apps. By using jawr resources are automatically bundled together and optionally minified and gzipped. Jawr provides tag libraries to reference a generated bundle either by id or by using the name of any of its members.

There is a newer version: 3.9
Show newest version
/**
 * Copyright 2007-2014 Jordi Hernández Sellés, Ibrahim Chaehoi
 * 
 * Licensed 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 net.jawr.web.resource.bundle;

import java.util.List;
import java.util.Map;
import java.util.Set;

import net.jawr.web.resource.bundle.iterator.BundlePath;
import net.jawr.web.resource.bundle.postprocess.ResourceBundlePostProcessor;
import net.jawr.web.resource.bundle.variant.VariantSet;

/**
 * Represents a group of related resources which will be referred to by 
 * a single name.  
 * 
 * @author Jordi Hernández Sellés
 * @author Ibrahim Chaehoi
 */
public interface JoinableResourceBundle {
	
	/** The licencing file name */
	public static final String LICENSES_FILENAME = ".license";
	
	/** The sorting file name */
	public static final String SORT_FILE_NAME = ".sorting";
		
	/**
	 * Returns the bundle name 
	 * @return the bundle name
	 */
	public String getName();
	
	/**
	 * Returns the ID for this bundle. The URL, which will identify the bundle.
	 * It will normally end with .js or .css, 
	 * since it will be used to refer to the bundle in URLs. 
	 * @return the ID for this bundle
	 */
	public String getId();
	
	/**
	 * Returns true if the bundle if composite
	 * @return true if the bundle if composite
	 */
	public boolean isComposite();
	
	/**
	 * Get the InclusionPattern to determine when/if this bundle should be
	 * included with current configuration. 
	 * @return the InclusionPattern
	 */
	public InclusionPattern getInclusionPattern();
	
	/**
	 * Sets the mappings, which should be used for the bundle
	 * @param mappings the mapping of the resources of the bundle
	 */
	public void setMappings(List mappings);
	
	/**
	 * Returns an ordered list with all the items pertaining to this bundle. 
	 * @return an ordered list with all the items pertaining to this bundle. 
	 */
	public List getItemPathList();
	
	/**
	 * Returns an ordered list with all the items pertaining to this bundle. 
	 * @return an ordered list with all the items pertaining to this bundle. 
	 */
	public List getItemDebugPathList();
	
	/**
	 * Returns a set with the license files to include with this bundle. 
	 * @return a set with the license files to include with this bundle. 
	 */
	public Set getLicensesPathList();
	
	/**
	 * Determines if an item path belongs to the bundle. 
	 * @param itemPath the item path
	 * @return true if an item path belongs to the bundle. 
	 */
	public boolean belongsToBundle(String itemPath);
        
	/**
	 * Returns the bundle prefix
	 * 
	 * @return the bundle prefix
	 */
	public String getBundlePrefix();
	
    /**
     * Get the URL prefix for this Bundle. It is used to force redownloading
     * when needed. 
     * @return the URL prefix for this Bundle.
     */
    public String getURLPrefix(Map variants);
    
    /**
     * Get the postprocessor to use in resources before adding them to the bundle
     * @return the postprocessor to use in resources before adding them to the bundle
     */
    public ResourceBundlePostProcessor getUnitaryPostProcessor();
    
    
    /**
     * Get the postprocesor to use once all files are joined. 
     * @return the postprocesor to use once all files are joined. 
     */
    public ResourceBundlePostProcessor getBundlePostProcessor();
    
    /**
     * Returns the bundle data hashcode
     * @param variantKey the variant key
     * @return the bundle data hashcode
     */
    public String getBundleDataHashCode(String variantKey);
    
    /**
     * Set the hashcode of the string representing the bundled files. 
     * Used to generate an automatic version url prefix. 
     * 
     * @param the variant key
     * @param hashCode the string representation of the hash code where the minus is replace by a "N" character.
     */
    public void setBundleDataHashCode(String variantKey, String bundleDataHashCode);
	
    
    /**
     * For bundles to be included for IE only within a conditional 
     * comment, this method returns the expression to use.  
     * @return The expression for the conditional comment, or null 
     * if the bundle should be included for all browsers. 
     */
    public String getExplorerConditionalExpression();
    
       
    /**
     * Returns the map of variants by type for this bundle. 
     * @return the map of variants by type for this bundle. 
     */
    public Map getVariants();
    
    /**
     * Sets the map of variants by type for this bundle. 
     * @param the map of variants by type for this bundle. 
     */
    public void setVariants(Map variants);
    
    /**
     * Returns the list of variant keys. 
     * @return the list of variant keys. 
     */
    public List getVariantKeys();
    
    /**
     * Returns an ordered list with all the items pertaining to this bundle, with the variations 
     * corresponding to the specified variant key. 
     * @param variants the variant map
     * @return an ordered list with all the items pertaining to this bundle
     */
    public List getItemPathList(Map variants);
    
    /**
     * Returns for the debug mode an ordered list with all the items pertaining to this bundle, with the variations 
     * corresponding to the specified variant key. 
     * @param variants the variant map
     * @return an ordered list with all the items pertaining to this bundle
     */
    public List getItemDebugPathList(Map variants);
    
    /**
	 * Returns the bundle dependencies
	 * @return the bundle dependencies
	 */
	public List getDependencies();

	/**
	 * Sets the bundle dependencies
	 * @param the bundle dependencies to set
	 */
	public void setDependencies(List bundleDependencies);

	/**
     * If set, it will force the tag libraries to render a static URL in production mode. 
     * @return
     */
    public String getAlternateProductionURL();

	/**
	 * Sets the bundle postprocessor
	 * @param bundlePostProcessor the bundle postprocessor to set
	 */
	public void setBundlePostProcessor(
			ResourceBundlePostProcessor bundlePostProcessor);

	/**
	 * Sets the unitary postprocessor
	 * @param unitaryPostProcessor the unitary postprocessor to set
	 */
	public void setUnitaryPostProcessor(
			ResourceBundlePostProcessor unitaryPostProcessor);
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy