Validates that aan alias conforms to OSGi specs requirements. See OSGi R4
Http Service specs for details about alias validation.

@param alias to validate
@return received alias if validation succeeds
@throws IllegalArgumentException if validation fails
336927
private static String validateAlias(final String alias) {
		NullArgumentException.validateNotNull(alias, "Alias");
		if (!alias.startsWith("/")) {
			throw new IllegalArgumentException(
					"Alias does not start with slash (/)");
		}
		// "/" must be allowed
		if (alias.length() > 1 && alias.endsWith("/")) {
			throw new IllegalArgumentException("Alias ends with slash (/)");
		}
		return alias;
	}
480048
public static Emoji getForAlias(String alias) {
    if (alias == null) {
      return null;
    }
    return EMOJIS_BY_ALIAS.get(trimAlias(alias));
  }
125202
public OvhAlias serviceName_output_elasticsearch_alias_aliasId_GET(String serviceName, String aliasId) throws IOException {
		String qPath = "/dbaas/logs/{serviceName}/output/elasticsearch/alias/{aliasId}";
		StringBuilder sb = path(qPath, serviceName, aliasId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhAlias.class);
	}
631845
public String validate(KeyStore keyStore, String keyAlias) throws CertificateException {
        String result = null;
        if (keyAlias != null) {
            try {
                validate(keyStore, keyStore.getCertificate(keyAlias));
            } catch (KeyStoreException kse) {
                logger.debug("", kse);
                throw new CertificateException("Unable to validate certificate" +
                        " for alias [" + keyAlias + "]: " + kse.getMessage(), kse);
            }
            result = keyAlias;
        }
	return result;
    }
49986
public synchronized SSLConfig getSSLConfig(String alias) throws IllegalArgumentException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.entry(tc, "getSSLConfig: " + alias);

        SSLConfig rc = null;
        if (alias == null || alias.equals("")) {
            rc = getDefaultSSLConfig();
        } else {
            // sslConfigMap is not yet populated!!!
            rc = sslConfigMap.get(alias);
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            Tr.exit(tc, "getSSLConfig", rc);
        return rc;
    }
229693
public String removeResourceAlias(String alias)
    {
        if (_resourceAliases == null)
            return null;
        return (String)_resourceAliases.remove(alias);
    }
928618
public String addAlias(String indice,String alias){
		String aliasJson = new StringBuilder().append("{\"actions\": [{\"add\": {\"index\":\"").append(indice).append("\",\"alias\": \"").append(alias).append("\"}}]}").toString();
		return this.client.executeHttp("_aliases",aliasJson,ClientUtil.HTTP_POST);
	}
1169111
public T validateNamespace(String prefix, String namespaceUri) {
        xmlMessageValidationContext.getControlNamespaces().put(prefix, namespaceUri);
        return self;
    }
672371
public Result<NsDAO.Data> validNSOfDomain(AuthzTrans trans, String id) {
		// Take domain, reverse order, and check on NS
		String ns;
		if(id.indexOf('@')<0) { // it's already an ns, not an ID
			ns = id;
		} else {
			ns = domain2ns(id);
		}
		if (ns.length() > 0) {
			if(!trans.org().getDomain().equals(ns)) { 
				Result<List<NsDAO.Data>> rlnsd = nsDAO.read(trans, ns);
				if (rlnsd.isOKhasData()) {
					return Result.ok(rlnsd.value.get(0));
				}
			}
		}
		return Result.err(Status.ERR_NsNotFound,
				"A Namespace is not available for %s", id);
	}
880571
def validate_account_alias(iam_client, account_alias):
    """"""
    # Super overkill here using pagination when an account can only
    # have a single alias, but at least this implementation should be
    # future-proof
    current_account_aliases = []
    paginator = iam_client.get_paginator('list_account_aliases')
    response_iterator = paginator.paginate()
    for page in response_iterator:
        current_account_aliases.extend(page.get('AccountAliases', []))
    if account_alias in current_account_aliases:
        LOGGER.info('Verified current AWS account alias matches required '
                    'alias %s.',
                    account_alias)
    else:
        LOGGER.error('Current AWS account aliases "%s" do not match '
                     'required account alias %s in Runway config.',
                     ','.join(current_account_aliases),
                     account_alias)
        sys.exit(1)
