001: package org.jacorb.notification.servant;
002:
003: /*
004: * JacORB - a free Java ORB
005: *
006: * Copyright (C) 1999-2004 Gerald Brose
007: *
008: * This library is free software; you can redistribute it and/or
009: * modify it under the terms of the GNU Library General Public
010: * License as published by the Free Software Foundation; either
011: * version 2 of the License, or (at your option) any later version.
012: *
013: * This library is distributed in the hope that it will be useful,
014: * but WITHOUT ANY WARRANTY; without even the implied warranty of
015: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
016: * Library General Public License for more details.
017: *
018: * You should have received a copy of the GNU Library General Public
019: * License along with this library; if not, write to the Free
020: * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
021: *
022: */
023:
024: import org.apache.avalon.framework.configuration.Configuration;
025: import org.jacorb.notification.MessageFactory;
026: import org.jacorb.notification.OfferManager;
027: import org.jacorb.notification.SubscriptionManager;
028: import org.jacorb.notification.engine.TaskProcessor;
029: import org.jacorb.notification.interfaces.Message;
030: import org.omg.CORBA.ORB;
031: import org.omg.CosEventChannelAdmin.AlreadyConnected;
032: import org.omg.CosEventComm.Disconnected;
033: import org.omg.CosNotification.StructuredEvent;
034: import org.omg.CosNotifyChannelAdmin.ProxyType;
035: import org.omg.CosNotifyChannelAdmin.SequenceProxyPushConsumerOperations;
036: import org.omg.CosNotifyChannelAdmin.SequenceProxyPushConsumerPOATie;
037: import org.omg.CosNotifyChannelAdmin.SupplierAdmin;
038: import org.omg.CosNotifyComm.SequencePushSupplier;
039: import org.omg.PortableServer.POA;
040: import org.omg.PortableServer.Servant;
041:
042: /**
043: * @jmx.mbean extends = "AbstractProxyConsumerMBean"
044: * @jboss.xmbean
045: *
046: * @author Alphonse Bendt
047: * @version $Id: SequenceProxyPushConsumerImpl.java,v 1.14 2006/01/12 22:34:54 alphonse.bendt Exp $
048: */
049:
050: public class SequenceProxyPushConsumerImpl extends
051: AbstractProxyConsumer implements
052: SequenceProxyPushConsumerOperations,
053: SequenceProxyPushConsumerImplMBean, IProxyConsumer {
054: private SequencePushSupplier sequencePushSupplier_;
055:
056: ////////////////////////////////////////
057:
058: public SequenceProxyPushConsumerImpl(IAdmin admin, ORB orb,
059: POA poa, Configuration conf, TaskProcessor taskProcessor,
060: MessageFactory mf, SupplierAdmin supplierAdmin,
061: OfferManager offerManager,
062: SubscriptionManager subscriptionManager) {
063: super (admin, orb, poa, conf, taskProcessor, mf, supplierAdmin,
064: offerManager, subscriptionManager);
065: }
066:
067: public ProxyType MyType() {
068: return ProxyType.PUSH_SEQUENCE;
069: }
070:
071: protected void disconnectClient() {
072: logger_.info("disconnect sequence_push_supplier");
073:
074: sequencePushSupplier_.disconnect_sequence_push_supplier();
075:
076: sequencePushSupplier_ = null;
077: }
078:
079: public void connect_sequence_push_supplier(
080: SequencePushSupplier supplier) throws AlreadyConnected {
081: checkIsNotConnected();
082:
083: connectClient(supplier);
084:
085: sequencePushSupplier_ = supplier;
086:
087: logger_.info("connect sequence_push_supplier");
088: }
089:
090: public void push_structured_events(StructuredEvent[] events)
091: throws Disconnected {
092: checkStillConnected();
093:
094: Message[] _messages = newMessages(events);
095:
096: for (int x = 0; x < _messages.length; ++x) {
097: processMessage(_messages[x]);
098: }
099: }
100:
101: public void disconnect_sequence_push_consumer() {
102: destroy();
103: }
104:
105: public synchronized Servant newServant() {
106: return new SequenceProxyPushConsumerPOATie(this);
107: }
108: }
|