@return the referred {@link Item}.  If the referred {@link Item}
has been removed then null will be returned.
@throws SevereMessageStoreException
488113
public final Item getReferredItem() throws SevereMessageStoreException
    {
        if (null == _item)
        {
            if (null == _referredMembership)
            {
                // may be because it has not been set as a result
                // of restore from DB
                ReferenceMembership m = (ReferenceMembership)_getMembership();
                if (null == m)
                {
                    throw new NotInMessageStore();
                }
                if (null != m)
                {
                    long refID = m.getReferencedID();
                    if (NO_ID != refID)
                    {
                        MessageStore messageStore = getOwningMessageStore();
                        if (null != messageStore)
                        {
                            _referredMembership = (ItemMembership) messageStore.getMembership(refID);
                        }
                    }
                }
            }
            if (null != _referredMembership)
            {
                _item = (Item) _referredMembership.getItem();
            }
        }
        return _item;
    }
413632
public final synchronized void incrementReferenceCount() throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "incrementReferenceCount");

        if (_referenceCountIsDecreasing)
        {
        	if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Cannot increment! Reference count has begun decreasing.");
        	if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementReferenceCount");
            throw new SevereMessageStoreException("Cannot add more references to an item after one has been removed");
        }
        _referenceCount++;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "incrementReferenceCount");
    }
1293150
public final void eventWatermarkBreached() throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "eventWatermarkBreached");

        ReferenceStream referenceStream = (ReferenceStream)getItem();
        if (null != referenceStream)
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "notifying eventWatermarkBreached: "+referenceStream);

            referenceStream.eventWatermarkBreached();

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "notified eventWatermarkBreached: "+referenceStream);
        }
        else
        {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "no referenceStream to notify");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "eventWatermarkBreached");
    }
173047
public boolean redeliverLocked( TransactionItem[] items , MessageLockSet locks ) throws JMSException
    {
    	checkNotClosed();
    	checkTransactionLock();
    	
    	int volatileRollbacked = 0;
    	int persistentRollbacked = 0;

        synchronized (storeLock)
        {
            for (int n = 0 ; n < items.length ; n++)
            {
            	TransactionItem transactionItem = items[n];
            	if (transactionItem.getDestination() != this)
            		continue; // Not for us
            	
            	MessageStore store = transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT ? persistentStore : volatileStore;
            	int handle = transactionItem.getHandle();
            	
            	// Retrieve message content
           		AbstractMessage msg = store.retrieve(handle);
           		
           		// Update redelivered flag both in memory and message store
           		msg.setJMSRedelivered(true);
           		handle = store.replace(handle, msg);
           		
            	if (redeliveryDelay > 0)
            	{
            	    // Keep the message locked so it cannot be re-consumed immediately            	    
            		// and schedule message unlock after redeliveryDelay milliseconds
            		redeliveryTimer.schedule(new RedeliveryTask(msg,store,handle), 
            				                 redeliveryDelay);
            	}
            	else
            	{
            		// Store lock for later release
            		locks.add(handle, store.getDeliveryMode(), this, msg);
            	}

                if (transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT)
                	persistentRollbacked++;
                else
                	volatileRollbacked++;
            }
        }
        rollbackedGetCount.addAndGet(volatileRollbacked + persistentRollbacked);

        if (persistentRollbacked > 0 && requiresTransactionalUpdate())
        {
        	pendingChanges = true;
        	return true;
        }
        else
        	return false;
    }
1219214
private final void _declareNotReleasable() throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "_declareNotReleasable");

        if (_isStorageManaged)
        {
            _itemCache.unmanage(this);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "_declareNotReleasable");
    }
57425
public final void append(final AbstractItemLink link) throws SevereMessageStoreException
    {
        if (link.isItemStreamLink())
        {
            _itemStreams.append(link);
        }
        else
        {
            throw new SevereMessageStoreException("Cannot add this directly to message store");
        }
    }
236448
@Override
    public void eventPostCommitRemove(Transaction transaction) throws SevereMessageStoreException
    {
        super.eventPostCommitRemove(transaction);
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "eventPostCommitRemove", transaction);

        if (failedInitInRestore)
        {
            initialiseNonPersistent(true);
        }

        dereferenceControlAdapter();

        try
        {
            // TODO I'm curious why we have five slots here as there should only ever be three things registered
            // (the ConsumerDispatcher, PtoPMessageItemStream (or SubscriptionItemStream) and optionally a
            // JSLocalConsumerPoint).
            if (POST_COMMIT_REMOVE_5 != null)
            {
                POST_COMMIT_REMOVE_5.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_4 != null)
            {
                POST_COMMIT_REMOVE_4.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_3 != null)
            {
                POST_COMMIT_REMOVE_3.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_2 != null)
            {
                POST_COMMIT_REMOVE_2.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
            if (POST_COMMIT_REMOVE_1 != null)
            {
                POST_COMMIT_REMOVE_1.messageEventOccurred(MessageEvents.POST_COMMIT_REMOVE, this, transaction);
            }
        } catch (SIException e)
        {
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.store.items.MessageItem.eventPostCommitRemove",
                                        "1:1160:1.244.1.40",
                                        this);

            SibTr.exception(tc, e);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "eventPostCommitRemove", e);

            throw new SIErrorException(e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "eventPostCommitRemove");
    }
