Latest Release
- Release candidate 2.0rc1 (23/12/11)
- Beta version 2.0 (06/07/11)
- Stable version 1.2.1 (15/07/10)
- Nightly builds available to test
Events
- 10/10/2011 - LDAPCon 2011 (Heidelberg, Germany)
- 13/06/2011 - RMLL (Strasbourg, France)
- 9/07/2010 - RMLL (Bordeaux, France)
Community
Get help, contribute or find professional services ...
Find out more!
Search
Download | Read more... | Get started!
Adding a source connectorIntroductionLSC defines synchronization tasks as transformations from a source connector to a destination connector. As of version 1.2, the only supported destination connector is a LDAP directory. Output to CSV and LDIF files is also possible via the log system. The source connectors in LSC are completely modular. Several are provided:
These source connectors are specified in a task definition in the configuration file (lsc.properties), by their full class name in Java (for example : org.lsc.jndi.SimpleJndiSrcService). The rest of this page describes how to implement a new connector and use it for a synchronization. How is a source connector defined?A source connector is a Java class that implements the ISrcService interface. This interface defines two methods: The source connector may also implement a constructor with one parameter: a Properties object. This constructor will be called once, at the beginning of a synchronization task, and the properties will be the subset from lsc.properties under lsc.tasks.TaskName.srcService. Method detailMap<String,LscAttributes> getListPivots()This method must return a list of all objects to be considered for synchronization in this task. The return object is a Map (usually a HashMap, but whatever is fine) containing:
A simple representation of the returned object might be this (for a LDAP source connector): "uid=jdoe,ou=people,o=example", {["sn", "Doe"], ["givenName", "John"]}
"uid=jane.doe,ou=people,o=example", {["sn", "Doe"], ["givenName", "Jane"]}
"uid=elilly,ou=people,o=example", {["sn", "Lilly"], ["givenName", "Evangeline"]}
Implementation of this method is completely up to you! It could be used for anything - reading from another kind of data store, or returning only recently modified entries, etc. IBean getBean(IBean taskBean, Entry<String,LscAttributes> obj)This method must return the Bean passed as a parameter one (taskBean), once it has been filled with data from the source corresponding to one object, identified by parameter two (obj). The taskBean is a newly-instantiated object of type IBean. At a minimum, you must set some attributes in it, with their names and values. Continuing the example above for the first object (“John Doe”), you would do the equivalent of this: taskBean.setAttribute("sn", new HashSet().add("Doe"));
taskBean.setAttribute("givenName", new HashSet().add("John"));
taskBean.setAttribute("homePhone", new HashSet().add(.....));
Of course, the actual values must be read from the source, by using the obj parameter to retrieve the object, then parse the attributes and add them to the Bean. ConfigurationLet's say you just created a new source connector, called org.lsc.service.MySourceConnector. You can use it by defining these properties on a task called TaskName: lsc.tasks.TaskName.srcService = org.lsc.service.MySourceConnector To specify some properties to be used in the source connector, that will be passed in a Properties object to the constructor, just add them to the properties file: lsc.tasks.TaskName.srcService.myproperty = something lsc.tasks.TaskName.srcService.serviceURL = http://a.server.com/service Having trouble?We hope that this document will help you get started writing a source connector. Of course, you'll need to play around a bit to get things working. If you need some advice, feel free to ask on the mailing lists or on IRC. We'll be happy to help! |


