001 /* ORBInitializer.java -- 002 Copyright (C) 2005 Free Software Foundation, Inc. 003 004 This file is part of GNU Classpath. 005 006 GNU Classpath is free software; you can redistribute it and/or modify 007 it under the terms of the GNU General Public License as published by 008 the Free Software Foundation; either version 2, or (at your option) 009 any later version. 010 011 GNU Classpath is distributed in the hope that it will be useful, but 012 WITHOUT ANY WARRANTY; without even the implied warranty of 013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 General Public License for more details. 015 016 You should have received a copy of the GNU General Public License 017 along with GNU Classpath; see the file COPYING. If not, write to the 018 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 019 02110-1301 USA. 020 021 Linking this library statically or dynamically with other modules is 022 making a combined work based on this library. Thus, the terms and 023 conditions of the GNU General Public License cover the whole 024 combination. 025 026 As a special exception, the copyright holders of this library give you 027 permission to link this library with independent modules to produce an 028 executable, regardless of the license terms of these independent 029 modules, and to copy and distribute the resulting executable under 030 terms of your choice, provided that you also meet, for each linked 031 independent module, the terms and conditions of the license of that 032 module. An independent module is a module which is not derived from 033 or based on this library. If you modify this library, you may extend 034 this exception to your version of the library, but you are not 035 obligated to do so. If you do not wish to do so, delete this 036 exception statement from your version. */ 037 038 039 package org.omg.PortableInterceptor; 040 041 import org.omg.CORBA.Object; 042 import org.omg.CORBA.portable.IDLEntity; 043 044 /** 045 * <p> 046 * Registers the interceptor. 047 * 048 * Direct interceptor registration would open a security hole. Hence instead the 049 * interceptors from the ORB.init(..) method, passing the names of the needed 050 * initialized classes via properties. 051 * </p> 052 * <p> 053 * These property names are of the form 054 * </p> 055 * <p><i>org.omg.PortableInterceptor.ORBInitializerClass.<Service></i></p> 056 * where <i><Service></i> is the string name of a class, which implements 057 * {@link ORBInitializer}. During <code>ORB.init(..)</code>, the properties 058 * begining with <i>org.omg.PortableInterceptor.ORBInitializerClass</i> are 059 * collected, the <i><Service></i> portion of each property is extracted, 060 * the initialiser is instantiated with the <i><Service></i> string as its 061 * class name and then <code>pre_init</code> and <code>post_init</code> 062 * (defined in {@link ORBInitializerOperations}) are called on that initializer. 063 * The runtime exceptions, thrown by these two methods, are ignored. 064 * </p> 065 * <p> 066 * <h3>Example</h3> 067 * A client-side logging service may have the following ORBInitializer 068 * implementation: 069 * 070 * <code><pre> 071 * package gnu.x.logging; 072 * 073 * import org.omg.PortableInterceptor.*; 074 * import org.omg.CORBA.LocalObject; 075 * 076 * public class LoggingService extends LocalObject implements ORBInitializer 077 * { 078 * public void pre_init (ORBInitInfo info) 079 * { 080 * // More than one interceptor can be registered. 081 * ServerRequestInterceptor log_requests = new rLoggingInterceptor(); 082 * info.add_server_request_interceptor(log_requests); 083 * 084 * IORInterceptor log_iors = new iLoggingInterceptor(); 085 * info.add_ior_interceptor(log_iors); 086 * } 087 * 088 * public void post_init (ORBInitInfo info) 089 * { 090 * // Unused. 091 * } 092 * } 093 * </code></pre> 094 * <p> 095 * Then, one of the used set of properties then must contain the property, named 096 * <i> 097 * org.omg.PortableInterceptor.ORBInitializerClass.gnu.x.Logging.LoggingService 098 * </i>. 099 * The value of the property is ignored and may empty string. The 100 * agreed locations, where this property will be searched for, are: 101 * </p><p> 102 * 1. The properties parameter in the ORB.init(..), if any.<br> 103 * 2. The System properties.<br> 104 * 3. The orb.properties file located in the user.home directory (if any).<br> 105 * 4. The orb.properties file located in the java.home/lib directory (if any). 106 * </p> 107 * <p> 108 * The applet parameters and command line arguments are <i>not</i> scanned 109 * for the possible initializers. 110 * </p> 111 * <p> 112 * Interceptors are registered on a per-ORB basis. The virtual per-object 113 * Interceptors can be simulated by checking the policies on the target from 114 * within the interception points to determine whether they should work. The 115 * virtual per-POA Interceptors can be obtained instantiating each POA such with 116 * a different ORB. 117 * </p> 118 * <p> 119 * The registration code should not call directly any methods on the ORB being 120 * registered. 121 * </p> 122 * <p> 123 * The new interceptors cannot be registered after the ORB.init(..) returns. 124 * </p> 125 * 126 * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) 127 */ 128 public interface ORBInitializer extends ORBInitializerOperations, 129 Object, 130 IDLEntity 131 { 132 }