Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.corba.security » [javadoc | source]
    1   /**
    2    * Licensed to the Apache Software Foundation (ASF) under one or more
    3    * contributor license agreements.  See the NOTICE file distributed with
    4    * this work for additional information regarding copyright ownership.
    5    * The ASF licenses this file to You under the Apache License, Version 2.0
    6    * (the "License"); you may not use this file except in compliance with
    7    * the License.  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    * Unless required by applicable law or agreed to in writing, software
   12    * distributed under the License is distributed on an "AS IS" BASIS,
   13    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    * See the License for the specific language governing permissions and
   15    * limitations under the License.
   16    */
   17   package org.apache.geronimo.corba.security;
   18   
   19   import org.slf4j.Logger;
   20   import org.slf4j.LoggerFactory;
   21   import org.apache.geronimo.corba.ORBConfiguration;
   22   import org.apache.geronimo.corba.util.Util;
   23   import org.omg.CORBA.LocalObject;
   24   import org.omg.PortableInterceptor.ORBInitInfo;
   25   import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
   26   import org.omg.PortableInterceptor.ORBInitializer;
   27   
   28   
   29   /**
   30    * @version $Revision: 451417 $ $Date: 2006-09-29 13:13:22 -0700 (Fri, 29 Sep 2006) $
   31    */
   32   public class SecurityInitializer extends LocalObject implements ORBInitializer {
   33   
   34       private final Logger log = LoggerFactory.getLogger(SecurityInitializer.class);
   35   
   36       public SecurityInitializer() {
   37           if (log.isDebugEnabled()) log.debug("SecurityInitializer.<init>");
   38       }
   39   
   40       /**
   41        * Called during ORB initialization.  If it is expected that initial
   42        * services registered by an interceptor will be used by other
   43        * interceptors, then those initial services shall be registered at
   44        * this point via calls to
   45        * <code>ORBInitInfo.register_initial_reference</code>.
   46        *
   47        * @param info provides initialization attributes and operations by
   48        *             which Interceptors can be registered.
   49        */
   50       public void pre_init(ORBInitInfo info) {
   51       }
   52   
   53       /**
   54        * Called during ORB initialization. If a service must resolve initial
   55        * references as part of its initialization, it can assume that all
   56        * initial references will be available at this point.
   57        * <p/>
   58        * Calling the <code>post_init</code> operations is not the final
   59        * task of ORB initialization. The final task, following the
   60        * <code>post_init</code> calls, is attaching the lists of registered
   61        * interceptors to the ORB. Therefore, the ORB does not contain the
   62        * interceptors during calls to <code>post_init</code>. If an
   63        * ORB-mediated call is made from within <code>post_init</code>, no
   64        * request interceptors will be invoked on that call.
   65        * Likewise, if an operation is performed which causes an IOR to be
   66        * created, no IOR interceptors will be invoked.
   67        *
   68        * @param info provides initialization attributes and
   69        *             operations by which Interceptors can be registered.
   70        */
   71       public void post_init(ORBInitInfo info) {
   72   
   73           try {
   74               if (log.isDebugEnabled()) log.debug("Registering interceptors and policy factories");
   75   
   76               ORBConfiguration config = Util.getRegisteredORB(info.orb_id());
   77   
   78               try {
   79                   info.add_client_request_interceptor(new ClientSecurityInterceptor());
   80                   info.add_server_request_interceptor(new ServerSecurityInterceptor());
   81                   info.add_ior_interceptor(new IORSecurityInterceptor(config.getTssConfig()));
   82               } catch (DuplicateName dn) {
   83                   log.error("Error registering interceptor", dn);
   84               }
   85   
   86               info.register_policy_factory(ClientPolicyFactory.POLICY_TYPE, new ClientPolicyFactory());
   87               info.register_policy_factory(ServerPolicyFactory.POLICY_TYPE, new ServerPolicyFactory());
   88           } catch (RuntimeException re) {
   89               log.error("Error registering interceptor", re);
   90               throw re;
   91           }
   92       }
   93   
   94   }

Save This Page
Home » geronimo-2.2-source-release » org.apache.geronimo.corba.security » [javadoc | source]