Providers are extensible service modules responsible for the concrete implementation of a specific I/O type. The providers also allow to separate the internal logic of the Pi4J core from the concrete implementation of the board on which they are used.
Pi4J 2.0 - 2.4: Multiple providers for the same I/O type can be loaded into a Pi4J context concurrently. For example a “RaspberryPi-DigitalInputProvider” and “GertBoard-DigitalInputProvider” could both be loaded and both providing digital inputs at the same time.
As of Pi4J 2.5 multiple providers for the same I/O type is no longer supported. During the Context initialization it will ensure only a single provider for an I/O type is loaded. In addition the Mock Providers are not loaded unless expressly requested when creating the Context. See Create Context
Current supported providers:
sudo
sudo
Possible future providers:
Pi4J 2.5 Provider not found
Pi4J 2.5 ensuring a single provider for an I/O type is loaded may result in the provider your code references not being found because it was replaced by a higher priority provider. If you encounter this case, you can remove the unwanted provider plugin from your pom.xml file dependencies. Then after a clean and rebuild of your program the unwanted provider will no longer be loaded.
PrettyPrint loaded providers. After creating the Context the following code will print the currently loaded provider for each I/O type.
System.out.println("-------------------------------------------------");
System.out.println("PI4J PROVIDERS");
System.out.println("-------------------------------------------------");
pi4j.providers().describe().print(System.out);
System.out.println("-------------------------------------------------");