From: erik Date: Wed, 14 May 2008 12:10:05 +0000 (+0000) Subject: Now added support for ProvidedInterfaces in Container. X-Git-Tag: wamblee-utils-0.2~1^2~134 X-Git-Url: http://wamblee.org/gitweb/?a=commitdiff_plain;h=314065e6d9f9a964d2953e333aa1141b3c01e86d;hp=233af25ef5109b768f4fe1099241047fb51e671f;p=utils Now added support for ProvidedInterfaces in Container. As a result. UserAdministrationComponent can be simplified and in general writing composite components becomes easier. --- diff --git a/security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java b/security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java index d1f6a87a..e073442a 100644 --- a/security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java +++ b/security/src/main/java/org/wamblee/usermgt/UserAdministrationComponent.java @@ -73,34 +73,4 @@ public class UserAdministrationComponent extends DefaultContainer { } 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 + "'"); - } }