1 21 22 package org.jacorb.notification.container; 23 24 import java.lang.reflect.Method ; 25 26 import org.picocontainer.PicoContainer; 27 import org.picocontainer.PicoInitializationException; 28 import org.picocontainer.PicoIntrospectionException; 29 import org.picocontainer.PicoVerificationException; 30 import org.picocontainer.defaults.AbstractComponentAdapter; 31 import org.picocontainer.defaults.AssignabilityRegistrationException; 32 33 37 public class CORBAObjectComponentAdapter extends AbstractComponentAdapter 38 { 39 private static final long serialVersionUID = 1L; 40 41 private final org.omg.CORBA.Object delegate_; 42 43 51 public CORBAObjectComponentAdapter(Class service, org.omg.CORBA.Object delegate) 52 { 53 super(service, service); 54 55 final String _interfaceName = service.getName(); 56 final String _helperClassName = _interfaceName + "Helper"; 57 boolean _notAssignable = false; 58 59 try 60 { 61 Class _helperClass = Class.forName(_helperClassName); 62 Method _idMethod = _helperClass.getMethod("id", new Class [0]); 63 String _id = (String ) _idMethod.invoke(null, null); 64 65 if (!delegate._is_a(_id)) 66 { 67 _notAssignable = true; 68 } 69 } catch (Exception e) 70 { 71 _notAssignable = true; 72 } 73 74 if (_notAssignable) 75 { 76 throw new AssignabilityRegistrationException(service, delegate.getClass()); 77 } 78 79 delegate_ = delegate; 80 } 81 82 public Object getComponentInstance(PicoContainer container) throws PicoInitializationException, 83 PicoIntrospectionException 84 { 85 return delegate_; 86 } 87 88 public void verify(PicoContainer container) throws PicoVerificationException 89 { 90 } 92 } | Popular Tags |