This content has been marked as final.
Show 3 replies
-
1. Re: Component abstraction*
jacob.orshalick Dec 12, 2007 1:24 PM (in response to javabeats)I would like to create, if possible of course, an interface as a component. And use this to control the tasks of my business process. Depending on the implementation of such interface that is deployed, actions would behave differently.
It is not possible to directly define an interface as a Seam component, but it is possible to have your components implement a common interface and refer to that interface where your component is used. This is definitely recommended to allow differing implementations to be swapped out as you describe.
Thus, if you have a component:... @Name("hookComponent") public class HookComponentImpl implements HookComponent { ...
You tie your use of the component to the interface just like you would when injecting an SFSB:... @Name("commonComponent") public class CommonComponent { ... @In HookComponent hookComponent; ...
Here Seam will inject an instance of HookComponentImpl as it is the component registered in the context but this could easily be swapped out through a number of approaches (deploying a specific application instance as you describe, install precedence, configuration through components.xml, etc). Hope that helps. -
2. Re: Component abstraction*
javabeats Dec 12, 2007 6:17 PM (in response to javabeats)First off, thanks for your reply ;)
I already knew of such capability - I'm having more trouble with the "implementation swapping" part. Your suggestions are a good set of ideas to start exploring from.. thanks man!
Rodrigo -
3. Re: Component abstraction*
gbc1 Dec 13, 2007 3:01 AM (in response to javabeats)Just give your normal classes a lower precedence than the special classes. When two components have same name, higher wins. Look at the docs for more details.
Greetz GHad