plugin.xml file
A plug-in is described in an XML manifest file, called plugin.xml, which is part of the plug-in deployment files. The manifest file tells the portal application's runtime what it needs to know to register and activate the plug-in. The manifest file essentially serves as the contract between the pluggable component and the portal application's runtime. Although the WebSphere Application Server plugin.xml closely follows the one provided for the Eclipse workbench, it does diverge from the Eclipse workbench in several places.
The plugin.xml file must reside in the WEB-INF directory under the context of the hierarchy of directories that exist for a web application or when included in the Web application archive file.. The plugin.xml file must reside in the root directory when theplugin.xml file is placed in an Enterprise JavaBeans JAR file or shared library JAR file. The extension registry service includes the plugin.xml file as the participating components are loaded and started on the application server.
Usage notes
- Is this file read-only?
No
- Is this file updated by a product component?
???
- If so, what triggers its update?
Rational Application Developer updates the web.xml file when you assemble web components into a web module, or when we modify the properties of the web components or the web module.
- How and when are the contents of this file used?
WAS functions use information in this file during the configuration and deployment phases of web application development.
- The manifest markup definitions make use of various naming tokens and identifiers. To eliminate ambiguity, the following are productions rules for these naming conventions. In general, all identifiers are case-sensitive.
SimpleToken := sequence of characters from ('a-z','A-Z','0-9') ComposedToken := SimpleToken | (SimpleToken '.' ComposedToken) PlugInId := ComposedToken PlugInPrereq := PlugInId ExtensionId := SimpleToken ExtensionPointId := SimpleToken ExtensionPointReference := ExtensionPointId | (PlugInId '.' ExtensionPointId)
Sample file entry
The entire plug-in manifest DTD is as follows. XML Schema is not used to define the manifest since the current Eclipse tooling for plug-in's requires a DTD. The XML DTD construction rule element* means zero or more occurrences of the element; element? means zero or one occurrence of the element; and element+ means one or more occurrences of the element.
<?xml encoding="US-ASCII"?> <!ELEMENT plugin (requires?, extension-point*, extension*)> <!ATTLIST plugin name CDATA #IMPLIED id CDATA #REQUIRED version CDATA #REQUIRED provider-name CDATA #IMPLIED > <!ELEMENT requires (import+)> <!ELEMENT import EMPTY> <!ATTLIST import plugin CDATA #REQUIRED version CDATA #IMPLIED match (exact | compatible | greaterOrEqual) #IMPLIED > <!ELEMENT extension-point EMPTY> <!ATTLIST extension-point name CDATA #IMPLIED id CDATA #REQUIRED schema CDATA #IMPLIED > <!ELEMENT extension ANY> <!ATTLIST extension point CDATA #REQUIRED id CDATA #IMPLIED name CDATA #IMPLIED >
WAS differences
The plugin.xml file closely follows the plugin.xml file provided for the Eclipse workbench. However it diverges within the following elements.
- The plugin element
- The plugin element provided in this manifest does not contain class attributes. The class attribute is unnecessary since the plug-in mechanism does not require the plug-in developer to extend or use any specific classes as is required by the Eclipse workbench. Also, the plugin element does not contain a runtime element since standards such as J2EE that already define the location of runtime libraries for the applications.
- The import element
- The requires element does not contain export attribute since J2EE modules are encouraged to be self-contained to improve manageability. In addition to eliminating the export attribute, the match attribute has an option for a greater than or equal to match for versions (greaterOrEqual).
- The extension-point element
- The extension-point element has the name attribute as optional since it has no real use in this J2EE implementation.
we can find details regarding the plug-in manifest in the Eclipse documentation, under Platform Plug-In Developer Guide>Other reference information>Plug-in manifest.
The following is an example of how adding a link to an existing page can be accomplished by an extension point. The plug-in manifest of this plug-in declares an extension point (linkExtensionPoint) and an extension to this extension point (linkExtension). The plug-in declaring the extension point does not need to be the plug-in that implements the extension point. Another plug-in can also define an extension to the link extension point in its plug-in manifest by including the contents of the <extension> and </extension> tags in its manifest.
<?xml version="1.0"?> <!--the plugin id is derived from the vendor domain name --> <plugin id="com.ibm.ws.console.core" version="1.0.0" provider-name="IBM WebSphere"> <!--declaration of prerequisite plugins--> <requires> <import plugin="com.ibm.data" version="2.0.1" match="compatible"/> <import plugin="com.ibm.resources" version="3.0" match="exact"/> </requires> <!--declaration of link extension point --> <extension-point id="linkExtensionPoint" schema="/schemas/linkSchema.xsd"/> <!--declaration of an extension to the link extension point --> <extension point="com.ibm.ws.console.core.linkExtensionPoint" id="linkExtension"> <link label="Example.displayName" actionView="com.ibm.ws.console.servermanagement.forwardCmd.do? forwardName=example.config.view& lastPage=ApplicationServer.config.view"> </link> </extension> </plugin>
Related:
Application extension registry filtering View deployment descriptors View web services deployment descriptors in the administrative console Web applications: Resources for learning Notes on the Eclipse Plug-in Architecture Use the help system