01: /*
02: * JacORB - a free Java ORB
03: *
04: * Copyright (C) 1999-2004 Gerald Brose
05: *
06: * This library is free software; you can redistribute it and/or modify it under the terms of the
07: * GNU Library General Public License as published by the Free Software Foundation; either version 2
08: * of the License, or (at your option) any later version.
09: *
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;
23: import org.omg.CORBA.ORBPackage.InvalidName;
24: import org.omg.PortableServer.POA;
25: import org.omg.PortableServer.POAHelper;
26: import org.picocontainer.PicoContainer;
27: import org.picocontainer.PicoInitializationException;
28: import org.picocontainer.defaults.AbstractComponentAdapter;
29:
30: class POAComponentAdapter extends AbstractComponentAdapter {
31: private static final long serialVersionUID = 1L;
32:
33: public POAComponentAdapter() {
34: super (POA.class, POA.class);
35: }
36:
37: public Object getComponentInstance(PicoContainer container) {
38: try {
39: ORB orb = (ORB) container.getComponentInstance(ORB.class);
40:
41: POA poa = POAHelper.narrow(orb
42: .resolve_initial_references("RootPOA"));
43:
44: return poa;
45: } catch (InvalidName e) {
46: throw new PicoInitializationException(
47: "could not resolve RootPOA", e);
48: }
49: }
50:
51: public void verify(PicoContainer container) {
52: // no op
53: }
54: }
|