/* (non-Javadoc)
@see com.ibm.ws.sib.processor.Administrator#createDestinationLocalization(com.ibm.ws.sib.admin.DestinationDefinition, com.ibm.ws.sib.admin.LocalizationDefinition,  com.ibm.ws.sib.admin.MQLocalizationProxyDefinition)
320383
public void createDestinationLocalization(
    DestinationDefinition destinationDefinition,
    LocalizationDefinition destinationLocalizationDefinition) 
    
    throws SIBExceptionDestinationNotFound, SIBExceptionBase, SIResourceException, SIMPDestinationAlreadyExistsException, SINotPossibleInCurrentConfigurationException                                         
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createDestinationLocalization", 
        new Object[] {destinationDefinition, 
                      destinationLocalizationDefinition});
  
    checkStarted();
    
    // Get locality set from admin of all MEs which host the queue point.
    // Venu mock mock
    // messageProcessor.getSIBDestinationLocalitySet now returns messageprocessor LocalitySet as
       /*
    Set destinationLocalizingSet = 
      messageProcessor.getSIBDestinationLocalitySet(
        null, destinationDefinition.getUUID().toString(), true); */

    Set destinationLocalizingSet = 
        messageProcessor.getSIBDestinationLocalitySet(
          null,null, true);
      
    
  
      
    destinationManager.createDestinationLocalization(destinationDefinition,
                                                     destinationLocalizationDefinition,                                                     
                                                     destinationLocalizingSet,                                                     
                                                     false);
  
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createDestinationLocalization");
                                                          
    return;                                                     
  }
213306
@Override
	public void cacheResult(CPDefinitionLocalization cpDefinitionLocalization) {
		entityCache.putResult(CPDefinitionLocalizationModelImpl.ENTITY_CACHE_ENABLED,
			CPDefinitionLocalizationImpl.class,
			cpDefinitionLocalization.getPrimaryKey(), cpDefinitionLocalization);

		finderCache.putResult(FINDER_PATH_FETCH_BY_CPDEFINITIONID_LANGUAGEID,
			new Object[] {
				cpDefinitionLocalization.getCPDefinitionId(),
				cpDefinitionLocalization.getLanguageId()
			}, cpDefinitionLocalization);

		cpDefinitionLocalization.resetOriginalValues();
	}
1224423
String createNewTemporaryDestinationName(String destinationPrefix,
                                             SIBUuid8 meUuid,
                                             Distribution distribution)
                    throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createNewTemporaryDestinationName",
                        new Object[] { destinationPrefix, meUuid, distribution });

        if (destinationPrefix != null)
        {
            if (destinationPrefix.length() > 12)
                destinationPrefix = destinationPrefix.substring(0, 12);
        }
        else
            destinationPrefix = "";

        // Get the next available temporary destination count.
        long count = messageProcessor.nextTick();

        // Suffix is the tempdest count as 8 char hex with leading zeros
        StringBuffer sb = new StringBuffer("0000000000000000" + Long.toHexString(count).toUpperCase());

        String uniqueSuffix = sb.substring(sb.length() - 16).toString();

        String tempPrefix = null;
        if (distribution == Distribution.ONE)
            tempPrefix = SIMPConstants.TEMPORARY_QUEUE_DESTINATION_PREFIX;
        else
            tempPrefix = SIMPConstants.TEMPORARY_PUBSUB_DESTINATION_PREFIX;

        // Generate the unique name for the temporary destination.
        String name =
                        tempPrefix
                                        + destinationPrefix
                                        + SIMPConstants.SYSTEM_DESTINATION_SEPARATOR
                                        + meUuid
                                        + uniqueSuffix;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createNewTemporaryDestinationName", name);

        return name;
    }
1242417
final void deleteLocalizationPoint(JsBus bus, LWMConfig dest) {

        String thisMethodName = "deleteLocalizationPoint";

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, thisMethodName, dest);
        }

        try {
            _localizer.deleteLocalizationPoint(bus, dest);
        } catch (SIBExceptionBase ex) {
            SibTr.exception(tc, ex);

        } catch (SIException e) {
            SibTr.exception(tc, e);

        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, thisMethodName);
        }
    }
