dblevins    2004/08/26 03:20:26

  Modified:    modules/core/src/java/org/openejb/core CoreContext.java
  Log:

  Last changes on getting local interface support to work
  
  Revision  Changes    Path
  1.2       +19 -3     openejb1/modules/core/src/java/org/openejb/core/CoreContext.java
  
  Index: CoreContext.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb1/modules/core/src/java/org/openejb/core/CoreContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CoreContext.java  26 Mar 2004 21:42:20 -0000      1.1
  +++ CoreContext.java  26 Aug 2004 07:20:26 -0000      1.2
  @@ -171,10 +171,26 @@
       }
   
       public EJBLocalObject getEJBLocalObject() {
  -        return null; //TODO: implement this
  +        ThreadContext threadContext = ThreadContext.getThreadContext();
  +        org.openejb.DeploymentInfo di = threadContext.getDeploymentInfo();
  +
  +        EjbObjectProxyHandler handler = 
newEjbObjectHandler((RpcContainer)di.getContainer(), threadContext.getPrimaryKey(), 
di.getDeploymentID());
  +        handler.setLocal(true);
  +        Object newProxy = null;
  +        try {
  +            Class[] interfaces = new Class[]{ di.getLocalInterface(), 
org.openejb.core.ivm.IntraVmProxy.class };
  +            newProxy = ProxyManager.newProxyInstance( interfaces , handler );
  +        } catch ( IllegalAccessException iae ) {
  +            throw new RuntimeException("Could not create IVM proxy for 
"+di.getLocalInterface()+" interface");
  +        }
  +        return(EJBLocalObject)newProxy;
       }
  +    
       public EJBLocalHome getEJBLocalHome() {
  -        return null; //TODO: implement this
  +        ThreadContext threadContext = ThreadContext.getThreadContext();
  +        org.openejb.core.DeploymentInfo di = 
(org.openejb.core.DeploymentInfo)threadContext.getDeploymentInfo();
  +
  +        return di.getEJBLocalHome();
       }
       public TimerService getTimerService() {
           return null; //TODO: implement this
  
  
  

Reply via email to