598874
public List<MessageDestinationRefType<WebFragmentDescriptor>> getAllMessageDestinationRef()
   {
      List<MessageDestinationRefType<WebFragmentDescriptor>> list = new ArrayList<MessageDestinationRefType<WebFragmentDescriptor>>();
      List<Node> nodeList = model.get("message-destination-ref");
      for(Node node: nodeList)
      {
         MessageDestinationRefType<WebFragmentDescriptor>  type = new MessageDestinationRefTypeImpl<WebFragmentDescriptor>(this, "message-destination-ref", model, node);
         list.add(type);
      }
      return list;
   }
652580
public final void preCommitRemove(final PersistentTransaction transaction) throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "preCommitRemove", transaction);

        synchronized (this)
        {
            SevereMessageStoreException ex = assertCanDelete(transaction);
            if (null != ex)
            {
                throw ex;
            }

            if ((_itemLinkState == ItemLinkState.STATE_REMOVING_EXPIRING)
                || (_itemLinkState == ItemLinkState.STATE_REMOVING_LOCKED)
                || (_itemLinkState == ItemLinkState.STATE_REMOVING_PERSISTENTLY_LOCKED)
                || (_itemLinkState == ItemLinkState.STATE_REMOVING_WITHOUT_LOCK))
            {
                _assertCorrectTransaction(transaction);
                _owningStreamLink._assertCanRemoveChildUnder(transaction);
            }
            else
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                    SibTr.event(this, tc, "Invalid Item state: " + _itemLinkState);
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "preCommitRemove");
                throw new StateException(_itemLinkState.toString());
            }

            getItem().eventPrecommitRemove(transaction);
        } // end sync

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "preCommitRemove");
    }
18314
public ItemsSketch<T> getResultAndReset() {
    if (gadget_ == null) { return null; } //Intentionally return null here for speed.
    final ItemsSketch<T> hqs = gadget_;
    gadget_ = null;
    return hqs;
  }
1309806
private MessageItem getMessageItem()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getMessageItem");

        MessageItem msg = null;
        try
        {
            msg = (MessageItem) getReferredItem();
        } catch (MessageStoreException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.store.items.MessageItemReference.getMessageItem",
                                        "1:857:1.147",
                                        this);

            SibTr.exception(tc, e);

            // TODO : For now we throw a runtime here but we need to look at the stack to see
            // what this means.

            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(tc, "getMessageItem", e);

            throw new SIErrorException(e);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getMessageItem", msg);

        return msg;
    }
968860
@Override
    public void itemReferencesDroppedToZero()
    {
        super.itemReferencesDroppedToZero();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "itemReferencesDroppedToZero");

        if (failedInitInRestore)
        {
            try
            {
                initialiseNonPersistent(true);
            } catch (SevereMessageStoreException e)
            {
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.store.items.MessageItem.itemReferencesDroppedToZero",
                                            "1:1617:1.244.1.40",
                                            this);

                //There was a problem getting hold of the itemstream when trying to initilise
                //We wouldn't have registered any callbacks yet so we shouldn't carry on

                SibTr.exception(tc, e);

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "itemReferencesDroppedToZero", e);

                throw new SIErrorException(e);
            }
        }

        if (REFERENCES_DROPPED_TO_ZERO != null)
        {
            try
            {
                REFERENCES_DROPPED_TO_ZERO.messageEventOccurred(MessageEvents.REFERENCES_DROPPED_TO_ZERO, this, null);
            } catch (SIException e)
            {
                // Exceptions after a commit are bad !
                FFDCFilter.processException(
                                            e,
                                            "com.ibm.ws.sib.processor.impl.store.items.MessageItem.itemReferencesDroppedToZero",
                                            "1:1644:1.244.1.40",
                                            this);

                SibTr.exception(tc, e);

                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(this, tc, "itemReferencesDroppedToZero", e);

                throw new SIErrorException(e);
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "itemReferencesDroppedToZero");
    }
1247012
public MenuItemSelectable getSelectedMenuItem() {
		List<MenuItemSelectable> selectedItems = getSelectedMenuItems();
		if (selectedItems.isEmpty()) {
			return null;
		} else {
			return selectedItems.get(0);
		}
	}
153963
protected File getStoreFile(StoreReference store)
    {
        if (store instanceof FileStoreReference) {
            return ((FileStoreReference) store).getFile();
        }
        throw new IllegalArgumentException(String.format("Unsupported store reference [%s] for this implementation.",
            store.getClass().getName()));
    }
993402
Reference getReference() {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "getReference");
        }

        // Create a reference object describing this class
        final Reference reference = new Reference(getConnectionType(),
                        getClass().getName(), null);

        // Make sure no-one can pull the rug from beneath us.
        synchronized (_properties) {

            // Convert the map of properties into an encoded form, where the
            // keys have the necessary prefix on the front, and the values are
            // all Strings.
            final Map encodedMap = JmsJcaReferenceUtils.getInstance()
                            .getStringEncodedMap(_properties, defaultJNDIProperties);

            // Now turn the encoded map into the reference items.
            for (final Iterator iterator = encodedMap.entrySet().iterator(); iterator
                            .hasNext();) {

                final Map.Entry entry = (Map.Entry) iterator.next();
                final String prefixedKey = (String) entry.getKey();
                final String stringForm = (String) entry.getValue();

                // Store the prefixed key and value in string form.
                reference.add(new StringRefAddr(prefixedKey, stringForm));

            }

        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(TRACE, "getReference", reference);
        }
        return reference;

    }
38192
@Override
	protected AbstractMessage retrieveMessage(int handle) throws JMSException
    {
    	byte[] rawMsg = (byte[])dataStore.retrieve(handle);
    	return MessageSerializer.unserialize(rawMsg, true);
    }
1367417
@Nullable
	public MessageDescriptor<? extends Message> getExc() {
		return exc != null ? exc : (base != null ? base.exc : null);
	}