647074
private void saveLocalization() {

        SortedProperties localization = new SortedProperties();
        for (Object itemId : m_container.getItemIds()) {
            Item item = m_container.getItem(itemId);
            String key = item.getItemProperty(TableProperty.KEY).getValue().toString();
            String value = item.getItemProperty(TableProperty.TRANSLATION).getValue().toString();
            if (!(key.isEmpty() || value.isEmpty())) {
                localization.put(key, value);
            }
        }
        m_keyset.updateKeySet(m_localizations.get(m_locale).keySet(), localization.keySet());
        m_localizations.put(m_locale, localization);

    }
1298698
public void setTopicSpaceMapping(String foreignTSName)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "setTopicSpaceMapping", foreignTSName);
    // Create routingDestination object
    _routingDestination =
      SIMPUtils.createJsDestinationAddress(foreignTSName, 
                                            null, 
                                            _neighbour.getBusId());
    
    this._foreignTSName = foreignTSName;
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "setTopicSpaceMapping");
  }
823445
private void createDestinationLocalization(
                                               DestinationDefinition destinationDefinition,
                                               LocalizationDefinition destinationLocalizationDefinition,
                                               Set<String> destinationLocalizingMEs,
                                               boolean isTemporary,
                                               LocalTransaction transaction) throws SIResourceException, SIMPDestinationAlreadyExistsException
    {
//    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
//      SibTr.entry(
//        tc,
//        "createDestinationLocalization",
//        new Object[] {
//          destinationDefinition.getName(),
//          destinationDefinition.getUUID().toString(),
//          destinationDefinition,
//          destinationLocalizationDefinition,
//          destinationLocalizingMEs,
//          new Boolean(isTemporary),
//          transaction });

        boolean destinationHandlerCreated = false;
        BaseDestinationHandler destinationHandler = null;

        //The destination is being created on the local messaging engine.
        SIBUuid8 messagingEngineUuid = messageProcessor.getMessagingEngineUuid();

        checkValidLocalizationConfig(destinationDefinition,
                                     messagingEngineUuid,
                                     destinationLocalizationDefinition,
                                     destinationLocalizingMEs);

        //The lock on the destinationManager is taken to stop 2 threads creating the same
        //destination and also to synchronize dynamic deletes with the
        //creation of aliases.  This stops an alias destination being created that targets a
        //destination in the process of being deleted.
        synchronized (this)
        {
            //check if there are ANY with the same uuid
            DestinationTypeFilter filter = new DestinationTypeFilter();
            //Venu UUID temp
            DestinationHandler dh = destinationIndex.findByName(destinationDefinition.getName(), messageProcessor.getMessagingEngineBus(), filter);

            // If someone does a delete and add then it is possible the delete
            // might not have happened yet, so wait up to 5 seconds for the
            // deletion thread to finish. Then get the DH again and proceed. If
            // deletion takes more than 5 seconds this still won't work, but
            // deletion should not take 5 seconds.
            if (dh != null && dh.isToBeDeleted()) {
                synchronized (deletionThreadLock) {
                  try {
                      if (asynchDeletionThread != null && asynchDeletionThread.isRunning()) {
                          deletionThreadLock.wait(5000);
                      }
                  } catch (InterruptedException ie) {
                    // Just ignore this, someone told us to wake up so just bail.
                    Thread.currentThread().interrupt();
                    SibTr.debug(tc, "Wait for deletion thread to complete interrupted. Continuing without further waiting");
                  }
                }
                dh = destinationIndex.findByName(destinationDefinition.getName(), messageProcessor.getMessagingEngineBus(), filter);
            }

            if (dh == null)
            {
                // Create a new DestinationHandler, which is created locked
                // 174199.2.3
                destinationHandler =
                                new BaseDestinationHandler(
                                                destinationDefinition,
                                                messageProcessor,
                                                this,
                                                transaction,
                                                durableSubscriptions,
                                                messageProcessor.getMessagingEngineBus());

                destinationHandlerCreated = true;
                DestinationIndex.Type type = new DestinationIndex.Type();
                type.alias = new Boolean(destinationHandler.isAlias());
                type.foreignDestination = new Boolean(destinationHandler.isForeign());
                type.local = new Boolean(destinationHandler.hasLocal());
                type.queue = new Boolean(!destinationHandler.isPubSub());
                type.remote = new Boolean(destinationHandler.hasRemote());
                type.state = State.CREATE_IN_PROGRESS;
                //Venu temp UUID. setting UUID freshly
                destinationDefinition.setUUID(new SIBUuid12());
                destinationLocalizationDefinition.setUUID(new SIBUuid8());
                destinationIndex.put(destinationHandler, type);

            }
            else
            {
                if (dh instanceof BaseDestinationHandler) {
                    destinationHandler = (BaseDestinationHandler) dh;
                    //Venu temp UUID. setting Destination UUID from MessageStore dh
                    // LocalisationDefitnion UUID is alwasy set freshly
                    destinationDefinition.setUUID(dh.getDefinition().getUUID());
                    destinationLocalizationDefinition.setUUID(new SIBUuid8());
                }
                else
                {
                    //A destination exists with this name - perhaps an alias or a
                    //foreign destination.
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(
                                   tc,
                                   "createDestinationLocalization",
                                   nls_cwsik.getFormattedMessage(
                                                                 "DELIVERY_ERROR_SIRC_31", // DESTINATION_ALREADY_EXISTS_ERROR_CWSIP0045
                                                                 new Object[] { destinationDefinition.getName() },
                                                                 null));

                    SIMPDestinationAlreadyExistsException e = new SIMPDestinationAlreadyExistsException(
                                    nls_cwsik.getFormattedMessage(
                                                                  "DELIVERY_ERROR_SIRC_31", // DESTINATION_ALREADY_EXISTS_ERROR_CWSIP0045
                                                                  new Object[] { destinationDefinition.getName() },
                                                                  null));

                    e.setExceptionReason(SIRCConstants.SIRC0031_DESTINATION_ALREADY_EXISTS_ERROR);
                    e.setExceptionInserts(new String[] { destinationDefinition.getName() });
                    throw e;
                }
            }
        }

        synchronized (destinationHandler)
        {
            //      // If we are corrupt, we don't want to attempt to create any points
            //      // whatsoever.
            //      if (destinationHandler.isCorrupt())
            //      {
            //        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            //          SibTr.debug(tc, "createDestinationLocalization",
            //            "Point " + destinationLocalizationDefinition.getIdentifier()
            //            + " not created since destination " + destinationHandler.getName()
            //            + " is corrupt.");
            //
            //        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            //          SibTr.exit(tc, "createDestinationLocalization");
            //
            //        return;
            //      }

            //If we didnt just create the destinationHandler, it is valid for this
            //create call to be made at startup or to create a local queue point
            if (!destinationHandlerCreated)
            {
                //---199538--------------------------------------------------------------
                //This USED to test whether the destination was reconciling
                //and, if not, would throw an exception. This is no longer the case, as
                //dynamic updates might cause this method to be called for a destination
                //that already exists i.e. when localising a qPt on a previously
                //remote destination.
                //-----------------------------------------------------------------------

                if (destinationHandler.isReconciled() && (destinationHandler.hasLocal() || destinationLocalizationDefinition == null))
                {
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(
                                   tc,
                                   "createDestinationLocalization",
                                   nls_cwsik.getFormattedMessage(
                                                                 "DELIVERY_ERROR_SIRC_31", // DESTINATION_ALREADY_EXISTS_ERROR_CWSIP0045
                                                                 new Object[] { destinationDefinition.getName() },
                                                                 null));

                    SIMPDestinationAlreadyExistsException e = new SIMPDestinationAlreadyExistsException(
                                    nls_cwsik.getFormattedMessage(
                                                                  "DELIVERY_ERROR_SIRC_31", // DESTINATION_ALREADY_EXISTS_ERROR_CWSIP0045
                                                                  new Object[] { destinationDefinition.getName() },
                                                                  null));

                    e.setExceptionReason(SIRCConstants.SIRC0031_DESTINATION_ALREADY_EXISTS_ERROR);
                    e.setExceptionInserts(new String[] { destinationDefinition.getName() });
                    throw e;
                }

                // Only update destination handler objects with WCCM information if
                // we have not already detected them as corrupt.
                if (!destinationHandler.isCorruptOrIndoubt())
                {
                    // Destination already exists.  In the new WCCM world, the
                    // create should complete succesfully, with the new destination
                    // definition replacing the existing one.
                    // We update the localization definitions before we update the
                    // actual destination definition.

                    if (isQueue(destinationHandler.getDestinationType()))
                    {
                        if (destinationLocalizationDefinition != null)
                        {
                            // Update the localisation definition too.
                            destinationHandler.updateLocalizationDefinition(destinationLocalizationDefinition, transaction);
                        }
                    } // eof is q
                    else if (destinationHandler.getDestinationType() == DestinationType.TOPICSPACE)
                    {
                        destinationHandler.updateLocalizationDefinition(destinationLocalizationDefinition, transaction);
                    } // eof is topicspace

                    destinationHandler.updateDefinition(destinationDefinition);

                    // Update the set of localising messaging engines for the destinationHandler
                    // Dont create remote localisations up front.  This can be done
                    // if WLM picks one of them
                    destinationHandler.updateLocalizationSet(
                                    destinationLocalizingMEs);

                    // Alert the lookups object to handle the re-definition
                    DestinationIndex.Type type = new DestinationIndex.Type();
                    type.alias = new Boolean(destinationHandler.isAlias());
                    type.foreignDestination = new Boolean(destinationHandler.isForeign());
                    type.local = new Boolean(destinationHandler.hasLocal());
                    type.queue = new Boolean(!destinationHandler.isPubSub());
                    type.remote = new Boolean(destinationHandler.hasRemote());
                    type.state = destinationIndex.getState(destinationHandler);
                    destinationIndex.setType(destinationHandler, type);
                    destinationIndex.create(destinationHandler);

                    //Show that the destination is now reconciled
                    destinationHandler.setReconciled();

                    if (destinationHandler.getHasReconciledStreamsToBeDeleted())
                    {
                        //defect 259817
                        //there was some unfinished cleanup from before the ME previously shutdown
                        //that we now need to take care of.
                        destinationIndex.cleanup(destinationHandler);
                    }
                }
            }
            else // we did just create the destinationHandler.
            {
                if (isQueue(destinationHandler.getDestinationType()))
                {
                    if (destinationLocalizationDefinition != null)
                    {
                        // Create a new point to point localisation
                        destinationHandler.addNewPtoPLocalization(
                                                                  false,
                                                                  transaction,
                                                                  messagingEngineUuid,
                                                                  destinationLocalizationDefinition,
                                                                  true);
                    }
                } // eof is q
                else if (destinationHandler.getDestinationType() == DestinationType.TOPICSPACE)
                {
                    destinationHandler.addPubSubLocalisation(destinationLocalizationDefinition);
                } // eof is topicspace

                // Update the set of localising messaging engines for the destinationHandler
                // Dont create remote localisations up front.  This can be done
                // if WLM picks one of them
                destinationHandler.updateLocalizationSet(
                                destinationLocalizingMEs);

                // Put the newly created destination handler into the indexes
                destinationIndex.setLocalizationFlags(destinationHandler);

            } // eof we did just create the DH
        } // end of synchronization

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createDestinationLocalization");
    }
