# Contributing EL Variables

### Overview

The JSF tooling provides three ways to contribute EL variables to the framework depending on your goal.
If you are a component developer and want to add support for EL variables that are declared by your component tags, you can use the symbol factory extension and meta-data.
If you are a tooling developer and you wish to add new sources of variables without changing the behavior of other sources (beans, tag contributed variables), you can use the symbolProvider extension.
If you are a tooling developer and you wish to modify the way all variables are resolved, you can use the variableResolver extension.

### Symbol Factory Extension and Meta-data

A symbol factory is any factory class that extends org.eclipse.jst.jsf.context.symbol.internal.provisional.source.AbstractContextSymbolFactory. Once you create your implementation, you can declare it to the framework using the org.eclipse.jst.jsf.context.symbol.contextSymbolFactory extension point. In the extension, you need to provide a unique factoryId. This factoryId is used to identify your factory and can then be used in your symbol factory meta-data section. See also the Design Time Application Manager for information.
Your factory implementation will implement the following method:
protected abstract ISymbol internalCreate(String symbolName, int scope, IAdaptable context, List problems);
The symbolName is the one provided by the system, usually corresponding to the tag attribute, that declares the variable. You may use this symbol name or ignore it and use your own, depending on how the variable will be named at runtime. The scope argument is one of ISymbolConstants.SYMBOL_SCOPE_*. The system value is passed in based on meta-data settings if present. Your factory is not obligated to use this scope variable. The IAdaptable context object provides context information about the source of the variable declaration. This is usually an IModelContext object. You can implement the supports() abstract method in such a way to tell the framework work what types of context object you support. The problems list is for future use. In future versions, you will be able to add diagnostic objects to the list that report warnings or errors related to symbol creation. Currently, the list is ignored.

### SymbolProvider Extension

JSF has many ways to contribute variables. If the framework has overlooked any or if you have added new ways yourself without affecting the way other variables, such as managed beans, are declared, then you can do so through the org.eclipse.jst.jsf.context.symbol.symbolSourceProvider extension. Your symbol provider will implement the org.eclipse.jst.jsf.context.symbol.internal.provisional.source.ISymbolSourceProviderFactory interface. Every time the framework requests a list of variables through the default VariableResolver and ExternalContext, your provider will be queried for all its symbols at one or more scopes.
Note that your symbol provider may not called if:
- the default variable resolver has been replaced by one that does not call the default external context.
- the default external context has been replaced by one that does not query the symbol providers.

### VariableResolver Extension

The variable provider extension allows you to register your own design time resolver. You declare your resolver using the org.eclipse.jst.jsf.designtime.variableresolver extension point. Your extension will declare a unique id and a class. The class must extend org.eclipse.jst.jsf.designtime.internal.provisional.el.AbstractDTVariableResolver. To register your resolver as the active one for a project (note: JSF 1.1 only supports a single variable resolver at a given time. Future versions supporting JSF 1.2 will have a more robust scheme matching what is defined in the newer specification), you use DesignTimeApplicationManager.setVariableResolverProvider specifying the id defined in your extension as the argument.
Once your variable resolver is registered and active for a project, all variable resolution requests to the framework will call your implementation. This gives you complete control over how all EL variable symbols are discovered and instantiated by the design time framework.