/** * @param executor the executor that should be used to create threads to run {@link Consumer}s; may not be null * @param adapter the adapter for consumers; may not be null */ protected RingBufferBuilder( Executor executor, ConsumerAdapter<T, C> adapter ) { CheckArg.isNotNull(executor, "executor"); CheckArg.isNotNull(adapter, "adapter"); this.executor = executor; this.adapter = adapter; }
/** * Create a new source with the given name and translator * * @param name the source name (cannot be <code>null</code> or empty) * @param translator the source translator (can be <code>null</code>) */ public Source(String name, String translator) { CheckArg.isNotEmpty( name, "name" ); CheckArg.isNotNull( translator, "translator" ); this.name = name; this.translator = translator; }
/** * Set the loading depth parameter, which controls how deep a subgraph should be read when a node is loaded from the * persistence store. By default, this value is 1. * * @param depth the depth that should be read whenever a single node is loaded * @throws IllegalArgumentException if the depth is not positive */ public void setDepthForLoadingNodes( int depth ) { CheckArg.isPositive(depth, "depth"); this.loadDepth = depth; }
public SingleProducerCursor( int bufferSize, WaitStrategy waitStrategy ) { CheckArg.isPositive(bufferSize, "cursor.getBufferSize()"); CheckArg.isPowerOfTwo(bufferSize, "cursor.getBufferSize()"); this.bufferSize = bufferSize; this.waitStrategy = waitStrategy; }
@Override public Limit limit( int rowLimit, int offset ) { CheckArg.isPositive(rowLimit, "rowLimit"); CheckArg.isNonNegative(offset, "offset"); return new Limit(rowLimit, offset); }
/** * @see org.modeshape.sequencer.teiid.model.ModelObjectHandler#process(org.modeshape.sequencer.teiid.xmi.XmiElement, * javax.jcr.Node) */ @Override protected void process( final XmiElement element, final Node parentNode ) throws Exception { CheckArg.isNotNull(element, "element"); CheckArg.isNotNull(parentNode, "node"); CheckArg.isEquals(element.getNamespaceUri(), "namespace URI", URI, "relational URI"); LOGGER.debug("==== TransformationModelObjectHandler:process:element={0}", element.getName()); if (ModelId.TRANSFORMATION_CONTAINER.equals(element.getName())) { // just process children for (final XmiElement kid : element.getChildren()) { if (ModelId.TRANSFORMATION_MAPPINGS.equals(kid.getName())) { processMappings(kid); } else { LOGGER.debug("**** transformation container child of '{0}' was not processed", kid.getName()); } } } else { LOGGER.debug("**** transformation type of '{0}' was not processed", element.getName()); } }
/** * @param path the path to the XMI file being read (cannot be <code>null</code> or empty) */ protected XmiReader( final String path ) { CheckArg.isNotEmpty(path, "path"); this.path = path; }
@Override public Path subpath( int beginIndex, int endIndex ) { CheckArg.isNonNegative(beginIndex, "beginIndex"); CheckArg.isNonNegative(endIndex, "endIndex"); if (endIndex >= 1) { EMPTY_SEGMENT_LIST.get(endIndex); // throws IndexOutOfBoundsException } return this; }
/** * Add a table with the supplied name and column names and types. The table will also overwrite any existing table * definition with the same name. * * @param name the name of the new table * @param columnNames the names of the columns * @param types the types for the columns * @return this builder, for convenience in method chaining; never null * @throws IllegalArgumentException if the table name is null or empty, any column name is null or empty, if no column * names are given, or if the number of types does not match the number of columns */ public Builder addTable( String name, String[] columnNames, String[] types ) { CheckArg.isNotEmpty(name, "name"); CheckArg.isNotEmpty(columnNames, "columnNames"); CheckArg.isNotEmpty(types, "types"); CheckArg.isEquals(columnNames.length, "columnNames.length", types.length, "types.length"); List<Column> columns = new ArrayList<Column>(); assert columnNames.length == types.length; for (int i = 0; i != columnNames.length; ++i) { String columnName = columnNames[i]; CheckArg.isNotEmpty(columnName, "columnName[" + i + "]"); columns.add(new ImmutableColumn(columnName, types[i])); } MutableTable table = new MutableTable(name, columns, false); tables.put(name, table); return this; }
@Override public Path createRelativePath( Name... segmentNames ) { if (segmentNames == null || segmentNames.length == 0) return BasicPath.EMPTY_RELATIVE; List<Segment> segments = new ArrayList<Segment>(segmentNames.length); for (Name segmentName : segmentNames) { if (segmentName == null) { CheckArg.containsNoNulls(segmentNames, "segment names"); } segments.add(new BasicPathSegment(segmentName)); } return new BasicPath(segments, false); }
/** * Create a new generator that uses the specified number of bits for the counter portion of the keys. * * @param bitsUsedInCounter the number of bits in the counter portion of the keys; must be a positive number for which theere * is enough space to left shift without overflowing. * @return the generator instance; never null */ public static TimeBasedKeys create( int bitsUsedInCounter ) { CheckArg.isPositive(bitsUsedInCounter, "bitsUsedInCounter"); int maxAvailableBitsToShift = Long.numberOfLeadingZeros(System.currentTimeMillis()); CheckArg.isLessThan(bitsUsedInCounter, maxAvailableBitsToShift, "bitsUsedInCounter"); return new TimeBasedKeys((short)bitsUsedInCounter); }
/** * Set the property on the node as read from the {@link RepositoryConnection} * * @param property the property that was read * @throws IllegalArgumentException if the property's name does not match the {@link #named() name of the property} that was * to be read * @throws IllegalStateException if the request is frozen */ public void setProperty( Property property ) { checkNotFrozen(); if (property != null) CheckArg.isEquals(property.getName(), "property's name", named(), "property name"); this.property = property; }
/** * @see org.teiid.modeshape.sequencer.vdb.model.ModelObjectHandler#process(org.teiid.modeshape.sequencer.vdb.xmi.XmiElement, * javax.jcr.Node) */ @Override protected void process( final XmiElement element, final Node parentNode ) throws Exception { CheckArg.isNotNull(element, "element"); CheckArg.isNotNull(parentNode, "node"); CheckArg.isEquals(element.getNamespaceUri(), "namespace URI", URI, "relational URI"); LOGGER.debug("==== TransformationModelObjectHandler:process:element={0}", element.getName()); if (ModelId.TRANSFORMATION_CONTAINER.equals(element.getName())) { // just process children for (final XmiElement kid : element.getChildren()) { if (ModelId.TRANSFORMATION_MAPPINGS.equals(kid.getName())) { processMappings(kid); } else { LOGGER.debug("**** transformation container child of '{0}' was not processed", kid.getName()); } } } else { LOGGER.debug("**** transformation type of '{0}' was not processed", element.getName()); } }
/** * @param name the VDB name (cannot be <code>null</code> or empty) */ public VdbManifest( final String name ) { CheckArg.isNotEmpty(name, "name"); this.name = name; }
@Override public void setMinimumBinarySizeInBytes( long minSizeInBytes ) { CheckArg.isNonNegative(minSizeInBytes, "minSizeInBytes"); minBinarySizeInBytes.set(minSizeInBytes); }
/** * Add a table with the supplied name and column names and types. The table will also overwrite any existing table * definition with the same name. * * @param name the name of the new table * @param columnNames the names of the columns * @param types the types for the columns * @return this builder, for convenience in method chaining; never null * @throws IllegalArgumentException if the table name is null or empty, any column name is null or empty, if no column * names are given, or if the number of types does not match the number of columns */ public Builder addTable( String name, String[] columnNames, String[] types ) { CheckArg.isNotEmpty(name, "name"); CheckArg.isNotEmpty(columnNames, "columnNames"); CheckArg.isNotEmpty(types, "types"); CheckArg.isEquals(columnNames.length, "columnNames.length", types.length, "types.length"); List<Column> columns = new ArrayList<Column>(); assert columnNames.length == types.length; for (int i = 0; i != columnNames.length; ++i) { String columnName = columnNames[i]; CheckArg.isNotEmpty(columnName, "columnName[" + i + "]"); columns.add(new ImmutableColumn(columnName, types[i])); } MutableTable table = new MutableTable(name, columns, false); tables.put(name, table); return this; }
public SingleProducerCursor( int bufferSize, WaitStrategy waitStrategy ) { CheckArg.isPositive(bufferSize, "cursor.getBufferSize()"); CheckArg.isPowerOfTwo(bufferSize, "cursor.getBufferSize()"); this.bufferSize = bufferSize; this.waitStrategy = waitStrategy; }
@Override public Limit limit( int rowLimit, int offset ) { CheckArg.isPositive(rowLimit, "rowLimit"); CheckArg.isNonNegative(offset, "offset"); return new Limit(rowLimit, offset); }
@Override public Path createRelativePath( Name... segmentNames ) { if (segmentNames == null || segmentNames.length == 0) return BasicPath.EMPTY_RELATIVE; List<Segment> segments = new ArrayList<Segment>(segmentNames.length); for (Name segmentName : segmentNames) { if (segmentName == null) { CheckArg.containsNoNulls(segmentNames, "segment names"); } segments.add(new BasicPathSegment(segmentName)); } return new BasicPath(segments, false); }
public DelegatingClassLoader( ClassLoader parent, Iterable<? extends ClassLoader> delegates ) { super(new URL[0], parent); CheckArg.isNotNull(delegates, "delegates"); this.delegates = delegates; }