Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.jacorb.notification.servant;
  
  /*
   *        JacORB - a free Java ORB
   *
   *   Copyright (C) 1997-2012 Gerald Brose / The JacORB Team.
   *
   *   This library is free software; you can redistribute it and/or
   *   modify it under the terms of the GNU Library General Public
  *   License as published by the Free Software Foundation; either
  *   version 2 of the License, or (at your option) any later version.
  *
  *   This library is distributed in the hope that it will be useful,
  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *   Library General Public License for more details.
  *
  *   You should have received a copy of the GNU Library General Public
  *   License along with this library; if not, write to the Free
  *   Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
 import java.util.List;
 
 

Author(s):
Alphonse Bendt
Jmx.mbean:
extends = "AbstractProxyMBean"
Jboss.xmbean:
 
 
 public abstract class AbstractProxyConsumer extends AbstractProxy implements IProxyConsumer,
 {
     private final static EventType[] EMPTY_EVENT_TYPE_ARRAY = new EventType[0];
 
     // //////////////////////////////////////
 
     private final MessageFactory messageFactory_;
 
     // TODO check StartTime, StopTime, TimeOut: naming and usage is inconsistent.
     private final AtomicBoolean isStartTimeSupported_ = new AtomicBoolean(true);
 
     private final AtomicBoolean isStopTimeSupported_ = new AtomicBoolean(true);
 
     private List subsequentDestinations_;
 
 
 
     protected final SupplierAdmin supplierAdmin_;
 
     private int messageCounter_ = 0;
 
     // //////////////////////////////////////
 
     protected AbstractProxyConsumer(IAdmin adminORB orbPOA poaConfiguration conf,
             TaskProcessor taskProcessorMessageFactory messageFactory,
             SupplierAdmin supplierAdminOfferManager offerManager,
             SubscriptionManager subscriptionManager)
     {
         super(adminorbpoaconftaskProcessorofferManagersubscriptionManager);
 
          = supplierAdmin;
          = messageFactory;
                .. }, );
    }
    protected MessageFactory getMessageFactory()
    {
        return ;
    }
    public final List getSubsequentFilterStages()
    {
        return ;
    }
    public void setSubsequentDestinations(List list)
    {
         = list;
    }
    {
        public void actionPropertySetChanged(PropertySet source)
        {
            configureStartTimeSupported();
            configureStopTimeSupported();
        }
    };
    private void configureStartTimeSupported()
    {
        try
        {
        } catch (Exception e)
        {
        }
        if (.isInfoEnabled())
        {
            .info("set QoS: StartTimeSupported=" + );
        }
    }
    private void configureStopTimeSupported()
    {
        .debug("QoSSettings: " + );
        try
        {
        } catch (Exception e)
        {
        }
        if (.isInfoEnabled())
        {
            .info("set QoS: StopTimeSupported=" + );
        }
    }
    protected void schedulePullTask(MessageSupplier target)
    {
        getTaskProcessor().scheduleTimedPullTask(target);
    }

    
check if a Message is acceptable to the QoS Settings of this ProxyConsumer
    protected void checkMessageProperties(Message m)
    {
        // No Op
        // TODO implement
    }
    public FilterStage getFirstStage()
    {
        return this;
    }

    

Jmx.managed:
attribute description = "Does this ProxyConsumer support the per Message Option TimeOut" access = "read-only"
    public boolean getStopTimeSupported()
    {
        return .get();
    }

    

Jmx.managed:
attribute description = "Does this ProxyConsumer support the per Message Option StartTime" access = "read-only"
    public boolean getStartTimeSupported()
    {
        return .get();
    }
    public final SupplierAdmin MyAdmin()
    {
        return ;
    }
    public final MessageConsumer getMessageConsumer()
    {
        throw new UnsupportedOperationException();
    }
    public final boolean hasMessageConsumer()
    {
        return false;
    }
    public void offer_change(EventType[] addedEventType[] removedthrows InvalidEventType
    {
        .offer_change(addedremoved);
    }
    public final EventType[] obtain_subscription_types(ObtainInfoMode obtainInfoMode)
    {
        final EventType[] _subscriptionTypes;
        switch (obtainInfoMode.value()) {
        case .:
            // attach the listener first, then return the current
            // subscription types. order is important so that no
            // updates are lost.
            registerListener();
            _subscriptionTypes = .obtain_subscription_types();
            break;
            _subscriptionTypes = .obtain_subscription_types();
            removeListener();
            break;
            _subscriptionTypes = ;
            registerListener();
            break;
            _subscriptionTypes = ;
            removeListener();
            break;
        default:
            throw new IllegalArgumentException("Illegal ObtainInfoMode: ObtainInfoMode."
                    + obtainInfoMode.value());
        }
        return _subscriptionTypes;
    }
    private void registerListener()
    {
        if ( == null)
        {
            final NotifySubscribeOperations _listener = getSubscriptionListener();
            if (_listener != null)
            {
                 = new NotifySubscribeOperations()
                {
                    public void subscription_change(EventType[] addedEventType[] removed)
                    {
                        try
                        {
                            _listener.subscription_change(addedremoved);
                        } catch (NO_IMPLEMENT e)
                        {
                            .info("disable subscription_change for Supplier"e);
                            removeListener();
                        } catch (InvalidEventType e)
                        {
                            if (.isDebugEnabled())
                            {
                                .debug("subscription_change("
                                        + EventTypeWrapper.toString(added) + ", "
                                        + EventTypeWrapper.toString(removed) + ") failed"e);
                            }
                            else
                            {
                                .error("invalid event type"e);
                            }
                        } catch (Exception e)
                        {
                            .error("subscription change failed"e);
                        }
                    }
                };
            }
        }
    }

    
removes the listener. subscription_change will no more be issued to the connected Supplier
    protected void removeListener()
    {
        if ( != null)
        {
             = null;
        }
    }
    protected final void clientDisconnected()
    {
         = null;
    }
    protected void connectClient(org.omg.CORBA.Object client)
    {
        super.connectClient(client);
        try
        {
             = NotifySubscribeHelper.narrow(client);
            .debug("successfully narrowed connecting Supplier to NotifySubscribe");
        } catch (Exception e)
        {
            .info("connecting Supplier does not support subscription_change");
        }
    }
    {
        return ;
    }
    protected void processMessage(Message mesg)
    {
        getTaskProcessor().processMessage(mesg);
        ++;
    }

    

Jmx.managed:
attribute description = "Total number of Messages received by this ProxyConsumer" access = "read-only"
    public final int getMessageCount()
    {
        return ;
    }
    protected Message[] newMessages(StructuredEvent[] events)
    {
        final List _result = new ArrayList(events.length);
        final MessageFactory _messageFactory = getMessageFactory();
        for (int i = 0; i < events.length; ++i)
        {
            final Message _newMessage = _messageFactory.newMessage(events[i], this);
            checkMessageProperties(_newMessage);
            _result.add(_newMessage);
        }
        return (Message[]) _result.toArray(new Message[_result.size()]);
    }
New to GrepCode? Check out our FAQ X