432650
private void createDestinations() throws MessagingException {
        try {
            // Create Destinations based on properties
            Enumeration<?> propertyNames = m_connectionProperties.keys();
            while (propertyNames.hasMoreElements()) {
                String propertyName = (String) propertyNames.nextElement();
                if (propertyName.startsWith("topic.")) {
                    String destinationName =
                            m_connectionProperties.getProperty(propertyName);
                    m_jmsManager.createDestination(destinationName,
                                                   DestinationType.Topic);
                } else if (propertyName.startsWith("queue.")) {
                    String destinationName =
                            m_connectionProperties.getProperty(propertyName);
                    m_jmsManager.createDestination(destinationName,
                                                   DestinationType.Queue);
                }
            }

            // Get destination list
            List<Destination> destinations = m_jmsManager.getDestinations();

            // If there are no Destinations, throw an exception
            if (destinations.size() == 0) {
                throw new MessagingException("No destinations available for "
                        + "subscription, make sure that there is at least one topic "
                        + "or queue specified in the connection properties.");
            }

            // Subscribe
            for (Destination destination : destinations) {
                if (m_durable && (destination instanceof Topic)) {
                    m_jmsManager.listenDurable((Topic) destination,
                                               m_messageSelector,
                                               this,
                                               null);
                } else {
                    m_jmsManager.listen(destination, m_messageSelector, this);
                }
            }
        } catch (MessagingException me) {
            logger.error("MessagingException encountered attempting to start "
                    + "Messaging Client: " + m_clientId
                    + ". Exception message: " + me.getMessage(), me);
            throw me;
        }
    }
