Home » geronimo-2.2-source-release » org.apache.geronimo.yoko » [javadoc | source]

    1   /**
    2   *
    3   * Licensed to the Apache Software Foundation (ASF) under one or more
    4   *  contributor license agreements.  See the NOTICE file distributed with
    5   *  this work for additional information regarding copyright ownership.
    6   *  The ASF licenses this file to You under the Apache License, Version 2.0
    7   *  (the "License"); you may not use this file except in compliance with
    8   *  the License.  You may obtain a copy of the License at
    9   *
   10   *     http://www.apache.org/licenses/LICENSE-2.0
   11   *
   12   *  Unless required by applicable law or agreed to in writing, software
   13   *  distributed under the License is distributed on an "AS IS" BASIS,
   14   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   15   *  See the License for the specific language governing permissions and
   16   *  limitations under the License.
   17   */ 
   18   
   19   package org.apache.geronimo.yoko;
   20   
   21   import org.apache.geronimo.corba.CorbaApplicationServer;
   22   import org.apache.openejb.core.ServerFederation;
   23   import org.apache.openejb.spi.ApplicationServer;
   24   import org.apache.yoko.rmi.impl.MethodDescriptor;
   25   import org.apache.yoko.rmi.impl.RMIStub;
   26   
   27   /**
   28    * This class is the InvocationHandler for instances of POAStub. When a client
   29    * calls a remote method, this is translated to a call to the invoke() method in
   30    * this class.
   31    */
   32   public class RMIStubHandler extends org.apache.yoko.rmi.impl.RMIStubHandler {
   33       // the application server singleton
   34       private static CorbaApplicationServer corbaApplicationServer = new CorbaApplicationServer();
   35   
   36       public Object invoke(RMIStub stub, MethodDescriptor method, Object[] args) throws Throwable {
   37           // object types must bbe written in the context of the corba application server
   38           // which properly write replaces our objects for corba
   39           ApplicationServer oldApplicationServer = ServerFederation.getApplicationServer();
   40   
   41           ServerFederation.setApplicationServer(corbaApplicationServer);
   42   
   43           try {
   44               // let the super class handle everything.  We just need to wrap the context
   45               return super.invoke(stub, method, args);
   46   
   47           } finally {
   48               ServerFederation.setApplicationServer(oldApplicationServer);
   49           }
   50       }
   51   
   52   }
   53   

Home » geronimo-2.2-source-release » org.apache.geronimo.yoko » [javadoc | source]