Hi,
i have a problem with casting the $proxy2 instance.
I have an interface: public interface ResourceManager
and an implementation of it:
public class ResourceManagerImpl
extends AbstractLogEnabled
implements ResourceManager, Configurable, Initializable, Disposable,
Serviceable, ThreadSafe, Contextualizable, Component
when i use in a second class called DefaultComponentManager, implementing the
interface Serviceable, the lookup method it returns an instance of a dynamic proxy
class called $proxy2. i can only cast this proxy class instance into an instance of
the interface, but i need an instance of the implementation class ResourceManagerImpl.
how can i get this object the dynamic proxy class was instatiated??
public void service(ServiceManager serviceManager ) throws ServiceException
{
ComponentEventListener listener = ( ComponentEventListener )
serviceManager.lookup( ComponentEventListener.ROLE );
Object resourceManager = serviceManager.lookup( ResourceManager.ROLE );
TransactionManager txm = (TransactionManager ) serviceManager.lookup(
TransactionManager.class.getName() );
final org.apache.avalon.framework.component.DefaultComponentManager dcm =
new org.apache.avalon.framework.component.DefaultComponentManager();
setupLogger(dcm, "System");
dcm.put(ResourceManager.ROLE, (Component) resourceManager);
dcm.put(ComponentEventListener.ROLE, (Component)listener);
dcm.put(UserTransaction.class.getName(), new UserTransactionImpl(txm,
listener));
dcm.makeReadOnly();
m_ComponentManager = new ExComponentManager( listener, dcm,
this.getClass().getClassLoader() );
}
Greets,
Andr� Steinkamp