222973
private DestinationHandler createAliasDestination(DestinationAliasDefinition add, AliasChainValidator validator, DestinationHandler baseDest) throws SINotPossibleInCurrentConfigurationException, SIMPDestinationCorruptException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "createAliasDestination", new Object[] { add, validator, baseDest });

        String destinationName = add.getName();
        String busName = add.getBus();

        // Through the admin panels it is possible for an empty string to be specified.
        // An empty string means use the local bus name.
        if (busName == null || busName.equals(""))
            busName = messageProcessor.getMessagingEngineBus();

        // If the validator is null, we must be at the top of any alias chain.
        if (null == validator)
        {
            validator = new AliasChainValidator();
        }

        // Check that we are not going around in a loop with alias validation.
        validator.validate(destinationName, busName);

        AliasDestinationHandler aliasDestinationHandler = null;

        try
        {
            boolean aliasChainError = false;

            // If we are trying to plug in a destination handler rather than look it up then we need
            // to check that we are not an alias chain. If we are we recursively call into the chain
            // handing the plugin destination to the last one.
            if (baseDest != null)
            {
                String targetBus = add.getTargetBus();
                if (targetBus == null || targetBus.equals(""))
                    targetBus = messageProcessor.getMessagingEngineBus();

                // If the name of the current alias target is not the same as the plugin basedest, then
                // we are an alias chaing and we create the next part of the chain passing in the basedest
                if (!add.getTargetName().equals(baseDest.getName()) || !targetBus.equals(baseDest.getBus()))
                {
                    baseDest = getAliasDestinationInternal(add.getTargetName(), targetBus, validator, baseDest, false);
                    if (baseDest == null)
                        aliasChainError = true;
                }
            }

            //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)
            {
                DestinationHandler targetDH = baseDest;

                if (targetDH == null && !aliasChainError)
                {

                    targetDH =
                                    getDestinationInternal(
                                                           add.getTargetName(),
                                                           add.getTargetBus(),
                                                           validator,
                                                           false,
                                                           false);

                }

                if (targetDH == null)
                {
                    // Throw out exception detailing chain
                    // Add the destination name which has triggered the exception to the end
                    // of the list, making the problem obvious.
                    String chainText = validator.toStringPlus(add.getTargetName(), busName);

                    String targetName = add.getTargetName();
                    AliasChainValidator.CompoundName firstInChain = validator.getFirstInChain();

                    SIMPNotPossibleInCurrentConfigurationException e =
                                    new SIMPNotPossibleInCurrentConfigurationException(
                                                    nls_cwsik.getFormattedMessage(
                                                                                  "DELIVERY_ERROR_SIRC_45", // ALIAS_TARGET_DESTINATION_NOT_FOUND_EXCEPTION_CWSIP0057
                                                                                  new Object[]
                                                                                  { firstInChain.getDestName(), targetName },
                                                                                  null)
                                    );

                    e.setExceptionReason(SIRCConstants.SIRC0028_ALIAS_TARGET_DESTINATION_NOT_FOUND_EXCEPTION);
                    e.setExceptionInserts(new String[] { firstInChain.getDestName(), targetName });

                    SibTr.exception(tc, e);

                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(tc, "createAliasDestination", e);
                    throw e;
                }
                else if (targetDH.getDestinationType().equals(DestinationType.SERVICE))
                {
                    // Throw out exception detailing chain
                    // Add the destination name which has triggered the exception to the end
                    // of the list, making the problem obvious.
                    String chainText = validator.toStringPlus(targetDH.getName(), targetDH.getBus());

                    AliasChainValidator.CompoundName firstInChain = validator.getFirstInChain();

                    String nlsMessage =
                                    nls_cwsik.getFormattedMessage(
                                                                  "DELIVERY_ERROR_SIRC_29", // ALIAS_TARGETS_SERVICE_DESTINATION_ERROR_CWSIP0622
                                                                  new Object[]
                                                                  { firstInChain.getDestName(), targetDH.getName(), chainText, busName },
                                                                  null);

                    SIMPNotPossibleInCurrentConfigurationException e = new SIMPNotPossibleInCurrentConfigurationException(nlsMessage);

                    e.setExceptionReason(SIRCConstants.SIRC0029_ALIAS_TARGETS_SERVICE_DESTINATION_ERROR);
                    e.setExceptionInserts(new String[] { firstInChain.getDestName(), targetDH.getName(), chainText, busName });

                    SibTr.exception(tc, e);

                    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                        SibTr.exit(tc, "createAliasDestination", e);
                    throw e;
                }

                // Create a new DestinationHandler, which is created locked
                aliasDestinationHandler = new AliasDestinationHandler(add, messageProcessor, this, targetDH, busName);

                DestinationIndex.Type type = new DestinationIndex.Type();
                type.alias = Boolean.TRUE;
                type.foreignDestination = Boolean.FALSE;
                type.local = Boolean.FALSE;
                type.remote = Boolean.FALSE;
                type.queue = new Boolean(!aliasDestinationHandler.isPubSub());
                type.state = State.ACTIVE;
                destinationIndex.put(aliasDestinationHandler, type);
            }
        } catch (SITemporaryDestinationNotFoundException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.DestinationManager.createAliasDestination",
                                        "1:6701:1.508.1.7",
                                        this);

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

            SIMPErrorException ee = new SIMPErrorException(
                            nls_cwsik.getFormattedMessage(
                                                          "DELIVERY_ERROR_SIRC_901",
                                                          new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:6710:1.508.1.7", e, destinationName },
                                                          null),
                            e);

            ee.setExceptionReason(SIRCConstants.SIRC0901_INTERNAL_MESSAGING_ERROR);
            ee.setExceptionInserts(new String[] { "com.ibm.ws.sib.processor.impl.DestinationManager",
                                                 "1:6716:1.508.1.7",
                                                 SIMPUtils.getStackTrace(e) });
            throw ee;
        } catch (SIIncorrectCallException e)
        {
            // FFDC
            FFDCFilter.processException(
                                        e,
                                        "com.ibm.ws.sib.processor.impl.DestinationManager.createAliasDestination",
                                        "1:6166:1.487",
                                        this);

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

            SIMPErrorException ee = new SIMPErrorException(
                            nls_cwsik.getFormattedMessage(
                                                          "DELIVERY_ERROR_SIRC_901",
                                                          new Object[] { "com.ibm.ws.sib.processor.impl.DestinationManager", "1:6175:1.487", e, destinationName },
                                                          null),
                            e);

            ee.setExceptionReason(SIRCConstants.SIRC0901_INTERNAL_MESSAGING_ERROR);
            ee.setExceptionInserts(new String[] { "com.ibm.ws.sib.processor.impl.DestinationManager",
                                                 "1:6181:1.487",
                                                 SIMPUtils.getStackTrace(e) });
            throw ee;
        }

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

        return aliasDestinationHandler;
    }
