KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.jacorb.notification.servant;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1999-2004 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
24 import org.apache.avalon.framework.configuration.Configuration;
25 import org.jacorb.notification.MessageFactory;
26 import org.jacorb.notification.OfferManager;
27 import org.jacorb.notification.SubscriptionManager;
28 import org.jacorb.notification.engine.TaskProcessor;
29 import org.omg.CORBA.ORB JavaDoc;
30 import org.omg.CosEventChannelAdmin.AlreadyConnected;
31 import org.omg.CosEventComm.Disconnected;
32 import org.omg.CosNotification.StructuredEvent;
33 import org.omg.CosNotifyChannelAdmin.ProxyType;
34 import org.omg.CosNotifyChannelAdmin.SequenceProxyPushConsumerOperations;
35 import org.omg.CosNotifyChannelAdmin.SequenceProxyPushConsumerPOATie;
36 import org.omg.CosNotifyChannelAdmin.SupplierAdmin;
37 import org.omg.CosNotifyComm.SequencePushSupplier;
38 import org.omg.PortableServer.POA JavaDoc;
39 import org.omg.PortableServer.Servant JavaDoc;
40
41 /**
42  * @author Alphonse Bendt
43  * @version $Id: SequenceProxyPushConsumerImpl.java,v 1.10 2005/02/14 00:11:54 alphonse.bendt Exp $
44  */

45
46 public class SequenceProxyPushConsumerImpl extends StructuredProxyPushConsumerImpl implements
47         SequenceProxyPushConsumerOperations
48 {
49     private SequencePushSupplier sequencePushSupplier_;
50
51     ////////////////////////////////////////
52

53     public SequenceProxyPushConsumerImpl(IAdmin admin, ORB JavaDoc orb, POA JavaDoc poa, Configuration conf,
54             TaskProcessor taskProcessor, MessageFactory mf, SupplierAdmin supplierAdmin,
55             OfferManager offerManager, SubscriptionManager subscriptionManager)
56     {
57         super(admin, orb, poa, conf, taskProcessor, mf, supplierAdmin, offerManager,
58                 subscriptionManager);
59     }
60
61     public ProxyType MyType()
62     {
63         return ProxyType.PUSH_SEQUENCE;
64     }
65
66     protected void disconnectClient()
67     {
68         logger_.info("disconnect sequence_push_supplier");
69
70         sequencePushSupplier_.disconnect_sequence_push_supplier();
71
72         sequencePushSupplier_ = null;
73     }
74
75     public void connect_sequence_push_supplier(SequencePushSupplier supplier)
76             throws AlreadyConnected
77     {
78         checkIsNotConnected();
79
80         connectClient(supplier);
81
82         sequencePushSupplier_ = supplier;
83
84         logger_.info("connect sequence_push_supplier");
85     }
86
87     public void push_structured_events(StructuredEvent[] events) throws Disconnected
88     {
89         checkStillConnected();
90
91         for (int x = 0; x < events.length; ++x)
92         {
93             push_structured_event(events[x]);
94         }
95     }
96
97     public void disconnect_sequence_push_consumer()
98     {
99         destroy();
100     }
101
102     public synchronized Servant JavaDoc getServant()
103     {
104         if (thisServant_ == null)
105         {
106             thisServant_ = new SequenceProxyPushConsumerPOATie(this);
107         }
108
109         return thisServant_;
110     }
111 }
Popular Tags