@ExternalLib(name = "MySQL JDBC Driver",
description = "A JDBC driver that supports connection to the MySQL Database",
nameRegexpMatcher = "(.*)\\.jar",
requiredClassName = "com.mysql.jdbc.Driver",
coordinates = "mysql:mysql-connector-java:5.1.44")
public class MySqlConnectionProvider implements ConnectionProvider<Connection> {
//
}
External Libraries
Connectors and Modules sometimes depend on external libraries that cannot be packaged inside the connector due to licensing, versioning, custom libs, and so on.
The Database connector is an example of a case where the same base code you can work with several different drivers and several versions of a same driver. The solution to this problem is ask users of the Database connector to identify the JDBC Driver to use for the database to which they want to connect.
Usage
To declare that the Connector or Module requires an external library to work
in a Mule app, you need to annotate your @Extension
, Configuration,
or ConnectionProvider class with the @ExternalLib
annotation
and provide properties that will help the Mule App developer understand how
to configure these libraries.
To help your users configure libraries more easily, it is highly recommended that you fill out all the properties that the annotation provides, for example: |
+
+
Note that a Connector can require multiple external libraries. The @ExternalLib
annotation can be used many times as needed.
Properties
Property | Required | Type | Description | ||
---|---|---|---|---|---|
|
true |
String |
Friendly name to be displayed in the UI. |
||
|
false |
String |
Short description of the external library. |
||
|
false |
String |
Regular expression used to match the name of the library’s file and validate that the library specified by your user is the correct one. |
||
|
false |
String |
(Only for Java Libraries) Name of a
|
||
|
true |
Enum |
|
||
|
false |
String |
Maven coordinates suggestion that indicates where the required library can be found. They should follow Maven’s convention |
||
|
false |
Boolean |
Indicates whether the library is not required for the Connector or Module to work. |