Skip to content
This repository has been archived by the owner on Jan 22, 2024. It is now read-only.

Extensibility

Chuck Dumont edited this page May 23, 2014 · 36 revisions

The Aggregator may be extended by third-parties to provide additional functionality not available with the base implementation. Extensions are implemented though the Eclipse extension registry by OSGi bundles providing extensions for the following Aggregator extension points:

Aggregator Extension-points

com.ibm.jaggr.service.modulebuilder

This extension point allows third-parties to provide support for additional module builders. The Aggregator provides module builders for JavaScript files, i18n JavaScript resource files, CSS files, LESS files, and text resources. The following markup declaring the default modulebuilder extensions is from the Aggregator's plugin.xml:

    <extension
           id="default.modulebuilders"
           point="com.ibm.jaggr.service.modulebuilder">
           <builder extension="js"
               class="com.ibm.jaggr.service.impl.modulebuilder.javascript.I18nModuleBuilder"/>
           <builder extension="js"
               class="com.ibm.jaggr.service.impl.modulebuilder.javascript.JavaScriptModuleBuilder"/>
           <builder extension="less"
               class="com.ibm.jaggr.core.impl.modulebuilder.less.LessModuleBuilder"/>
           <builder extension="css"
               class="com.ibm.jaggr.service.impl.modulebuilder.css.CSSModuleBuilder"/>
           <builder extension="*"
               class="com.ibm.jaggr.service.impl.modulebuilder.text.TextModuleBuilder"/>
   </extension>

The module type is determined by the file type of the module resource (e.g. css, js, html, etc.). The default module type of '*' is recognized as matching any module type that does not match another registered extension. If the same file type is specified more than once, then the module builders associated with the file type are invoked in the order that they are specified, and the first builder to indicate that it handles the module is used to build the module.

Applications specify the id(s) of module builder extension(s) used by the application using one or more modulebuilders [servlet init-params]{../wiki/Servlet-init-params). If no modulebuilders servlet init-param is specified, then the default.modulebuilders extension defined in the aggregator's plugin.xml is used.

modulebuilder extensions are required to provide an implementation of com.ibm.jaggr.service.modulebuilder.IModuleBuilder

com.ibm.jaggr.service.resourcefactory

This extension point allows third-parties to provide support for additional resource respository types as identified by the protocol, or scheme, portion of resource URIs. The Aggregator provides support for resources residing on the server's file system and in OSGi bundles. Extensions could provide additional support for resources residing in zip files or in databases. The following markup declaring the default resourcefactory extensions is from the Aggregator's plugin.xml:

   <extension
   		id="default.resourcefactories" 
   		point="com.ibm.jaggr.service.resourcefactory">
   		<factory scheme="file"
   			class="com.ibm.jaggr.service.impl.resource.FileResourceFactory"/>
   		<factory scheme="bundleentry" 
   			class="com.ibm.jaggr.service.impl.resource.BundleResourceFactory"/>>
   		<factory scheme="bundleresource"
   			class="com.ibm.jaggr.service.impl.resource.BundleResourceFactory"/>>
   		<factory scheme="namedbundleresource"
   			class="com.ibm.jaggr.service.impl.resource.BundleResourceFactory"/>
   </extension>

Applications specify the id(s) of resourcefactory extension(s) used by the application using one or more resourcefactories servlet init-params. If no resourcefactories servlet init-param is specified, then the default.resourcefactories extension defined in the aggregator's plugin.xml is used.

resourcefactory extension are required to provide an implementation of com.ibm.jaggr.service.resource.IResourceFactory.

com.ibm.jaggr.service.serviceprovider

This extension point allows third-parties to register OSGi service providers. The service provider is registered with the OSGi service registry under the interface name specified by the extension's service attribute. The following markup declaring the configextenson.bundleVersionHash service provider is from the Aggregator's plugin.xml:

	<extension
	        id="configextension.bundleVersionsHash"
	        point="com.ibm.jaggr.service.serviceprovider">
		<serviceprovider 
		         class="com.ibm.jaggr.service.impl.config.BundleVersionsHash" 
		         service="com.ibm.jaggr.core.config.IConfigScopeModifier">
			<init-param name="propName" value="getBundleVersionsHash"/>
		</serviceprovider>
	</extension>

Applications specify the id(s) of the serviceprovider extension{s) used by the application using the serviceproviders servlet init-param.

com.ibm.jaggr.service.httptransport

This extension point allows third-parties to provide support for additional HTTP Transports. The HTTP Transport is the Aggregator component that interfaces with the client-side AMD loader. It provides the implementation for the client-side AMD loader extension, which is responsible for composing the HTTP requests that the loader sends to the Aggregator, and it is responsible for parsing and iterpreting the request on the server, converting URL request parameters into interface defined request attributes.

The following markup declaring the default HTTP transport is from the Aggregator's plugin.xml:

   <extension
   		id="dojo.httptransport"
   		point="com.ibm.jaggr.service.httptransport">
   		<transport path="combo"
   		    class="com.ibm.jaggr.service.impl.transport.DojoHttpTransport"/>
   </extension>

Applications specify the id of the transport extension used by the application using the httptransport servlet init-param. If no httptransport servlet init-param is specified, then the dojo.httptransport extension defined in the aggregator's plugin.xml is used.

httptransport extensions are required to provide an implementation of com.ibm.jaggr.service.transport.IHttpTransport.