332292
void registerDestination()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "registerDestination");

    //Only register the destination once its been defined to WLM
    if (_mqLinkManager.isDefined(getUuid()))
    {
      if ((hasLocal()) && (!_registeredInWLM))
      {
        try
        {
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            SibTr.debug(tc, "Register MQLink: " + getUuid() + ", with linkManager");           
          _linkManager.register(getUuid());
          _registeredInWLM = true;
        }
        catch (LinkException e)
        {
          //Error during create of the link.  Trace an FFST.  If we cant 
          //advertise the link, other ME's wont be able to send to it
          FFDCFilter.processException(
            e,
            "com.ibm.ws.sib.processor.impl.MQLinkHandler.registerDestination",
            "1:724:1.71",
            this);
    
          SibTr.exception(tc, e);
          if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
            SibTr.exit(tc, "registerDestination", e);
        }
      }
    }
        
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "registerDestination");  
      
    return;
  }
152663
public void addNewLocalPtoPLocalisation(
    TransactionCommon transaction,
    PtoPMessageItemStream newMsgItemStream)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "addNewLocalPtoPLocalisation",
        new Object[] {
          transaction,
          newMsgItemStream });

      transaction.registerCallback(
        new LocalizationAddTransactionCallback(newMsgItemStream));

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

  }
