picketlink/picketlink — pull request #40 by mposolda (2013-01-28 10:55:49+00:00)
Title: Xml config

What I did is:
1) Created Java classes for types which are used to XML-Java mapping. For now, I added those classes into "picketlink/federation" module into package "org.picketlink.identity.federation.core.config.idm" .

Only reason to have them in federation is, that they need to be visible from class PicketlinkType, which is part of Federation module. (It was agreed that we will use big picketlink.xml, which will contain configuration of all picketlink components together). Seems that we need to extract some stuff related to XML parsing from federation module into config module, as currently "config" module is dependent on "federation" .

2) I've made STAX based XML parsing in config module. See IDMConfigParser and unit test IDMConfigParserTestCase

3) I've added some temporary reflection based hack to PicketlinkConfigParser, so it can instantiate IDMConfigParser from "config" module and use it. This needs to be fixed once we extract XML parsing stuff from "federation" module to "config" module (mentioned in point 1)

4) I've added class XMLBasedIdentityManagerProvider to IDM. It's used to build IDM IdentityManager from parsed XML configuration.

Current examples of XML for JPA, LDAP and File identity store are here: https://github.com/mposolda/picketlink/tree/xml-config/idm/impl/src/test/resources/config

Some other things to do:
- Reusing objects from configuration: Currently JPAIdentityStoreTestSuite passed from me without problems when I tried to initialize it from XML config. However I had issues with FileIdentityStoreTestsuite, because XML configuration is using 2 separate FileDataSource objects for "Default" realm and "Testing" realm. However current FileIdentityStoreTestsuite is using programmatic configuration with shared FileDataSource object for both realms. So I was thinking about some mechanism, which will add possibility to share existing objects.

- Templatization: Quite similar to previous point. May be useful for example if we want to have 2 LDAP configurations for 2 different realms, and these configuration are quite similar and differ only in few points/

- Possibility to combine XML and programmatic configuration: (For example I want to provide CacheFactory instance based on Infinispan and initialize it programmaticaly and then inject to DefaultIdentityStoreInvocationContextFactory where rest of things is initialized from XML)

Let me know if there are some questions/ideas around this.