}
addProvidedInterface(USER_MGT);
}
-
- @Override
- protected Scope doStart(Scope aExternalScope) {
-
- Scope scope = super.doStart(aExternalScope);
- if (_exposeInternals) {
- addInterface(TRANSACTION_MGR, getInterfaceImplementation(
- TRANSACTION_MGR, _hibernate, scope), aExternalScope);
- addInterface(USER_CACHE, getInterfaceImplementation(USER_CACHE,
- _repository, scope), aExternalScope);
- addInterface(HIBERNATE_TEMPLATE, getInterfaceImplementation(
- HIBERNATE_TEMPLATE, _hibernate, scope), aExternalScope);
- }
- addInterface(USER_MGT, getInterfaceImplementation(USER_MGT, _usermgt,
- scope), aExternalScope);
-
- return scope;
- }
-
- private Object getInterfaceImplementation(ProvidedInterface aInterface,
- Component aSource, Scope aScope) {
- for (ProvidedInterface provided : aSource.getProvidedInterfaces()) {
- if (provided.equals(aInterface)) {
- return aScope
- .getInterfaceImplementation(provided, Object.class);
- }
- }
- throw new IllegalArgumentException("Provided interface '" + aInterface
- + "' not found in component '" + aSource + "'");
- }
}