1003177
protected String resolveKey(String alias) {
		List<String> possibleKeys = aliases.get(alias);
		for (String key : possibleKeys) {
			if (resolver.containsProperty(key)) {
				return key;
			}
		}
		return null;
	}
4813
public String removeAlias(String indice,String alias){
		String removeAlias = new StringBuilder().append("{\"actions\": [{\"remove\": {\"index\":\"").append(indice).append("\",\"alias\": \"").append(alias).append("\"}}]}").toString();
		return this.client.executeHttp("_aliases",removeAlias,ClientUtil.HTTP_POST);
	}
742990
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString id_validator = new MPSString();
		id_validator.validate(operationType, id, "\"id\"");
		
		MPSInt ica_license_in_use_validator = new MPSInt();
		ica_license_in_use_validator.validate(operationType, ica_license_in_use, "\"ica_license_in_use\"");
		
		MPSIPAddress ns_ip_address_validator = new MPSIPAddress();
		ns_ip_address_validator.validate(operationType, ns_ip_address, "\"ns_ip_address\"");
		
	}
211675
def _validate_alias_command(alias_command):
    
    if not alias_command:
        raise CLIError(EMPTY_ALIAS_ERROR)

    split_command = shlex.split(alias_command)
    boundary_index = len(split_command)
    for i, subcommand in enumerate(split_command):
        if not re.match('^[a-z]', subcommand.lower()) or i > COLLISION_CHECK_LEVEL_DEPTH:
            boundary_index = i
            break

    # Extract possible CLI commands and validate
    command_to_validate = ' '.join(split_command[:boundary_index]).lower()
    for command in azext_alias.cached_reserved_commands:
        if re.match(r'([a-z\-]*\s)*{}($|\s)'.format(command_to_validate), command):
            return

    _validate_positional_arguments(shlex.split(alias_command))
