KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > notification > container > DynAnyFactoryComponentAdapter


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 modify it under the terms of the
7  * GNU Library General Public License as published by the Free Software Foundation; either version 2
8  * of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
11  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License along with this
15  * library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
16  * USA.
17  *
18  */

19
20 package org.jacorb.notification.container;
21
22 import org.omg.CORBA.ORB JavaDoc;
23 import org.omg.CORBA.ORBPackage.InvalidName JavaDoc;
24 import org.omg.DynamicAny.DynAnyFactory JavaDoc;
25 import org.omg.DynamicAny.DynAnyFactoryHelper JavaDoc;
26 import org.picocontainer.PicoContainer;
27 import org.picocontainer.PicoInitializationException;
28 import org.picocontainer.defaults.AbstractComponentAdapter;
29
30 public class DynAnyFactoryComponentAdapter extends AbstractComponentAdapter
31 {
32     private static final long serialVersionUID = 1L;
33
34     public DynAnyFactoryComponentAdapter()
35     {
36         super(DynAnyFactory JavaDoc.class, DynAnyFactory JavaDoc.class);
37     }
38
39     public Object JavaDoc getComponentInstance(PicoContainer container)
40     {
41         try
42         {
43             ORB JavaDoc orb = (ORB JavaDoc) container.getComponentInstance(ORB JavaDoc.class);
44
45             return DynAnyFactoryHelper.narrow(orb.resolve_initial_references("DynAnyFactory"));
46         } catch (InvalidName JavaDoc e)
47         {
48             throw new PicoInitializationException("Could not resolve DynAnyFactory", e);
49         }
50     }
51
52     public void verify(PicoContainer container)
53     {
54         // no op
55
}
56 }
Popular Tags