/** * Constructor. * * @param attributeResolutionContext the resolution context. * @param attributeId the id of the attribute being resolved. */ public V2SAMLProfileRequestContext(@Nonnull final AttributeResolutionContext attributeResolutionContext, @Nullable final String attributeId) { resolutionContext = Constraint.isNotNull(attributeResolutionContext, "Attribute Resolution Context was null"); id = StringSupport.trimOrNull(attributeId); }
/** * Set the property names to treat as defunct. * * @param properties defunct property names */ public void setDeadProperties(@Nonnull @NonnullElements final Collection<String> properties) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); Constraint.isNotNull(properties, "Property collection cannot be null"); deadProperties = StringSupport.normalizeStringCollection(properties); }
/** * Set the keytab to use. keytab and password are mutually exclusive. * * @param newKeytab keytab to use */ public void setKeytab(@Nullable final String newKeytab) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); keytab = StringSupport.trim(newKeytab); }
/** * Set the canonical principal name of the subject. * * @param name the canonical principal name * * @return this context */ @Nonnull public SubjectCanonicalizationContext setPrincipalName(@Nullable final String name) { principalName = StringSupport.trimOrNull(name); return this; }
/** * Set the Format attribute supported. * * @param f format to set */ public void setFormat(@Nonnull @NotEmpty final String f) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); format = Constraint.isNotNull(StringSupport.trimOrNull(f), "Format cannot be null or empty"); }
/** * Gets the list value of the <code>soap11:encodingStyle</code> attribute from the given SOAP object. * * @param soapObject the SOAP object to add the attribute to * * @return the list of encoding styles, or null if not present */ @Nullable public static List<String> getSOAP11EncodingStyles(@Nonnull final XMLObject soapObject) { if (soapObject instanceof EncodingStyleBearing) { List<String> value = ((EncodingStyleBearing) soapObject).getSOAP11EncodingStyles(); if (value != null) { return value; } } if (soapObject instanceof AttributeExtensibleXMLObject) { String value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject) .getUnknownAttributes().get(EncodingStyleBearing.SOAP11_ENCODING_STYLE_ATTR_NAME)); if (value != null) { StringSupport.stringToList(value, XMLConstants.LIST_DELIMITERS); } } return null; }
/** * Set the {@link DateTime} formatting string to apply when writing {@link DateTime}-valued fields. * * @param format formatting string */ public void setDateTimeFormat(@Nullable @NotEmpty final String format) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); dateTimeFormat = StringSupport.trimOrNull(format); }
/** * Set a short/concise name for the binding. * * @param name name to set */ public void setShortName(@Nullable @NotEmpty final String name) { shortName = StringSupport.trimOrNull(name); }
/** * Set the error messages to check for classifying a driver error as retryable, generally indicating * a lock violation or duplicate insert that signifies a broken database. * * @param errors retryable messages */ public void setRetryableErrors(@Nullable @NonnullElements final Collection<String> errors) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); retryableErrors = new ArrayList(StringSupport.normalizeStringCollection(errors)); }
/** * Set the optional DNS subject alt names. * * @param altNames collection of subject alt names. */ public void setDNSSubjectAltNames(@Nonnull @NonnullElements final String altNames) { final List<String> nameList = StringSupport.stringToList(altNames, " "); generator.setDNSSubjectAltNames(nameList); }
/** {@inheritDoc} */ @Override @Nullable public String apply(@Nullable final String input) { final String entityID = Constraint.isNotNull(StringSupport.trimOrNull(input), "Entity ID was null or empty"); final String digested = digester.apply(entityID); if (digested == null) { return null; } return "{sha1}" + digested; }
/** * Set the {@link NameID} formats to ignore and leave unencrypted. * * @param formats formats to exclude */ public void setExcludedFormats(@Nonnull @NonnullElements final Collection<String> formats) { excludedFormats = new HashSet<>(StringSupport.normalizeStringCollection(formats)); }
private static String createQueryString(@Nonnull final List<NameValuePair> params) throws UnsupportedEncodingException { return StringSupport.listToStringValue(args, "&");
/** * Converts the supplied value to a list of strings delimited by {@link XMLConstants#LIST_DELIMITERS} and comma. * * @param value to convert to a list * * @return list of strings */ @Nonnull public static List<String> buildStringList(final String value) { return StringSupport.stringToList(value, XMLConstants.LIST_DELIMITERS + ","); }
/** * Set the service principal name. Required. * * @param principal service principal */ public void setServicePrincipal(@Nonnull @NotEmpty final String principal) { ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this); servicePrincipal = Constraint.isNotEmpty(StringSupport.trim(principal), "Principal cannot be null or empty"); }
/** * Set the content-types to allow. * * @param types types to allow */ public void setAcceptTypes(@Nonnull final Collection<String> types) { Constraint.isNotNull(types, "Types cannot be null"); acceptTypes = new HashSet<>(StringSupport.normalizeStringCollection(types)); }
/** * Set the names of the connector's attributes that make up the dependency. * * @param names attribute names */ public void setAttributeNames(@Nonnull @NotEmpty final Collection<String> names) { attributeNames = new HashSet<>(StringSupport.normalizeStringCollection(names)); }
/** * Adds a <code>soap11:encodingStyle</code> attribute to the given SOAP object. * * @param soapObject the SOAP object to add the attribute to * @param encodingStyles the list of encoding styles to add */ public static void addSOAP11EncodingStyles(@Nonnull final XMLObject soapObject, @Nonnull final List<String> encodingStyles) { Constraint.isNotEmpty(encodingStyles, "Encoding styles list cannot be empty"); if (soapObject instanceof EncodingStyleBearing) { ((EncodingStyleBearing) soapObject).setSOAP11EncodingStyles(encodingStyles); } else if (soapObject instanceof AttributeExtensibleXMLObject) { ((AttributeExtensibleXMLObject) soapObject).getUnknownAttributes().put( EncodingStyleBearing.SOAP11_ENCODING_STYLE_ATTR_NAME, StringSupport.listToStringValue(encodingStyles, " ")); } else { throw new IllegalArgumentException( "Specified object was neither EncodingStyleBearing nor AttributeExtensible"); } }
/** * Parses the error message and appends the appropriate status info to the Item. * * @param e the error to parse * * @throws TransformerException thrown if the error does not contain the appropriate message prefix */ private void parseAndAppendStatusInfo(@Nonnull final TransformerException e) throws TransformerException { String errorMessage = StringSupport.trimOrNull(e.getMessage()); if (errorMessage == null) { throw e; } String statusMessage; if (errorMessage.startsWith(ERROR_PREFIX)) { statusMessage = StringSupport.trim(errorMessage.substring(ERROR_PREFIX.length())); item.getItemMetadata().put(new ErrorStatus(getId(), statusMessage)); } else if (errorMessage.startsWith(WARN_PREFIX)) { statusMessage = StringSupport.trim(errorMessage.substring(WARN_PREFIX.length())); item.getItemMetadata().put(new WarningStatus(getId(), statusMessage)); } else if (errorMessage.startsWith(INFO_PREFIX)) { statusMessage = StringSupport.trim(errorMessage.substring(INFO_PREFIX.length())); item.getItemMetadata().put(new InfoStatus(getId(), statusMessage)); } else { throw e; } } }
/** * Gets the list value of the <code>wsse:Usage</code> attribute from the given SOAP object. * * @param soapObject the SOAP object to add the attribute to * * @return the list of usages, or null if not present */ public static List<String> getWSSEUsages(XMLObject soapObject) { if (soapObject instanceof UsageBearing) { List<String> value = ((UsageBearing)soapObject).getWSSEUsages(); if (value != null) { return value; } } if (soapObject instanceof AttributeExtensibleXMLObject) { String value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)soapObject) .getUnknownAttributes().get(UsageBearing.WSSE_USAGE_ATTR_NAME)); if (value != null) { StringSupport.stringToList(value, XMLConstants.LIST_DELIMITERS); } } return null; } }