1159582
@Override
    public JsDestinationAddress getReplyDestination()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getReplyDestination");

        if (!_replySet)
        {
            // Create a JsDestinationAddress from the qualifiedName
            QualifiedDestinationName name = definition.getReplyDestination();

            if (name != null)
                _replyDestination = SIMPUtils.createJsDestinationAddress(
                                                                         name.getDestination(),
                                                                         messageProcessor.getMessagingEngineUuid(),
                                                                         name.getBus());

            _replySet = true;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "getReplyDestination", _replyDestination);

        return _replyDestination;
    }
767970
private void deleteDestLocalizations(JsBus bus) {

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

        Iterator i = alterDestinations.iterator();

        while (i.hasNext()) {

            String key = (String) i.next();

            try {
                // Get it from the old cache as it is no longer in the new cache.
                DestinationDefinition dd = (DestinationDefinition) _me.getSIBDestination(bus.getName(), key);
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    SibTr.debug(tc, "deleteDestLocalizations: deleting DestinationLocalization, name =" + key + " Name=");
                }
                if (!isInZOSServentRegion() && _mpAdmin != null) {
                	LocalizationEntry dldEntry = (LocalizationEntry) lpMap.get(dd.getName()+"@"+_me.getName());
                	LocalizationDefinition dld=(LocalizationDefinition) dldEntry.getLocalizationDefinition();
                	
                    //Venu Liberty change: passing Destination UUID as String.
                    //Destination Definition is passed as NULL as entire destination has to be deleted
                    _mpAdmin.deleteDestinationLocalization(dd.getUUID().toString(), null);  
                }
               
            } catch (Exception e) {
                com.ibm.ws.ffdc.FFDCFilter.processException(e, CLASS_NAME + ".deleteDestLocalizations", "1", this);
                SibTr.exception(tc, e);
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, "deleteDestLocalizations");
        }
    }
445283
public void setWorkflowDefinitionLinkLocalService(
		com.liferay.portal.kernel.service.WorkflowDefinitionLinkLocalService workflowDefinitionLinkLocalService) {
		this.workflowDefinitionLinkLocalService = workflowDefinitionLinkLocalService;
	}
860754
void registerDestination()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "registerDestination");

        // Dont register temporary destinations or system destinations.
        if (!isTemporary() && !_isSystem)
        {
            getLocalisationManager().registerDestination();
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "registerDestination");
    }
345642
public PtoPMessageItemStream getLocalisation(SIBUuid8 meUuid)
  {
    throw new InvalidOperationException(
      nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0005",
          new Object[] {
            "com.ibm.ws.sib.processor.proxyhandler.BusGroup",
            "1:591:1.54",
            getName() },
          null));
  }
