...
Create a ConnectorInfoManager and a ConnectorKey for the connector.
Using the manager and the key, create a ConnectorInfo instance.
From the ConnectorInfo object, create the default !APIConfiguration.
From the default !APIConfiguration, retrieve the ConfigurationProperties.
Set all of the ConfigurationProperties needed by the connector using !setPropertyValue().
Use the ConnectorFacadeFactory's !newInstance() method to create a new instance of the connector.
Here is an example:
Code Block | ||
---|---|---|
| ||
// Use the ConnectorInfoManager to retrieve a ConnectorInfo object for the connector |
...
ConnectorInfoManagerFactory fact = ConnectorInfoManagerFactory.getInstance(); |
...
File bundleDirectory = new File("/connectorDir/bundles/foobar"); |
...
URL url = IOUtil.makeURL(bundleDirectory, "/dist/org.identityconnectors.foobar-1.0.jar"); |
...
ConnectorInfoManager manager = fact.getLocalManager(url); |
...
ConnectorKey key = new ConnectorKey("org.identityconnectors.foobar", "1.0", "FooBarConnector"); |
...
ConnectorInfo info = manager.findConnectorInfo(key); |
...
// From the ConnectorInfo object, create the default APIConfiguration. |
...
APIConfiguration apiConfig = info.createDefaultAPIConfiguration(); |
...
// From the default APIConfiguration, retrieve the ConfigurationProperties. |
...
ConfigurationProperties properties = apiConfig.getConfigurationProperties(); |
...
...
// Print out what the properties are (not necessary) |
...
List propertyNames = properties.getPropertyNames(); |
...
for(String propName : propertyNames) { |
...
ConfigurationProperty prop = properties.getProperty(propName); |
...
System.out.println("Property Name: " + prop.getName() + "\tProperty Type: " + prop.getType()); |
...
} |
...
// Set all of the ConfigurationProperties needed by the connector. |
...
properties.setPropertyValue("host", FOOBAR_HOST); |
...
properties.setPropertyValue("adminName", FOOBAR_ADMIN); |
...
properties.setPropertyValue("adminPassword", FOOBAR_PASSWORD); |
...
properties.setPropertyValue("useSSL", false); |
...
// Use the ConnectorFacadeFactory's newInstance() method to get a new connector. |
...
ConnectorFacade conn = ConnectorFacadeFactory.getInstance().newInstance(apiConfig); |
...
// Make sure we have set up the Configuration properly |
...
conn.validate(); |
...
// Start using the Connector |
...
conn.[authenticate|create|update|delete|search|...] |
How do I determine if the connector supports an operation?
...