/*
(non-Javadoc)

@see com.ibm.ws.sib.processor.MPCoreConnection#createSystemDestination(java.lang.String)
548265
@Override
    public JsDestinationAddress createSystemDestination(String prefix)
                    throws SIResourceException, SIMPDestinationAlreadyExistsException, SIIncorrectCallException
    {
        //prefixes should be unique, 24 chars or less and
        //can contain the characters a-z, A-Z, 0-9, ., /, and %.
        boolean valid = isDestinationPrefixValid(prefix);
        if (!valid)
        {
            throw new SIInvalidDestinationPrefixException(
                            nls.getFormattedMessage(
                                                    "INVALID_DESTINATION_PREFIX_ERROR_CWSIP0023",
                                                    new Object[] { prefix },
                                                    null));
        }

        return _destinationManager.createSystemDestination(prefix);
    }
265501
@Override
    public SIDestinationAddress createTemporaryDestination(Distribution distribution,
                                                           String destinationPrefix)

                    throws SIConnectionUnavailableException, SIConnectionDroppedException,
                    SIResourceException, SIConnectionLostException, SILimitExceededException,
                    SIErrorException,
                    SINotAuthorizedException,
                    SIInvalidDestinationPrefixException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.entry(CoreSPIConnection.tc, "createTemporaryDestination",
                        new Object[] { this, destinationPrefix, distribution });

        // See if this connection has been closed
        checkNotClosed();

        // Check to make sure that the destination prefix is valid. 
        // If it's not, then we can't continue.
        String result = SICoreUtils.isDestinationPrefixValid(destinationPrefix);
        if (!result.equals(SICoreUtils.VALID)) // if its not valid there is something wrong
        {
            if (result.equals(SICoreUtils.MAX_LENGTH_EXCEEDED)) {// prefix length might have been exceeded
                if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
                    SibTr.exit(CoreSPIConnection.tc, "createTemporaryDestination", "SIInvalidDestinationPrefixException");
                throw new SIInvalidDestinationPrefixException(
                                nls.getFormattedMessage(
                                                        "INVALID_DESTINATION_PREFIX_MAX_LENGTH_ERROR_CWSIP0039",
                                                        null,
                                                        null));
            } else { // an invalid character is there in the prefix 

                if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
                    SibTr.exit(CoreSPIConnection.tc, "createTemporaryDestination", "SIInvalidDestinationPrefixException");
                throw new SIInvalidDestinationPrefixException(
                                nls.getFormattedMessage(
                                                        "INVALID_DESTINATION_PREFIX_CHAR_ERROR_CWSIP0040",
                                                        new Object[] { destinationPrefix, result },
                                                        null));
            }
        }

        SIDestinationAddress address = null;

        // Synchronize on the close object, we don't want the connection closing
        // while we try to add the temporary destination.
        synchronized (this)
        {
            // Check authority to create destination
            // If security is disabled then we'll bypass the check
            checkTempDestinationCreation((destinationPrefix == null ? "" : destinationPrefix), distribution);

            // Synchronize on the temporaryDestinations list object so that we can't collide
            // on creations. This will also ensure list integrity.
            synchronized (_temporaryDestinations)
            {
                //pass this on to the destination manager
                try
                {
                    address =
                                    _destinationManager.createTemporaryDestination(distribution, destinationPrefix);
                } catch (SIMPDestinationAlreadyExistsException e)
                {
                    // FFDC
                    FFDCFilter.processException(
                                                e,
                                                "com.ibm.ws.sib.processor.impl.ConnectionImpl.createTemporaryDestination",
                                                "1:3712:1.347.1.25",
                                                this);

                    SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                new Object[] {
                                              "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                              "1:3718:1.347.1.25",
                                              e });

                    // This should never be thrown
                    if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
                        SibTr.exit(CoreSPIConnection.tc, "createTemporaryDestination", "SIErrorException");
                    throw new SIErrorException(
                                    nls.getFormattedMessage(
                                                            "INTERNAL_MESSAGING_ERROR_CWSIP0002",
                                                            new Object[] {
                                                                          "com.ibm.ws.sib.processor.impl.ConnectionImpl",
                                                                          "1:3729:1.347.1.25",
                                                                          e },
                                                            null),
                                    e);
                }

                //add to list
                _temporaryDestinations.add(address.getDestinationName());
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConnection.tc, "createTemporaryDestination", address);

        return address;
    }
294216
public void setSystemName(String systemName) {
		this.systemName = systemName;
		for (SamzaSystemStream systemStream:systemStreams) {
			systemStream.setSystem(systemName);
		}
	}
773622
@Override
    public IPortletEntity createPortletEntity(
            IPortletDefinitionId portletDefinitionId, String layoutNodeId, int userId) {
        if (layoutNodeId.startsWith(TransientUserLayoutManagerWrapper.SUBSCRIBE_PREFIX)) {
            final String transientLayoutNodeId = layoutNodeId;
            layoutNodeId = this.getPersistentLayoutNodeId(portletDefinitionId);

            final IPortletEntity portletEntity =
                    this.delegatePortletEntityDao.createPortletEntity(
                            portletDefinitionId, layoutNodeId, userId);
            return new TransientPortletEntity(portletEntity, transientLayoutNodeId);
        }

        return this.delegatePortletEntityDao.createPortletEntity(
                portletDefinitionId, layoutNodeId, userId);
    }
619670
private SIDestinationAddress createTemporaryDestination(Distribution destType, String prefix) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createTemporaryDestination", new Object[] { destType, prefix });
        SIDestinationAddress da = null;

        try {
            da = getCoreConnection().createTemporaryDestination(destType, prefix);
        } catch (SIInvalidDestinationPrefixException siidpe) {
            // No FFDC code needed
            // d238447 FFDC review. App error, no FFDC required.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "INVALID_VALUE_CWSIA0048",
                                                            new Object[] { "TempDestPrefix", prefix },
                                                            siidpe,
                                                            null, // null probeId = no FFDC
                                                            this,
                                                            tc
                            );
        } catch (SIConnectionLostException sice) {
            // No FFDC code needed
            // d238447 FFDC review. ConnectionLost is external and probably already FFDCd.
            // Don't generate FFDC at this level.
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0053",
                                                            new Object[] { sice, "JmsSessionImpl.createTemporaryDestination (#2)" },
                                                            sice,
                                                            null, // null probeId = no FFDC
                                                            this,
                                                            tc
                            );
        } catch (SINotAuthorizedException sinae) {
            // No FFDC code needed
            String userID = "<unknown>";
            try {
                userID = coreConnection.getResolvedUserid();
            } catch (SIException e) {
                // No FFDC code needed
                // things are obviously not good, better to proceed with the original
                // error message than to start complaining about this new problem, but
                // we can add a debug output
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(this, tc, "failed to get resovledUserId: " + e);
            }
            // d238447 FFDC Review. NotAuth is app/config. Don't FFDC.
            throw (JMSSecurityException) JmsErrorUtils.newThrowable(JMSSecurityException.class,
                                                                    "AUTHORIZATION_FAILED_CWSIA0057",
                                                                    new Object[] { userID },
                                                                    sinae,
                                                                    null, // null probeId = no FFDC
                                                                    this,
                                                                    tc
                            );
        } catch (SIConnectionUnavailableException sioce) {
            // No FFDC code needed
            // d238447 FFDC review. App error? The createTemp methods in this class call checkClosed,
            //   so it could be argued that this is an internal error. However, we don't defend
            //   concurrent close during the createTemp calls, so you probably could get to here
            //   with a badly coded app'. No FFDC required.
            throw (javax.jms.IllegalStateException) JmsErrorUtils.newThrowable(javax.jms.IllegalStateException.class,
                                                                               "CONNECTION_CLOSED_CWSIA0051",
                                                                               null,
                                                                               sioce,
                                                                               null, // null probeId = no FFDC
                                                                               this,
                                                                               tc
                            );
        } catch (SIException sice) {
            // No FFDC code needed
            // d238447 FFDC review. Exceptions to be considered:
            //   SIInvalidDestinationPrefixException                               \
            //   SIConnectionUnavailableException, SIConnectionDroppedException,    > Handled above
            //   SINotAuthorizedException, SIConnectionLostException               /
            // SIResourceException, -- ? anyone's guess, but probably already FFDC'd in lower level.
            // SILimitExceededException -- architected limit, no FFDC
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0053",
                                                            new Object[] { sice, "JmsSessionImpl.createTemporaryDestination (#5)" },
                                                            sice,
                                                            null, // null probeId = no FFDC
                                                            this,
                                                            tc
                            );
        } catch (Exception e) {
            // No FFDC code needed
            // d238447 FFDC review. Generate FFDC
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0053",
                                                            new Object[] { e, "JmsSessionImpl.createTemporaryDestination (#6)" },
                                                            e,
                                                            "JmsSessionImpl.createTemporaryDestination#6",
                                                            this,
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "createTemporaryDestination", da);
        return da;
    }
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");
    }
217320
public Response createSystemProperty(SystemProperty property) {
		return restClient.post("system/properties", property, new HashMap<String, String>());
	}
107480
public JmsDestinationModel createUnique(Set<ProjectModel> applications, String jndiName, String destinationTypeClass)
    {
        JmsDestinationType destinationType = JmsDestinationService.getTypeFromClass(destinationTypeClass);

        return this.createUnique(applications, jndiName, destinationType);
    }
1346188
public void startNewSystemThread(Runnable runnable)
                    throws InterruptedException {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "startNewSystemThread", runnable);

        if (_systemThreadPool == null) {
            createSystemThreadPool();
        }

        try {
            _systemThreadPool.execute(runnable,
                                      ThreadPool.EXPAND_WHEN_QUEUE_IS_FULL_WAIT_AT_LIMIT);
        } catch (ThreadPoolQueueIsFullException e) {
            // Exception should never occur as we are waiting when the queue is
            // full.
            FFDCFilter
                            .processException(
                                              e,
                                              "com.ibm.ws.sib.processor.impl.MessageProcessor.startNewSystemThread",
                                              "1:2758:1.445", this);
        }

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "startNewSystemThread");
    }
245349
public JmsDestinationType<WebFragmentDescriptor> getOrCreateJmsDestination()
   {
      List<Node> nodeList = model.get("jms-destination");
      if (nodeList != null &&  nodeList.size() > 0)
      {
         return new JmsDestinationTypeImpl<WebFragmentDescriptor>(this, "jms-destination", model, nodeList.get(0));
      }
      return createJmsDestination();
   }
166996
SibRaListener createListener(final SIDestinationAddress destination, MessageEndpointFactory messageEndpointFactory)
                    throws ResourceException {

        final String methodName = "createListener";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName, new Object[] { destination, messageEndpointFactory });
        }

        if (_closed) {

            throw new IllegalStateException(NLS
                            .getString("LISTENER_CLOSED_CWSIV0952"));

        }

        final SibRaListener listener;

        listener = new SibRaSingleProcessListener(this, destination, messageEndpointFactory);
        _listeners.put(destination, listener);

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName, listener);
        }
        return listener;

    }
403757
private P createViewIdAndCreatePresenter() {

    P presenter = delegateCallback.createPresenter();
    if (presenter == null) {
      throw new NullPointerException(
          "Presenter returned from createPresenter() is null. Activity is " + activity);
    }
    if (keepPresenterInstance) {
      mosbyViewId = UUID.randomUUID().toString();
      PresenterManager.putPresenter(activity, mosbyViewId, presenter);
    }
    return presenter;
  }
25603
@Override
    public SIDestinationAddress[] addDestinationListener(String destinationNamePattern, DestinationListener destinationListener, DestinationType destinationType,
                                                         DestinationAvailability destinationAvailability)
                    throws SIIncorrectCallException, SICommandInvocationFailedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIConnectionLostException
    {
        return _delegateConnection.addDestinationListener(destinationNamePattern, destinationListener, destinationType, destinationAvailability);
    }
572638
public static NetworkSystemBartender
  createAndAddSystem(SystemManager systemManager,
                     ServerBartender selfServer,
                     Config config)
  {
    NetworkSystemBartender clusterSystem
      = new NetworkSystemBartender(systemManager, selfServer, config);
    
    createAndAddSystem(clusterSystem);
    
    return clusterSystem;
  }
943646
@Override
	public void createPartition(ObjectPath tablePath, CatalogPartitionSpec partitionSpec, CatalogPartition partition, boolean ignoreIfExists)
			throws TableNotExistException, TableNotPartitionedException, PartitionSpecInvalidException, PartitionAlreadyExistsException, CatalogException {
		throw new UnsupportedOperationException();
	}
834614
@Override
    public void sendToExceptionDestination(
                                           SIDestinationAddress address,
                                           SIBusMessage message,
                                           int reason,
                                           String[] inserts,
                                           SITransaction tran,
                                           String alternateUser)
                    throws SIResourceException, SIConnectionLostException, SILimitExceededException,
                    SIErrorException,
                    SINotAuthorizedException,
                    SIIncorrectCallException,
                    SINotPossibleInCurrentConfigurationException
    {
        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.entry(CoreSPIConnection.tc, "sendToExceptionDestination",
                        new Object[] { this, address, alternateUser, message, Integer.valueOf(reason), inserts, tran });

        if (message == null)
        {
            if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
                SibTr.exit(CoreSPIConnection.tc, "sendToExceptionDestination", "SIIncorrectCallException - null msg");
            throw new SIIncorrectCallException(
                            nls_cwsir.getFormattedMessage(
                                                          "SEND_EXCEPTION_DEST_CWSIR0121",
                                                          null,
                                                          null));
        }

        // Get an exception destination instance
        ExceptionDestinationHandlerImpl exDestHandler =
                        new ExceptionDestinationHandlerImpl(address, _messageProcessor);

        exDestHandler.sendToExceptionDestination(message,
                                                 alternateUser,
                                                 (TransactionCommon) tran,
                                                 reason,
                                                 this,
                                                 inserts);

        if (TraceComponent.isAnyTracingEnabled() && CoreSPIConnection.tc.isEntryEnabled())
            SibTr.exit(CoreSPIConnection.tc, "sendToExceptionDestination");
    }
1257881
public void createDestination(Destination dest, Reliability defaultReliability) 
    throws JMSException
  {

    try
    {
    
      if (tcInt.isEntryEnabled())
        SibTr.entry(tcInt, "createDestination(Destination)");    
         
      com.ibm.wsspi.sib.core.DestinationType destType = null;
      String name = null;
  
      try
      {
  
        // Work out which type of Destination we want to create.
        if (dest instanceof JmsQueue)
        {
          destType = com.ibm.wsspi.sib.core.DestinationType.QUEUE;
          name = ((JmsQueue) dest).getQueueName();
  
        } else if (dest instanceof JmsTopic)
        {
          destType = com.ibm.wsspi.sib.core.DestinationType.TOPICSPACE;
          name = ((JmsTopic) dest).getTopicSpace();
        } else
        {
          destType = null;
          name = null;
        }
        
        if (tcInt.isDebugEnabled())
        {
          SibTr.debug(tcInt, "    name: "+name);
          SibTr.debug(tcInt, "destType: "+destType);
        }
          
  
        if (destType != null)
        {
          // Defer to the other method.
          createDestination(name, destType, defaultReliability);
        } else
        {
          throw new JMSException("Could not create Destination - destType was null");
        }
  
      } catch (JMSException e)
      {
        // No FFDC code needed
        if (tcInt.isDebugEnabled())
          SibTr.debug(tcInt, "JMSException during createDestination", e);
          
        throw e;
  
      } catch (Exception f)
      {
        // No FFDC code needed
        if (tcInt.isDebugEnabled())
          SibTr.debug(tcInt, "Exception during createDestionation", f);
          
        JMSException jmse = new JMSException("Exception from createDestination");
        jmse.setLinkedException(f);
        jmse.initCause(f);
        throw jmse;
  
      } //try

    } finally
    {    
      if (tcInt.isEntryEnabled())
         SibTr.exit(tcInt, "createDestination(Destination)");
    }//

  }