KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > security > sas > SASInitializer


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

22
23 import org.apache.avalon.framework.configuration.ConfigurationException;
24 import org.apache.avalon.framework.logger.Logger;
25 import org.jacorb.orb.standardInterceptors.SASComponentInterceptor;
26 import org.jacorb.sasPolicy.ATLAS_POLICY_TYPE;
27 import org.jacorb.sasPolicy.SAS_POLICY_TYPE;
28 import org.omg.IOP.CodecFactoryPackage.UnknownEncoding JavaDoc;
29 import org.omg.PortableInterceptor.ORBInitInfo JavaDoc;
30 import org.omg.PortableInterceptor.ORBInitializer JavaDoc;
31 import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName JavaDoc;
32
33 /**
34  * This initializes the SAS Target Security Service (TSS) Interceptor
35  *
36  * @author David Robison
37  * @version $Id: SASInitializer.java,v 1.6 2004/05/07 13:08:29 david.robison Exp $
38  */

39
40 public class SASInitializer
41     extends org.omg.CORBA.LocalObject JavaDoc
42     implements ORBInitializer JavaDoc
43 {
44     private Logger logger = null;
45     public static final int SecurityAttributeService = 15;
46     public static int sasPrincipalNamePIC = (-1);
47
48     /**
49      * This method registers the interceptors.
50      */

51     public void post_init( ORBInitInfo JavaDoc info )
52     {
53         org.jacorb.orb.ORB orb =
54             ((org.jacorb.orb.portableInterceptor.ORBInitInfoImpl)info).getORB ();
55         logger =
56             orb.getConfiguration().getNamedLogger("jacorb.security.SAS");
57
58         // install the TSS interceptor
59
try
60         {
61             sasPrincipalNamePIC = info.allocate_slot_id();
62             info.add_server_request_interceptor(new SASTargetInterceptor(info));
63         }
64         catch (ConfigurationException ce)
65         {
66             if (logger.isErrorEnabled())
67                 logger.error("ConfigurationException", ce);
68         }
69         catch (DuplicateName JavaDoc duplicateName)
70         {
71             if (logger.isErrorEnabled())
72                 logger.error("TSS DuplicateName", duplicateName);
73         }
74         catch (UnknownEncoding JavaDoc unknownEncoding)
75         {
76             if (logger.isErrorEnabled())
77                 logger.error("TSS UnknownEncoding", unknownEncoding);
78         }
79
80         // install the CSS interceptor
81
try
82         {
83             info.add_client_request_interceptor(new SASClientInterceptor(info));
84         }
85         catch (ConfigurationException ce)
86         {
87             if (logger.isErrorEnabled())
88                 logger.error("ConfigurationException", ce);
89         }
90         catch (DuplicateName JavaDoc duplicateName)
91         {
92             if (logger.isErrorEnabled())
93                 logger.error("CSS DuplicateName", duplicateName);
94         }
95         catch (UnknownEncoding JavaDoc unknownEncoding)
96         {
97             if (logger.isErrorEnabled())
98                 logger.error("CSS UnknownEncoding", unknownEncoding);
99         }
100
101         // install IOR interceptor
102
try
103         {
104             info.add_ior_interceptor(new SASComponentInterceptor(info));
105         }
106         catch (DuplicateName JavaDoc duplicateName)
107         {
108             if (logger.isErrorEnabled())
109                 logger.error("IOR DuplicateName", duplicateName);
110         }
111
112         // create policy factory
113
info.register_policy_factory( SAS_POLICY_TYPE.value, new SASPolicyFactory() );
114         info.register_policy_factory( ATLAS_POLICY_TYPE.value, new ATLASPolicyFactory() );
115     }
116
117     public void pre_init(ORBInitInfo JavaDoc info)
118     {
119     }
120 } // SAS setup Initializer
121
Popular Tags