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.StructuredProxyPushConsumerOperations;
036: import org.omg.CosNotifyChannelAdmin.StructuredProxyPushConsumerPOATie;
037: import org.omg.CosNotifyChannelAdmin.SupplierAdmin;
038: import org.omg.CosNotifyComm.StructuredPushSupplier;
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: StructuredProxyPushConsumerImpl.java,v 1.15 2006/01/12 22:34:54 alphonse.bendt Exp $
048: */
049:
050: public class StructuredProxyPushConsumerImpl extends
051: AbstractProxyConsumer implements
052: StructuredProxyPushConsumerOperations,
053: StructuredProxyPushConsumerImplMBean {
054: private StructuredPushSupplier pushSupplier_;
055:
056: ////////////////////////////////////////
057:
058: public StructuredProxyPushConsumerImpl(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_STRUCTURED;
069: }
070:
071: public void push_structured_event(StructuredEvent structuredEvent)
072: throws Disconnected {
073: checkStillConnected();
074: Message _mesg = getMessageFactory().newMessage(structuredEvent,
075: this );
076:
077: checkMessageProperties(_mesg);
078: processMessage(_mesg);
079: }
080:
081: public void disconnect_structured_push_consumer() {
082: destroy();
083: }
084:
085: protected void disconnectClient() {
086: logger_.info("disconnect structured_push_supplier");
087:
088: pushSupplier_.disconnect_structured_push_supplier();
089:
090: pushSupplier_ = null;
091: }
092:
093: public void connect_structured_push_supplier(
094: StructuredPushSupplier supplier) throws AlreadyConnected {
095: checkIsNotConnected();
096:
097: connectClient(supplier);
098:
099: pushSupplier_ = supplier;
100:
101: logger_.info("connect structured_push_supplier");
102: }
103:
104: public synchronized Servant newServant() {
105: return new StructuredProxyPushConsumerPOATie(this);
106: }
107: }
|