KickJava   Java API By Example, From Geeks To Geeks.

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


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.jacorb.notification.util.CollectionsWrapper;
28 import org.omg.CORBA.INTERNAL JavaDoc;
29 import org.omg.CORBA.IntHolder JavaDoc;
30 import org.omg.CORBA.NO_IMPLEMENT JavaDoc;
31 import org.omg.CORBA.ORB JavaDoc;
32 import org.omg.CosNotifyChannelAdmin.AdminLimitExceeded;
33 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPullConsumer;
34 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPullConsumerHelper;
35 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPushConsumer;
36 import org.omg.CosTypedNotifyChannelAdmin.TypedProxyPushConsumerHelper;
37 import org.omg.CosTypedNotifyChannelAdmin.TypedSupplierAdmin;
38 import org.omg.CosTypedNotifyChannelAdmin.TypedSupplierAdminHelper;
39 import org.omg.CosTypedNotifyChannelAdmin.TypedSupplierAdminOperations;
40 import org.omg.CosTypedNotifyChannelAdmin.TypedSupplierAdminPOATie;
41 import org.omg.PortableServer.POA JavaDoc;
42 import org.omg.PortableServer.Servant JavaDoc;
43 import org.picocontainer.MutablePicoContainer;
44
45 /**
46  * @author Alphonse Bendt
47  * @version $Id: TypedSupplierAdminImpl.java,v 1.5 2005/04/10 14:32:57 alphonse.bendt Exp $
48  */

49 public class TypedSupplierAdminImpl extends SupplierAdminImpl implements
50         TypedSupplierAdminOperations
51 {
52     private final TypedSupplierAdmin thisRef_;
53
54     public TypedSupplierAdminImpl(IEventChannel channelServant, ORB JavaDoc orb, POA JavaDoc poa,
55             Configuration config, MessageFactory messageFactory, OfferManager offerManager,
56             SubscriptionManager subscriptionManager)
57     {
58         super(channelServant, orb, poa, config, messageFactory, offerManager, subscriptionManager);
59
60         thisRef_ = TypedSupplierAdminHelper.narrow(getServant()._this_object(getORB()));
61     }
62
63     protected Servant JavaDoc createServant()
64     {
65         return new TypedSupplierAdminPOATie(this);
66     }
67
68     public org.omg.CORBA.Object JavaDoc activate()
69     {
70         return thisRef_;
71     }
72
73     public TypedProxyPushConsumer obtain_typed_notification_push_consumer(String JavaDoc type, IntHolder JavaDoc id)
74             throws AdminLimitExceeded
75     {
76         fireCreateProxyRequestEvent();
77
78         try
79         {
80             final MutablePicoContainer _containerForProxy = newContainerForTypedProxy(type);
81
82             _containerForProxy.registerComponent(newComponentAdapter(
83                     TypedProxyPushConsumerImpl.class, TypedProxyPushConsumerImpl.class));
84
85             TypedProxyPushConsumerImpl _servant = (TypedProxyPushConsumerImpl) _containerForProxy
86                     .getComponentInstance(TypedProxyPushConsumerImpl.class);
87
88             _servant.setSubsequentDestinations(CollectionsWrapper.singletonList(this));
89
90             configureInterFilterGroupOperator(_servant);
91
92             configureQoS(_servant);
93
94             addProxyToMap(_servant, pushServants_, modifyProxiesLock_);
95
96             id.value = _servant.getID().intValue();
97
98             return TypedProxyPushConsumerHelper.narrow(_servant.activate());
99         } catch (Exception JavaDoc e)
100         {
101             logger_.error("unable to create typed notification push consumer", e);
102             throw new INTERNAL JavaDoc();
103         }
104     }
105
106     public TypedProxyPullConsumer obtain_typed_notification_pull_consumer(String JavaDoc type, IntHolder JavaDoc id)
107             throws AdminLimitExceeded
108     {
109         fireCreateProxyRequestEvent();
110
111         try
112         {
113             final MutablePicoContainer _containerForProxy = newContainerForTypedProxy(type);
114
115             _containerForProxy.registerComponent(newComponentAdapter(
116                     TypedProxyPullConsumerImpl.class, TypedProxyPullConsumerImpl.class));
117
118             TypedProxyPullConsumerImpl _servant = (TypedProxyPullConsumerImpl) _containerForProxy
119                     .getComponentInstance(TypedProxyPullConsumerImpl.class);
120
121             configureInterFilterGroupOperator(_servant);
122
123             configureQoS(_servant);
124
125             addProxyToMap(_servant, pullServants_, modifyProxiesLock_);
126
127             id.value = _servant.getID().intValue();
128
129             return TypedProxyPullConsumerHelper.narrow(_servant.activate());
130         } catch (Exception JavaDoc e)
131         {
132             logger_.error("unable to create typed notification push consumer", e);
133
134             throw new INTERNAL JavaDoc();
135         }
136     }
137
138     public org.omg.CosTypedEventChannelAdmin.TypedProxyPushConsumer obtain_typed_push_consumer(
139             String JavaDoc type)
140     {
141         throw new NO_IMPLEMENT JavaDoc();
142     }
143
144     public org.omg.CosEventChannelAdmin.ProxyPullConsumer obtain_typed_pull_consumer(String JavaDoc type)
145     {
146         throw new NO_IMPLEMENT JavaDoc();
147     }
148 }
Popular Tags