/** * This method may be used to register a custom resource or datatype. Note that by using custom * types, you are creating a system that will not interoperate with other systems that do not know * about your custom type. There are valid reasons however for wanting to create custom types and * this method can be used to enable them. * * <p><b>THREAD SAFETY WARNING:</b> This method is not thread safe. It should be called before any * threads are able to call any methods on this context. * * @param theTypes The custom types to add (must not be <code>null</code> or contain null elements * in the collection) */ public void registerCustomTypes(Collection<Class<? extends IBase>> theTypes) { Validate.notNull(theTypes, "theTypes must not be null"); Validate.noNullElements(theTypes.toArray(), "theTypes must not contain any null elements"); ensureCustomTypeList(); myCustomTypes.addAll(theTypes); }
public void isLatestTime(Account account, Region region, ResourceType resourceType, DateTime dt) { Validate.noNullElements(new Object[] {account, region, resourceType, dt}); Optional<Ec2Version> oEc2Version = awsService.findLatestEc2Version(account.getId(), resourceType, region); if (oEc2Version.isPresent()) { Ec2Version ec2Version = oEc2Version.get(); if (ec2Version.getTimeDetected().after(dt.toDate())) { throw new IllegalArgumentException( String.format( "latest ec2version is:%s which is later than datetime:%s", ec2Version.getTimeDetected(), dt.toDate())); } } }
/** * Concatenates the path via path separator : '/' * * @param basePath base path * @param path appended to base path * @param paths optional additional paths * @return actor path */ static String actorPath(final String basePath, final String path, final String... paths) { notBlank(basePath, "basePath"); notBlank(path, "path"); if (paths != null) { Validate.noNullElements(paths); } final StringBuilder sb = new StringBuilder(128).append(basePath).append('/').append(path); if (paths != null) { Arrays.stream(paths).forEach(p -> sb.append('/').append(p)); } return sb.toString(); }
public <R extends AbstractResource<?>> void sameAccountIdAndRegionAcrossTwoLists( Collection<R> existingResources, Collection<R> newResources) { Validate.noNullElements(new Object[] {existingResources, newResources}); R tmp = null; for (R resource : existingResources) { tmp = resource; break; } if (tmp == null) { return; } for (R resource : newResources) { Validate.isTrue(tmp.getClass().equals(resource.getClass())); break; } }
/** * Constructor. * * @param mllpComponent MLLP Component instance which is creating this endpoint. * @param wrappedEndpoint The original camel-mina endpoint instance. * @param audit Whether ATNA auditing should be performed. * @param allowIncompleteAudit Whether incomplete ATNA auditing are allowed as well. * @param sslContext the SSL context to use; {@code null} if secure communication is not used. * @param clientAuthType type of desired client authentication (NONE/WANT/MUST). * @param customInterceptors the interceptors defined in the endpoint URI. * @param sslProtocols the protocols defined in the endpoint URI or {@code null} if none were * specified. * @param sslCiphers the ciphers defined in the endpoint URI or {@code null} if none were * specified. * @param supportInteractiveContinuation {@code true} when this endpoint should support * interactive message continuation. * @param supportUnsolicitedFragmentation {@code true} when this endpoint should support segment * fragmentation. * @param supportSegmentFragmentation {@code true} when this endpoint should support segment * fragmentation. * @param interactiveContinuationDefaultThreshold default consumer-side threshold for interactive * response continuation. * @param unsolicitedFragmentationThreshold producer-side threshold for unsolicited message * fragmentation. * @param segmentFragmentationThreshold threshold for segment fragmentation. * @param interactiveContinuationStorage consumer-side storage for interactive message * continuation. * @param unsolicitedFragmentationStorage consumer-side storage for unsolicited message * fragmentation. * @param autoCancel whether the producer should automatically send a cancel message after it has * collected all interactive continuation pieces. */ public MllpEndpoint( MllpComponent mllpComponent, MinaEndpoint wrappedEndpoint, boolean audit, boolean allowIncompleteAudit, SSLContext sslContext, ClientAuthType clientAuthType, List<Hl7v2Interceptor> customInterceptors, String[] sslProtocols, String[] sslCiphers, boolean supportInteractiveContinuation, boolean supportUnsolicitedFragmentation, boolean supportSegmentFragmentation, int interactiveContinuationDefaultThreshold, int unsolicitedFragmentationThreshold, int segmentFragmentationThreshold, InteractiveContinuationStorage interactiveContinuationStorage, UnsolicitedFragmentationStorage unsolicitedFragmentationStorage, boolean autoCancel) { Validate.notNull(mllpComponent); Validate.notNull(wrappedEndpoint); Validate.noNullElements(customInterceptors); Validate.notNull(clientAuthType); this.mllpComponent = mllpComponent; this.wrappedEndpoint = wrappedEndpoint; this.audit = audit; this.allowIncompleteAudit = allowIncompleteAudit; this.sslContext = sslContext; this.clientAuthType = clientAuthType; this.customInterceptors = customInterceptors; this.sslProtocols = sslProtocols; this.sslCiphers = sslCiphers; this.supportInteractiveContinuation = supportInteractiveContinuation; this.supportUnsolicitedFragmentation = supportUnsolicitedFragmentation; this.supportSegmentFragmentation = supportSegmentFragmentation; this.interactiveContinuationDefaultThreshold = interactiveContinuationDefaultThreshold; this.unsolicitedFragmentationThreshold = unsolicitedFragmentationThreshold; this.segmentFragmentationThreshold = segmentFragmentationThreshold; this.interactiveContinuationStorage = interactiveContinuationStorage; this.unsolicitedFragmentationStorage = unsolicitedFragmentationStorage; this.autoCancel = autoCancel; }
public <R extends AbstractResource<?>> void isSameTime(Collection<R> newResources, DateTime dt) { Validate.noNullElements(new Object[] {newResources, dt}); for (R resource : newResources) { Validate.isTrue(dt.toInstant().getMillis() == resource.getTimeDetected().getTime()); } }
public void validate(Ec2Version oldVersion, Ec2Version newVersion) { Validate.noNullElements(new Object[] {oldVersion, newVersion}); Validate.isTrue(oldVersion.getAccountId().equals(newVersion.getAccountId())); Validate.isTrue(oldVersion.getRegion().equals(newVersion.getRegion())); Validate.isTrue(oldVersion.getResourceType().equals(newVersion.getResourceType())); }
public static Distributor among(Collection<? extends Capacity> capacities) { Validate.noNullElements(capacities); return new Distributor(capacities.toArray(new Capacity[0])); }