| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| <head> |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| <title>Creating Plugin-Provided JSF Libraries</title> |
| <meta http-equiv="Content-Style-Type" content="text/css" /> |
| <meta http-equiv="Content-Script-Type" content="text/javascript" /> |
| <link rel="stylesheet" href="../../book.css" type="text/css"/> |
| <link rel="stylesheet" href="default_style.css" type="text/css"/> |
| </head> |
| <body> |
| <table summary="" cellspacing="0" cellpadding="0" width="100%"> |
| <tr valign="bottom"> |
| <td align="left" width="86%"> |
| <h1>Creating Plugin-Provided JSF Libraries</h1> |
| </td> |
| </tr> |
| </table> |
| <hr/> |
| <h3>JSF Libraries</h3> |
| <p> |
| The JSF Tools Project provides functionality whereby a named collection of |
| artifacts (typically JSF implementation and component JARs) can be created |
| once per workspace and referenced any number of times by projects within |
| that workspace. This avoids the JSF application developer having to import |
| the same JSF implementation and component JARs each time a new JSF project |
| is created. Each named collection is called a "JSF Library" in the JSF |
| Tooling, and UI is provided to manage the libraries and references of them |
| by projects. |
| </p> |
| <h3>Plugin-Provided JSF Libraries</h3> |
| <p> |
| Recognizing that teams are somewhat likely to use the same sets of JSF |
| implementation and component JARs (and, hence, the same JSF Libraries), the |
| JSF Tooling provides an extension point, |
| <a href="../extpts_reference/jsf/org_eclipse_jst_jsf_core_pluginProvidedJsfLibraries.html"> |
| <code>org.eclipse.jst.jsf.core.pluginProvidedJsfLibraries</code></a>, that enables a plugin |
| author to provide one or more JSF Libraries as one or more plugins. This |
| frees other team members from needing to use the provided UI to manage |
| commonly-used JSF Libraries and also provides consistent and predictable |
| use of JSF Libraries within teams. |
| </p> |
| <h3>Creating a Plugin to Extend Extension Point</h3> |
| <p> |
| Begin by creating a plug-in project, specifying creation of a Java project |
| in the wizard. Once the project is created, add a plugin dependency on |
| <code>org.eclipse.jst.jsf.core</code>. Add an extension of |
| <a href="../extpts_reference/jsf/org_eclipse_jst_jsf_core_pluginProvidedJsfLibraries.html"> |
| <code>org.eclipse.jst.jsf.core.pluginProvidedJsfLibraries</code></a>. Set the extension's |
| ID to a unique value (fully-qualified in Java package style recommended). |
| Right-click the jsfLibraries extension and select <b>New</b> > |
| <b>jsfLibrary</b>. Give the jsfLibrary a meaningful id, specify if it is a JSF implementation, |
| supply a label for display that can be externalized, and specify the |
| maximum JSF version that it supports. A fully-qualifed classname for |
| the archiveFilesDelegate property (see next section for creation of this |
| class) is also required. |
| </p> |
| <h3>Creating PluginProvidedJSFLibraryArchiveFilesDelegate Implementation</h3> |
| <p> |
| The JSF Tooling provides a base, abstract class |
| <a href="../api_reference/org/eclipse/jst/jsf/core/jsflibraryregistry/PluginProvidedJSFLibraryArchiveFilesDelegate.html"> |
| <code>org.eclipse.jst.jsf.core.jsflibraryregistry.PluginProvidedJSFLibraryArchiveFilesDelegate</code></a> that your delegate class must extend to provide the archive files that |
| make up your JSF Library. Create a Java class with the fully-qualified name |
| that matches the archiveFilesDelegate property specified in the previous |
| step, and that extends this abstract class. Override the <code>getArchiveFiles()</code> method, and supply a method |
| body that builds a Collection of archive files using the addArchiveFile() method. An example follows. |
| </p> |
| <div class="code"><pre> |
| public void getArchiveFiles() { |
| addArchiveFile("lib/commons-beanutils.jar"); |
| addArchiveFile("lib/commons-collections.jar"); |
| addArchiveFile("lib/commons-digester.jar"); |
| addArchiveFile("lib/commons-logging.jar"); |
| addArchiveFile("lib/jsf-api.jar"); |
| addArchiveFile("lib/jsf-impl.jar"); |
| addArchiveFile("lib/jstl.jar"); |
| } |
| </pre></div> |
| <h3>Including Archives in the Plugin</h3> |
| <p> |
| As can be seen in the previous example code, the archive files that make up |
| the JSF Library are specified relative to the plugin itself. Create any |
| appropriate folders (following the example code, create a "lib" folder) and |
| import archives files into the appropriate folder(s). |
| </p> |
| <img src="images/plugin_provided_jsf_libs_project.png" border="0" alt="Project"/> |
| <h3>Packaging Plugin for Distribution</h3> |
| <p> |
| Due to limitations in the current version of the JSF Tooling, package and |
| distribute completed plugin as a folder, not as a JAR. |
| </p> |
| </body> |
| </html> |