KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > orb > standardInterceptors > IORInterceptorInitializer


1 /*
2  * JacORB - a free Java ORB
3  *
4  * Copyright (C) 1999-2004 Gerald Brose
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the Free
18  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  */

21 package org.jacorb.orb.standardInterceptors;
22
23 import org.apache.avalon.framework.logger.*;
24
25 import org.omg.PortableInterceptor.*;
26
27 import org.jacorb.orb.*;
28 import org.jacorb.config.Configuration;
29
30 /**
31  * This class initializes the default IOR interceptors
32  * used by JacORB.
33  *
34  * @author Nicolas Noffke
35  * @version $Id: IORInterceptorInitializer.java,v 1.17 2004/04/28 12:37:28 brose Exp $
36  */

37
38 public class IORInterceptorInitializer
39     extends org.omg.CORBA.LocalObject JavaDoc
40     implements ORBInitializer
41 {
42
43     public IORInterceptorInitializer()
44     {
45     }
46
47     // implementation of org.omg.PortableInterceptor.ORBInitializerOperations interface
48

49     /**
50      * Adds the SSLComponentInterceptor and the CodeSetInfoInterceptor
51      * to the set of IORInterceptors.
52      *
53      * @param info the info object.
54      */

55     public void post_init(ORBInitInfo info)
56     {
57         Configuration config = null;
58         try
59         {
60             ORB orb = ((org.jacorb.orb.portableInterceptor.ORBInitInfoImpl) info).getORB();
61             config = orb.getConfiguration();
62
63 // String supportedOptions =
64
// config.getAttribute("jacorb.security.ssl.server.supported_options",null);
65
// String requiredOptions =
66
// config.getAttribute("jacorb.security.ssl.server.required_options", null);
67

68 // if( config.getAttribute("jacorb.security.support_ssl","off").equals("on") &&
69
// supportedOptions != null &&
70
// requiredOptions != null
71
// )
72
// {
73
// info.add_ior_interceptor(new SSLComponentInterceptor(orb));
74
// }
75

76             int giop_minor =
77                 config.getAttributeAsInteger("jacorb.giop_minor_version",2);
78
79             if( giop_minor > 0 )
80             {
81                 info.add_ior_interceptor(new CodeSetInfoInterceptor(orb));
82             }
83         }
84         catch (Exception JavaDoc e)
85         {
86             if (config!= null)
87             {
88                 Logger logger =
89                     config.getNamedLogger("org.jacorb.interceptors.ior_init");
90                 if (logger.isErrorEnabled())
91                     logger.error("During IORInterceptor.post_init(): " + e.getMessage());
92             }
93             else
94                 e.printStackTrace(); // last resort...
95
}
96     }
97
98     /**
99      *
100      * @param info <description>
101      */

102
103     public void pre_init(ORBInitInfo info)
104     {
105         // do nothing
106
}
107
108 } // IORInterceptorInitializer
109
Popular Tags