I am writing an entity resolution application using java and Spring. The input to the main class is a "record" object, which will have one or more "attribute" objects (corresponding to name, email, phone, etc).
For each attribute, I want to create a "blockingStrategy" object. Each blockingStrategy object contains 3 sub-objects:
- BaseKeyGenerator
- KeyGenerator
- BlockingMethod
I want to end up with a map of attribute -> blockingStrategy objects which will be used by the entity resolution logic
I have interfaces defined for all these objects, and I have various different implementations of each of them which I might wish to use for different attributes. Each implementation requires a several parameters to be passed to it (required parameters may be different for different implementations of the same class)
I want to be able to configure the application (including which implementation classes to use), by defining a properties file like this:
attribute.name.baseKeyGen.class=IndianNameNormalizer
attribute.name.baseKeyGen.lowerCase=true
attribute.name.baseKeyGen.removeChars=[^a-z ]
attribute.name.baseKeyGen.sortTokens=true
attribute.name.keyGen.class=SuffixAndPrefix
attribute.name.keyGen.minLength=5
attribute.name.blockingMethod.class=BoundedBlockingMethod
attribute.name.blockingMethod.maxBlockSize=500
attribute.email.baseKeyGen.class=DefaultBaseKeyGenerator
attribute.email.baseKeyGen.lowerCase=true
attribute.email.baseKeyGen.removeChars=[^0-9a-z]
attribute.email.baseKeyGen.sortTokens=false
attribute.email.keyGen.class=SuffixAndPrefix
attribute.email.keyGen.minLength=10
attribute.email.blockingMethod.class=BoundedBlockingMethod
attribute.email.blockingMethod.maxBlockSize=100
attribute.phone.baseKeyGen.class=DefaultBaseKeyGenerator
attribute.phone.baseKeyGen.lowerCase=false
attribute.phone.baseKeyGen.removeChars=[^0-9]
attribute.phone.baseKeyGen.sortTokens=false
attribute.phone.keyGen.class=SuffixAndPrefix
attribute.phone.keyGen.minLength=6
attribute.phone.blockingMethod.class=BoundedBlockingMethod
attribute.phone.blockingMethod.maxBlockSize=100
What is the best way to write my applicationContext.xml file to achieve this. I don't want the spring xml file to refer to particular attribute values (these should only need to be specified in the properties file).
Aucun commentaire:
Enregistrer un commentaire