KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > notification > servant > TypedConsumerAdminImpl


1 package org.jacorb.notification.servant;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2003 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.Configuration;
24 import org.jacorb.notification.MessageFactory;
25 import org.jacorb.notification.OfferManager;
26 import org.jacorb.notification.SubscriptionManager;
27 import org.omg.CORBA.IntHolder JavaDoc;
28 import org.omg.CORBA.NO_IMPLEMENT JavaDoc;
29 import org.omg.CORBA.ORB JavaDoc;
30 import org.omg.CORBA.UNKNOWN JavaDoc;
31 import org.omg.CosTypedNotifyChannelAdmin.TypedConsumerAdmin;
32 import org.omg.CosTypedNotifyChannelAdmin.TypedConsumerAdminHelper;
33 import org.omg.CosTypedNotifyChannelAdmin.TypedConsumerAdminOperations;
34 import org.omg.CosTypedNotifyChannelAdmin.TypedConsumerAdminPOATie;
35 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPullSupplier;
36 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPullSupplierHelper;
37 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPushSupplier;
38 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPushSupplierHelper;
39 import org.omg.PortableServer.POA JavaDoc;
40 import org.omg.PortableServer.Servant JavaDoc;
41 import org.picocontainer.MutablePicoContainer;
42
43 /**
44  * @author Alphonse Bendt
45  * @version $Id: TypedConsumerAdminImpl.java,v 1.5 2005/04/10 14:32:57 alphonse.bendt Exp $
46  */

47 public class TypedConsumerAdminImpl extends ConsumerAdminImpl implements
48         TypedConsumerAdminOperations
49 {
50     private final TypedConsumerAdmin thisRef_;
51
52     ////////////////////////////////////////
53

54     public TypedConsumerAdminImpl(ORB JavaDoc orb, POA JavaDoc poa, Configuration config,
55             MessageFactory messageFactory, OfferManager offerManager,
56             SubscriptionManager subscriptionManager,
57             IEventChannel channelServant)
58     {
59         super(channelServant, orb, poa, config, messageFactory, offerManager, subscriptionManager);
60   
61         thisRef_ = TypedConsumerAdminHelper.narrow(getServant()._this_object(getORB()));
62     }
63
64     ////////////////////////////////////////
65

66     protected Servant JavaDoc createServant()
67     {
68         return new TypedConsumerAdminPOATie(this);
69     }
70
71     public org.omg.CORBA.Object JavaDoc activate()
72     {
73         return thisRef_;
74     }
75
76     public TypedProxyPullSupplier obtain_typed_notification_pull_supplier(String JavaDoc type, IntHolder JavaDoc id)
77     {
78         try
79         {
80             AbstractProxy _proxy = obtain_typed_notification_pull_supplier_servant(type);
81
82             id.value = _proxy.getID().intValue();
83
84             return TypedProxyPullSupplierHelper.narrow(_proxy.activate());
85         } catch (Exception JavaDoc e)
86         {
87             logger_.fatalError("obtain_typed_notification_pull_supplier", e);
88
89             throw new UNKNOWN JavaDoc(e.getMessage());
90         }
91     }
92
93     private AbstractProxySupplier obtain_typed_notification_pull_supplier_servant(String JavaDoc type)
94             throws Exception JavaDoc
95     {
96         final MutablePicoContainer _containerForProxy =
97             newContainerForTypedProxy(type);
98         
99         _containerForProxy.registerComponent(newComponentAdapter(TypedProxyPullSupplierImpl.class, TypedProxyPullSupplierImpl.class));
100         
101         TypedProxyPullSupplierImpl _servant = (TypedProxyPullSupplierImpl) _containerForProxy
102                 .getComponentInstance(TypedProxyPullSupplierImpl.class);
103
104         configureMappingFilters(_servant);
105
106         configureQoS(_servant);
107
108         configureInterFilterGroupOperator(_servant);
109
110         addProxyToMap(_servant, pullServants_, modifyProxiesLock_);
111
112         return _servant;
113     }
114
115     public TypedProxyPushSupplier obtain_typed_notification_push_supplier(String JavaDoc type, IntHolder JavaDoc id)
116     {
117         try
118         {
119             AbstractProxy _proxy = obtain_typed_notification_push_supplier_servant(type);
120
121             id.value = _proxy.getID().intValue();
122
123             return TypedProxyPushSupplierHelper.narrow(_proxy.activate());
124         } catch (Exception JavaDoc e)
125         {
126             logger_.fatalError("obtain_typed_notification_pull_supplier", e);
127
128             throw new UNKNOWN JavaDoc(e.getMessage());
129         }
130     }
131
132     private AbstractProxy obtain_typed_notification_push_supplier_servant(String JavaDoc type)
133             throws Exception JavaDoc
134     {
135         final MutablePicoContainer _containerForProxy =
136             newContainerForTypedProxy(type);
137         
138         _containerForProxy.registerComponent(newComponentAdapter(TypedProxyPushSupplierImpl.class, TypedProxyPushSupplierImpl.class));
139         
140         TypedProxyPushSupplierImpl _servant = (TypedProxyPushSupplierImpl) _containerForProxy
141                 .getComponentInstance(TypedProxyPushSupplierImpl.class);
142
143         configureMappingFilters(_servant);
144
145         configureQoS(_servant);
146
147         configureInterFilterGroupOperator(_servant);
148
149         addProxyToMap(_servant, pushServants_, modifyProxiesLock_);
150
151         return _servant;
152     }
153     
154     
155     public org.omg.CosEventChannelAdmin.ProxyPushSupplier obtain_typed_push_supplier(String JavaDoc type)
156     {
157         throw new NO_IMPLEMENT JavaDoc();
158     }
159
160     public org.omg.CosTypedEventChannelAdmin.TypedProxyPullSupplier obtain_typed_pull_supplier(
161             String JavaDoc type)
162     {
163         throw new NO_IMPLEMENT JavaDoc();
164     }
165 }
Popular Tags