Package de.elo.ix.client.plugin
Interface PluginsForScripting
public interface PluginsForScripting
Access Indexserver plugins from scripting. In Indexserver scripts, the implicit variable
ixPlugins allows to access services provided by plugins. Variable ixPlugins implements this
interface. Example:
function RF_AccessPluginService(ec, args) {
// Service interface name
var MY_SERVICE = "de.elo.ix.osgi.test.MyServiceForScripting";
// Lookup service.
// Do not store the returned object in a global variable.
// Use the object only for a short time.
var service = ixPlugins.getService(MY_SERVICE);
// Call service function add()
var sum = service.add(123, 456);
...
}
-
Method Summary
Modifier and TypeMethodDescriptiongetService
(String interfaceName) Returns the first service that implements the given interface.getServices
(String interfaceName) Returns a map of services that implement the given interface.
-
Method Details
-
getService
Returns the first service that implements the given interface. If the service cannot be found, an exception with code "[ELOIX:5023]" is thrown. Store the returned object only for a short time, because the plugin can be unloaded and replaced by another version.- Parameters:
interfaceName
- Full qualified interface class name.- Returns:
- Service, never null.
- Throws:
Exception
-
getServices
Returns a map of services that implement the given interface. The services are mapped to bundle (plugin) symbolic names. If no plugin provides the service, an empty map is returned.- Parameters:
interfaceName
- Full qualified interface class name.- Returns:
- Map of services, never null.
- Throws:
Exception
-