You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Simon Stanlake <si...@tradebytes.com> on 2007/01/10 21:28:12 UTC

Same component instance but multiple roles

Is there a way to have the same component instance implement multiple
roles?
 
In short, I have a component that stores name-value pairs. The component
persists the list of pairs in a file. Some parts of the system need to
check for duplicates using the DupChecker interface like...
 
public boolean isDuplicate(String arg1,String arg2)
 
Other parts of the system need to access the component to add a new file
of duplicates using an interface like
 
public boolean addDupFile(String fileURI)
 
The components that check for duplicates don't care about how the
duplicates are persisted, so I don't want to expose the functionality to
them. For example, I may change it one day so that the pairs are stored
in a database - which should be transparent to the parts of the system
that just want to check for a duplicate. So I want to have DupChecker
role and FileDuplicateStore role both implemented by the same component
instance.
 
How do you do this?
 
thanks - simon