1180670
private Request<CopySnapshotRequest> generateRequestForPresigning(
            String sourceSnapshotId, String sourceRegion,
            String destinationRegion) {

        CopySnapshotRequest copySnapshotRequest = new CopySnapshotRequest()
                .withSourceSnapshotId(sourceSnapshotId)
                .withSourceRegion(sourceRegion)
                .withDestinationRegion(destinationRegion);

        return new CopySnapshotRequestMarshaller()
                .marshall(copySnapshotRequest);

    }
1077400
private boolean createMQLinkMPResources(
                                            MQLinkHandler mqLinkHandler,
                                            MQLinkDefinition mqld,
                                            LocalizationDefinition linkLocalizationDefinition,
                                            VirtualLinkDefinition virtualLinkDefinition,
                                            Set<String> linkLocalizingMEs,
                                            LocalTransaction transaction,
                                            boolean linkCreated) throws SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(
                        tc,
                        "createMQLinkMPResources",
                        new Object[] { mqLinkHandler,
                                      mqld,
                                      linkLocalizationDefinition,
                                      virtualLinkDefinition,
                                      linkLocalizingMEs,
                                      transaction,
                                      new Boolean(linkCreated) });

        boolean engineResourcesRequired = false;

        //For MQLinks, we want the QueueHigh messages to be the same as for
        //transmit queues.
        linkLocalizationDefinition.setDestinationHighMsgs(messageProcessor.getHighMessageThreshold());
        linkLocalizationDefinition.setDestinationLowMsgs((messageProcessor.getHighMessageThreshold() * 8) / 10);

        //If we didnt just create the linkHandler and the one that already
        //existed is for a different UUID, or there is already a localisation for
        //the linkHandler on this ME, then this could be a problem and further
        //tests are required.
        if (!linkCreated)
        {
            /*
             * 182456.6
             * For the move to WCCM, createDestination can be called for
             * destinations in WCCM that the message processor already
             * holds state about. This is ok as long as the destination has
             * not already been reconciled.
             */
//      if (mqLinkHandler.isReconciled())
//      {
//        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
//          SibTr.exit(
//            tc,
//            "createMQLinkMPResources",
//            "Link already exists");
//
//        throw new SIMPDestinationAlreadyExistsException(
//          nls.getFormattedMessage(
//            "LINK_ALREADY_EXISTS_ERROR_CWSIP0043",
//            new Object[] { virtualLinkDefinition.getName(),
//                           messageProcessor.getMessagingEngineName()},
//            null));
//      }

            // Handle uuid changes
            if (!(mqld.getUuid().equals(mqLinkHandler.getMqLinkUuid())))
            {
                // Need to set the toBeDeleted flag in the "old" handler
                // and set up a new handler
                deleteRecreateMQLinkHandler(
                                            mqld,
                                            mqLinkHandler,
                                            virtualLinkDefinition,
                                            linkLocalizationDefinition,
                                            transaction);

            }
            else
            {
                /*
                 * Link already exists. In the new WCCM world, the
                 * create should complete succesfully, with the new link
                 * definition replacing the existing one.
                 */
                mqLinkHandler.updateLinkDefinition(virtualLinkDefinition, transaction);

                // Flag that we need to tell the MQLink component to create its MQLink infrastructure.
                engineResourcesRequired = true;

                if (linkLocalizingMEs == null)
                {
                    linkLocalizingMEs = new HashSet<String>();
                    linkLocalizingMEs.add(messageProcessor.getMessagingEngineUuid().toString());
                }

                //        Alert the lookups object to handle the re-definition
                linkIndex.setLocalizationFlags(mqLinkHandler, true, false);

                //MQLinks have a real localisation associated with them, so it can
                //be updated here
                mqLinkHandler.updateLocalizationDefinition(linkLocalizationDefinition, transaction);

                // Alert the lookups object to handle the re-definition
                linkIndex.create(mqLinkHandler);

            }
        }
        else // we did just create the linkHandler.
        {
            //First add the localization for the MQlink
            mqLinkHandler.addNewMQLinkLocalisation(
                                                   transaction,
                                                   messageProcessor.getMessagingEngineUuid(),
                                                   linkLocalizationDefinition);

            // Flag that we need to tell the MQLink component to create its MQLink infrastructure.
            engineResourcesRequired = true;

        } // eof we did just create the linkHandler

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "createMQLinkMPResources", new Boolean(engineResourcesRequired));

        return engineResourcesRequired;
    }