KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ve > luz > ica > jackass > client > Initializer


1 /*
2  * Copyright (c) 2003 by The Jackass Team
3  * Licensed under the Open Software License version 2.0
4  */

5 package ve.luz.ica.jackass.client;
6
7 import org.apache.commons.logging.Log;
8 import org.apache.commons.logging.LogFactory;
9
10 import org.omg.CORBA.LocalObject JavaDoc;
11 import org.omg.PortableInterceptor.ORBInitInfo JavaDoc;
12 import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName JavaDoc;
13 import org.omg.PortableInterceptor.ORBInitializer JavaDoc;
14
15 /**
16  * Jackass Interceptor initializer.
17  * @author Guido Urdaneta, David Fernández
18  * @see ORBInitializer
19  */

20 public class Initializer extends LocalObject JavaDoc implements ORBInitializer JavaDoc
21 {
22     private static final Log LOG = LogFactory.getLog(Initializer.class);
23
24     private static boolean loaded = false;
25
26     /**
27      * This method registers the interceptor.
28      * @param info ORB initialization information. Ignored.
29      */

30     public void post_init(ORBInitInfo JavaDoc info)
31     {
32         try
33         {
34             if (!loaded)
35             {
36                 if (LOG.isInfoEnabled()) LOG.info("Loading interceptor");
37                 info.add_client_request_interceptor(new Interceptor());
38                 loaded = true;
39                 if (LOG.isInfoEnabled()) LOG.info("Interceptor loaded");
40             }
41             else
42             {
43                 if (LOG.isInfoEnabled()) LOG.info("No need to load interceptor");
44             }
45         }
46         catch (DuplicateName JavaDoc e)
47         {
48             e.printStackTrace();
49         }
50     }
51
52     /**
53      * Empty implementation.
54      * @param info ignored.
55      */

56     public void pre_init(ORBInitInfo JavaDoc info)
57     {
58     }
59
60 }
61
Popular Tags