643388
public DestinationHandler getAliasDestinationInternal(String aliasName, String aliasBus, AliasChainValidator validator, DestinationHandler targetDest, boolean includeInvisible)
                    throws SITemporaryDestinationNotFoundException, SINotPossibleInCurrentConfigurationException, SIMPDestinationCorruptException, SIResourceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "getAliasDestination", new Object[] { aliasName, aliasName, targetDest, Boolean.valueOf(includeInvisible) });

        DestinationHandler destinationHandler = getDestinationInternal(aliasName, aliasBus, includeInvisible);

        try
        {
            if (destinationHandler == null)
            {
                BaseDestinationDefinition bdd = messageProcessor.getMessagingEngine().getSIBDestination(aliasBus, aliasName);

                // The returned destination can be remote or an alias.  We need to act
                // accordingly.
                if (bdd.isAlias())
                {
                    // The destination is an alias.
                    DestinationAliasDefinition add = (DestinationAliasDefinition) bdd;

                    destinationHandler = createAliasDestination(add, validator, targetDest);
                }
            }
        }

        // Catch Admin's SIBExceptionDestinationNotFound exception
        catch (SIBExceptionDestinationNotFound e)
        {
            // No FFDC code needed

            SibTr.exception(tc, e);

            // Exception not fatal - just return null to show no destiation has been
            // found.
        } catch (SIBExceptionBase e)
        {
            // No FFDC code needed

            SibTr.exception(tc, e);

            // TO DO - handle this
        } catch (SIResourceException e)
        {
            // No FFDC code needed
            if (!(e instanceof SIMPResourceException))
            {
                SIMPResourceException ee = new SIMPResourceException(e);
                ee.setExceptionReason(SIRCConstants.SIRC0901_INTERNAL_MESSAGING_ERROR);
                ee.setExceptionInserts(new String[] { "com.ibm.ws.sib.processor.impl.DestinationManager.getAliasDestination",
                                                     "1:8188:1.508.1.7",
                                                     SIMPUtils.getStackTrace(e) });
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                    SibTr.exit(tc, "getAliasDestination", ee);
                throw ee;
            }

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

        }

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

        return destinationHandler;
    }
1025280
protected void validate(String operationType) throws Exception
	{
		super.validate(operationType);

		MPSString mapped_port_validator = new MPSString();
		mapped_port_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		mapped_port_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		mapped_port_validator.validate(operationType, mapped_port, "\"mapped_port\"");
		
		MPSIPAddress host_ip_address_validator = new MPSIPAddress();
		host_ip_address_validator.validate(operationType, host_ip_address, "\"host_ip_address\"");
		
		MPSString port_validator = new MPSString();
		port_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		port_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		port_validator.validate(operationType, port, "\"port\"");
		
		MPSString state_validator = new MPSString();
		state_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		state_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		state_validator.validate(operationType, state, "\"state\"");
		
		MPSString pair_port_validator = new MPSString();
		pair_port_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 10);
		pair_port_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		pair_port_validator.validate(operationType, pair_port, "\"pair_port\"");
		
		MPSString mode_validator = new MPSString();
		mode_validator.setConstraintMaxStrLen(MPSConstants.GENERIC_CONSTRAINT, 32);
		mode_validator.setConstraintMinStrLen(MPSConstants.GENERIC_CONSTRAINT, 1);
		mode_validator.validate(operationType, mode, "\"mode\"");
		
	}