idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
33,100 | public static String urlFrom ( String baseUrl , String ... pathSegments ) { StringBuilder urlBuilder = new StringBuilder ( baseUrl ) ; if ( urlBuilder . charAt ( urlBuilder . length ( ) - 1 ) == '/' ) { urlBuilder . deleteCharAt ( urlBuilder . length ( ) - 1 ) ; } for ( String pathSegment : pathSegments ) { if ( pathSe... | Creates an url using base url and appending optional segments . |
33,101 | public static Value jsonValueToJCRValue ( Object value , ValueFactory valueFactory ) { if ( value == null ) { return null ; } if ( value instanceof Integer || value instanceof Long ) { return valueFactory . createValue ( ( ( Number ) value ) . longValue ( ) ) ; } else if ( value instanceof Double || value instanceof Fl... | Converts an object value coming from a JSON object to a JCR value by attempting to convert it to a valid data type . |
33,102 | public static boolean isProperlyFormattedKey ( String hexadecimalStr ) { if ( hexadecimalStr == null ) return false ; final int length = hexadecimalStr . length ( ) ; if ( length != ALGORITHM . getHexadecimalStringLength ( ) ) return false ; return StringUtil . isHexString ( hexadecimalStr ) ; } | Determine if the supplied hexadecimal string is potentially a binary key by checking the format of the string . |
33,103 | Future < Boolean > shutdown ( ) { final ExecutorService executor = Executors . newSingleThreadExecutor ( new NamedThreadFactory ( "modeshape-repository-stop" ) ) ; try { return executor . submit ( ( ) -> doShutdown ( false ) ) ; } finally { executor . shutdown ( ) ; } } | Terminate all active sessions . |
33,104 | private String getParameter ( List < FileItem > items , String name ) { for ( FileItem i : items ) { if ( i . isFormField ( ) && i . getFieldName ( ) . equals ( name ) ) { return i . getString ( ) ; } } return null ; } | Extracts value of the parameter with given name . |
33,105 | private InputStream getStream ( List < FileItem > items ) throws IOException { for ( FileItem i : items ) { if ( ! i . isFormField ( ) && i . getFieldName ( ) . equals ( CONTENT_PARAMETER ) ) { return i . getInputStream ( ) ; } } return null ; } | Gets uploaded file as stream . |
33,106 | public static void isNotLessThan ( int argument , int notLessThanValue , String name ) { if ( argument < notLessThanValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeLessThan . text ( name , argument , notLessThanValue ) ) ; } } | Check that the argument is not less than the supplied value |
33,107 | public static void isNotGreaterThan ( int argument , int notGreaterThanValue , String name ) { if ( argument > notGreaterThanValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeGreaterThan . text ( name , argument , notGreaterThanValue ) ) ; } } | Check that the argument is not greater than the supplied value |
33,108 | public static void isGreaterThan ( int argument , int greaterThanValue , String name ) { if ( argument <= greaterThanValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeGreaterThan . text ( name , argument , greaterThanValue ) ) ; } } | Check that the argument is greater than the supplied value |
33,109 | public static void isLessThan ( int argument , int lessThanValue , String name ) { if ( argument >= lessThanValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeLessThan . text ( name , argument , lessThanValue ) ) ; } } | Check that the argument is less than the supplied value |
33,110 | public static void isGreaterThanOrEqualTo ( int argument , int greaterThanOrEqualToValue , String name ) { if ( argument < greaterThanOrEqualToValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeGreaterThanOrEqualTo . text ( name , argument , greaterThanOrEqualToValue ) ) ; } } | Check that the argument is greater than or equal to the supplied value |
33,111 | public static void isLessThanOrEqualTo ( int argument , int lessThanOrEqualToValue , String name ) { if ( argument > lessThanOrEqualToValue ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeLessThanOrEqualTo . text ( name , argument , lessThanOrEqualToValue ) ) ; } } | Check that the argument is less than or equal to the supplied value |
33,112 | public static void isPowerOfTwo ( int argument , String name ) { if ( Integer . bitCount ( argument ) != 1 ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBePowerOfTwo . text ( name , argument ) ) ; } } | Check that the argument is a power of 2 . |
33,113 | public static void isNotNan ( double argument , String name ) { if ( Double . isNaN ( argument ) ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeNumber . text ( name ) ) ; } } | Check that the argument is not NaN . |
33,114 | public static void isNotZeroLength ( String argument , String name ) { isNotNull ( argument , name ) ; if ( argument . length ( ) <= 0 ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeNullOrZeroLength . text ( name ) ) ; } } | Check that the string is non - null and has length > 0 |
33,115 | public static void isNotEmpty ( String argument , String name ) { isNotZeroLength ( argument , name ) ; if ( argument != null && argument . trim ( ) . length ( ) == 0 ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeNullOrZeroLengthOrEmpty . text ( name ) ) ; } } | Check that the string is not empty is not null and does not contain only whitespace . |
33,116 | public static void isNotNull ( Object argument , String name ) { if ( argument == null ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeNull . text ( name ) ) ; } } | Check that the specified argument is non - null |
33,117 | public static void isNull ( Object argument , String name ) { if ( argument != null ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeNull . text ( name ) ) ; } } | Check that the argument is null |
33,118 | public static void isInstanceOf ( Object argument , Class < ? > expectedClass , String name ) { isNotNull ( argument , name ) ; if ( ! expectedClass . isInstance ( argument ) ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeInstanceOf . text ( name , argument . getClass ( ) , expectedClass . getName ... | Check that the object is an instance of the specified Class |
33,119 | public static < C > C getInstanceOf ( Object argument , Class < C > expectedClass , String name ) { isInstanceOf ( argument , expectedClass , name ) ; return expectedClass . cast ( argument ) ; } | due to cast in return |
33,120 | public static void isNotEmpty ( Iterator < ? > argument , String name ) { isNotNull ( argument , name ) ; if ( ! argument . hasNext ( ) ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeEmpty . text ( name ) ) ; } } | Checks that the iterator is not empty and throws an exception if it is . |
33,121 | public static void isNotEmpty ( Collection < ? > argument , String name ) { isNotNull ( argument , name ) ; if ( argument . isEmpty ( ) ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeEmpty . text ( name ) ) ; } } | Check that the collection is not empty |
33,122 | public static void isEmpty ( Object [ ] argument , String name ) { isNotNull ( argument , name ) ; if ( argument . length > 0 ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeEmpty . text ( name ) ) ; } } | Check that the array is empty |
33,123 | public static void isNotEmpty ( Object [ ] argument , String name ) { isNotNull ( argument , name ) ; if ( argument . length == 0 ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotBeEmpty . text ( name ) ) ; } } | Check that the array is not empty |
33,124 | public static void contains ( Collection < ? > argument , Object value , String name ) { isNotNull ( argument , name ) ; if ( ! argument . contains ( value ) ) { throw new IllegalArgumentException ( CommonI18n . argumentDidNotContainObject . text ( name , getObjectName ( value ) ) ) ; } } | Check that the collection contains the value |
33,125 | public static void containsKey ( Map < ? , ? > argument , Object key , String name ) { isNotNull ( argument , name ) ; if ( ! argument . containsKey ( key ) ) { throw new IllegalArgumentException ( CommonI18n . argumentDidNotContainKey . text ( name , getObjectName ( key ) ) ) ; } } | Check that the map contains the key |
33,126 | public static void containsNoNulls ( Iterable < ? > argument , String name ) { isNotNull ( argument , name ) ; int i = 0 ; for ( Object object : argument ) { if ( object == null ) { throw new IllegalArgumentException ( CommonI18n . argumentMayNotContainNullValue . text ( name , i ) ) ; } ++ i ; } } | Check that the collection is not null and contains no nulls |
33,127 | public static void hasSizeOfAtLeast ( Collection < ? > argument , int minimumSize , String name ) { isNotNull ( argument , name ) ; if ( argument . size ( ) < minimumSize ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeOfMinimumSize . text ( name , Collection . class . getSimpleName ( ) , argument .... | Check that the collection contains at least the supplied number of elements |
33,128 | public static void hasSizeOfAtMost ( Collection < ? > argument , int maximumSize , String name ) { isNotNull ( argument , name ) ; if ( argument . size ( ) > maximumSize ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeOfMinimumSize . text ( name , Collection . class . getSimpleName ( ) , argument . ... | Check that the collection contains no more than the supplied number of elements |
33,129 | public static void hasSizeOfAtLeast ( Object [ ] argument , int minimumSize , String name ) { isNotNull ( argument , name ) ; if ( argument . length < minimumSize ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeOfMinimumSize . text ( name , Object [ ] . class . getSimpleName ( ) , argument . length ... | Check that the array contains at least the supplied number of elements |
33,130 | public static void hasSizeOfAtMost ( Object [ ] argument , int maximumSize , String name ) { isNotNull ( argument , name ) ; if ( argument . length > maximumSize ) { throw new IllegalArgumentException ( CommonI18n . argumentMustBeOfMinimumSize . text ( name , Object [ ] . class . getSimpleName ( ) , argument . length ,... | Check that the array contains no more than the supplied number of elements |
33,131 | public static String jodaFormat ( ZonedDateTime dateTime ) { CheckArg . isNotNull ( dateTime , "dateTime" ) ; return dateTime . format ( JODA_ISO8601_FORMATTER ) ; } | Returns the ISO8601 string of a given date - time instance with timezone information trying to be as closed as possible to what the JODA date - time library would return . |
33,132 | protected final < T > T processStream ( Binary binary , BinaryOperation < T > operation ) throws Exception { InputStream stream = binary . getStream ( ) ; if ( stream == null ) { throw new IllegalArgumentException ( "The binary value is empty" ) ; } try { return operation . execute ( stream ) ; } finally { stream . clo... | Allows subclasses to process the stream of binary value property in safe fashion making sure the stream is closed at the end of the operation . |
33,133 | public void addLanguage ( QueryParser languageParser ) { CheckArg . isNotNull ( languageParser , "languageParser" ) ; this . parsers . put ( languageParser . getLanguage ( ) . trim ( ) . toLowerCase ( ) , languageParser ) ; } | Add a language to this engine by supplying its parser . |
33,134 | public Set < String > getLanguages ( ) { Set < String > result = new HashSet < String > ( ) ; for ( QueryParser parser : parsers . values ( ) ) { result . add ( parser . getLanguage ( ) ) ; } return Collections . unmodifiableSet ( result ) ; } | Get the set of languages that this engine is capable of parsing . |
33,135 | public QueryParser getParserFor ( String language ) { CheckArg . isNotNull ( language , "language" ) ; return parsers . get ( language . trim ( ) . toLowerCase ( ) ) ; } | Get the parser for the supplied language . |
33,136 | public static Builder createBuilder ( ExecutionContext context , NodeTypes nodeTypes ) { CheckArg . isNotNull ( context , "context" ) ; CheckArg . isNotNull ( nodeTypes , "nodeTypes" ) ; return new Builder ( context , nodeTypes ) ; } | Obtain a new instance for building Schemata objects . |
33,137 | public void show ( JcrNode node ) { this . node = node ; if ( node . getAcl ( ) == null ) { this . displayDisabledEditor ( ) ; } else if ( this . isAclDefined ( node ) ) { this . selectFirstPrincipalAndDisplayPermissions ( node ) ; } else { this . displayEveryonePermissions ( ) ; } } | Displays permissions for the given node . |
33,138 | protected AstNode parseMaterializedViewStatement ( DdlTokenStream tokens , AstNode parentNode ) throws ParsingException { assert tokens != null ; assert parentNode != null ; markStartOfStatement ( tokens ) ; boolean isLog = tokens . canConsume ( STMT_CREATE_MATERIALIZED_VEIW_LOG ) ; tokens . canConsume ( STMT_CREATE_MA... | Parses DDL CREATE MATERIALIZED VIEW statement This could either be a standard view or a VIEW LOG ON statement . |
33,139 | private String parseContentBetweenParens ( final DdlTokenStream tokens ) throws ParsingException { tokens . consume ( L_PAREN ) ; int numLeft = 1 ; int numRight = 0 ; final StringBuilder text = new StringBuilder ( ) ; while ( tokens . hasNext ( ) ) { if ( tokens . matches ( L_PAREN ) ) { ++ numLeft ; } else if ( tokens... | The tokens must start with a left paren end with a right paren and have content between . Any parens in the content must have matching parens . |
33,140 | protected boolean isColumnDefinitionStart ( DdlTokenStream tokens , String columnMixinType ) throws ParsingException { boolean result = isColumnDefinitionStart ( tokens ) ; if ( ! result && TYPE_ALTER_COLUMN_DEFINITION . equals ( columnMixinType ) ) { for ( String start : INLINE_COLUMN_PROPERTY_START ) { if ( tokens . ... | Utility method to additionally check if MODIFY definition without datatype |
33,141 | public static ExtractFromRow extractPath ( final int indexInRow , final NodeCache cache , TypeSystem types ) { final TypeFactory < Path > type = types . getPathFactory ( ) ; final boolean trace = NodeSequence . LOGGER . isTraceEnabled ( ) ; return new ExtractFromRow ( ) { public TypeFactory < Path > getType ( ) { retur... | Create an extractor that extracts the path from the node at the given position in the row . |
33,142 | public static ExtractFromRow extractParentPath ( final int indexInRow , final NodeCache cache , TypeSystem types ) { final TypeFactory < Path > type = types . getPathFactory ( ) ; final boolean trace = NodeSequence . LOGGER . isTraceEnabled ( ) ; return new ExtractFromRow ( ) { public TypeFactory < Path > getType ( ) {... | Create an extractor that extracts the parent path from the node at the given position in the row . |
33,143 | public static ExtractFromRow extractRelativePath ( final int indexInRow , final Path relativePath , final NodeCache cache , TypeSystem types ) { CheckArg . isNotNull ( relativePath , "relativePath" ) ; final TypeFactory < Path > type = types . getPathFactory ( ) ; final boolean trace = NodeSequence . LOGGER . isTraceEn... | Create an extractor that extracts the path from the node at the given position in the row and applies the relative path . |
33,144 | public static ExtractFromRow extractPropertyValue ( final Name propertyName , final int indexInRow , final NodeCache cache , final TypeFactory < ? > desiredType ) { return new ExtractFromRow ( ) { public Object getValueInRow ( RowAccessor row ) { CachedNode node = row . getNode ( indexInRow ) ; if ( node == null ) retu... | Create an extractor that extracts the property value from the node at the given position in the row . |
33,145 | protected final boolean reindex ( String workspaceName , NodeKey key , Path path , Name primaryType , Set < Name > mixinTypes , Properties properties , boolean queryable ) { if ( predicate . matchesType ( primaryType , mixinTypes ) ) { reindexNode ( workspaceName , key , path , primaryType , mixinTypes , properties , q... | Reindex the specific node . |
33,146 | protected NodeCacheIterator nodes ( String workspaceName , Path path ) { NodeFilter nodeFilterForWorkspace = nodeFilterForWorkspace ( workspaceName ) ; if ( nodeFilterForWorkspace == null ) return null ; NodeFilter compositeFilter = new CompositeNodeFilter ( nodeFilterForWorkspace , sharedNodesFilter ( ) ) ; NodeCache ... | Return an iterator over all nodes at or below the specified path in the named workspace using the supplied filter . |
33,147 | public RestNode addCustomProperty ( String name , String value ) { customProperties . put ( name , value ) ; return this ; } | Adds a custom property to this node meaning a property which is not among the standard JCR properties |
33,148 | protected final void checkForCheckedOut ( ) throws VersionException , RepositoryException { if ( ! node . isCheckedOut ( ) ) { JcrPropertyDefinition defn = getDefinition ( ) ; if ( defn . getOnParentVersion ( ) != OnParentVersionAction . IGNORE ) { String path = getParent ( ) . getPath ( ) ; throw new VersionException ... | Verifies that this node is either not versionable or that it is versionable but checked out . |
33,149 | protected final CachedNode node ( ) throws ItemNotFoundException , InvalidItemStateException { CachedNode node = sessionCache ( ) . getNode ( key ) ; if ( node == null ) { if ( sessionCache ( ) . isDestroyed ( key ) ) { throw new InvalidItemStateException ( "The node with key " + key + " has been removed in this sessio... | Get the cached node . |
33,150 | final JcrPropertyDefinition propertyDefinitionFor ( org . modeshape . jcr . value . Property property , Name primaryType , Set < Name > mixinTypes , NodeTypes nodeTypes ) throws ConstraintViolationException { boolean single = property . isSingle ( ) ; boolean skipProtected = false ; JcrPropertyDefinition defn = findBes... | Find the property definition for the property given this node s primary type and mixin types . |
33,151 | final JcrPropertyDefinition findBestPropertyDefinition ( Name primaryTypeNameOfParent , Collection < Name > mixinTypeNamesOfParent , org . modeshape . jcr . value . Property property , boolean isSingle , boolean skipProtected , boolean skipConstraints , NodeTypes nodeTypes ) { JcrPropertyDefinition definition = null ; ... | Find the best property definition in this node s primary type and mixin types . |
33,152 | protected final AbstractJcrNode childNode ( Name name , Type expectedType ) throws PathNotFoundException , ItemNotFoundException , InvalidItemStateException { ChildReference ref = node ( ) . getChildReferences ( sessionCache ( ) ) . getChild ( name ) ; if ( ref == null ) { String msg = JcrI18n . childNotFoundUnderNode ... | Get the JCR node for the named child . |
33,153 | protected LinkedList < Property > autoCreatePropertiesFor ( Name nodeName , Name primaryType , PropertyFactory propertyFactory , NodeTypes capabilities ) { Collection < JcrPropertyDefinition > autoPropDefns = capabilities . getAutoCreatedPropertyDefinitions ( primaryType ) ; if ( autoPropDefns . isEmpty ( ) ) { return ... | If there are any auto - created properties create them and return them in a list . |
33,154 | protected void autoCreateChildren ( Name primaryType , NodeTypes capabilities ) throws ItemExistsException , PathNotFoundException , VersionException , ConstraintViolationException , LockException , RepositoryException { Collection < JcrNodeDefinition > autoChildDefns = capabilities . getAutoCreatedChildNodeDefinitions... | Create in this node any auto - created child nodes . |
33,155 | final AbstractJcrProperty removeExistingProperty ( Name name ) throws VersionException , LockException , RepositoryException { AbstractJcrProperty existing = getProperty ( name ) ; if ( existing != null ) { existing . remove ( ) ; return existing ; } return null ; } | Removes an existing property with the supplied name . Note that if a property with the given name does not exist then this method returns null and does not throw an exception . |
33,156 | final AbstractJcrProperty setProperty ( Name name , Value [ ] values , int jcrPropertyType , boolean skipReferenceValidation ) throws VersionException , LockException , ConstraintViolationException , RepositoryException { return setProperty ( name , values , jcrPropertyType , false , skipReferenceValidation , false , f... | Sets a multi valued property skipping over protected ones . |
33,157 | protected final NodeIterator referringNodes ( ReferenceType referenceType ) throws RepositoryException { if ( ! this . isReferenceable ( ) ) { return JcrEmptyNodeIterator . INSTANCE ; } Set < NodeKey > keys = node ( ) . getReferrers ( sessionCache ( ) , referenceType ) ; if ( keys . isEmpty ( ) ) return JcrEmptyNodeIte... | Obtain an iterator over the nodes that reference this node . |
33,158 | protected boolean containsChangesWithExternalDependencies ( AtomicReference < Set < NodeKey > > affectedNodeKeys ) throws RepositoryException { Set < NodeKey > allChanges = sessionCache ( ) . getChangedNodeKeys ( ) ; Set < NodeKey > changesAtOrBelowThis = sessionCache ( ) . getChangedNodeKeysAtOrBelow ( this . node ( )... | Determines whether this node or any nodes below it contain changes that depend on nodes that are outside of this node s hierarchy . |
33,159 | private void removeReferrerChanges ( Set < NodeKey > allChanges , Set < NodeKey > changesAtOrBelowThis ) throws RepositoryException { for ( Iterator < NodeKey > allChangesIt = allChanges . iterator ( ) ; allChangesIt . hasNext ( ) ; ) { NodeKey changedNodeKey = allChangesIt . next ( ) ; if ( changesAtOrBelowThis . cont... | Removes all the keys from the first set which represent referrer node keys to any of the nodes in the second set . |
33,160 | public char [ ] getPassword ( ) { String result = properties . getProperty ( LocalJcrDriver . PASSWORD_PROPERTY_NAME ) ; return result != null ? result . toCharArray ( ) : null ; } | Get the JCR password . This is not required . |
33,161 | public boolean isTeiidSupport ( ) { String result = properties . getProperty ( LocalJcrDriver . TEIID_SUPPORT_PROPERTY_NAME ) ; if ( result == null ) { return false ; } return result . equalsIgnoreCase ( Boolean . TRUE . toString ( ) ) ; } | Return true of Teiid support is required for this connection . |
33,162 | public Credentials getCredentials ( ) { String username = getUsername ( ) ; char [ ] password = getPassword ( ) ; if ( username != null ) { return new SimpleCredentials ( username , password ) ; } return null ; } | Return the credentials based on the user name and password . |
33,163 | public static byte [ ] getHash ( String digestName , InputStream stream ) throws NoSuchAlgorithmException , IOException { CheckArg . isNotNull ( stream , "stream" ) ; MessageDigest digest = MessageDigest . getInstance ( digestName ) ; assert digest != null ; int bufSize = 1024 ; byte [ ] buffer = new byte [ bufSize ] ;... | Get the hash of the supplied content using the digest identified by the supplied name . Note that this method never closes the supplied stream . |
33,164 | public static String sha1 ( String string ) { try { byte [ ] sha1 = SecureHash . getHash ( SecureHash . Algorithm . SHA_1 , string . getBytes ( ) ) ; return SecureHash . asHexString ( sha1 ) ; } catch ( NoSuchAlgorithmException e ) { throw new SystemFailureException ( e ) ; } } | Computes the sha1 value for the given string . |
33,165 | public RepositoryDelegate createRepositoryDelegate ( String url , Properties info , JcrContextFactory contextFactory ) throws SQLException { if ( ! acceptUrl ( url ) ) { throw new SQLException ( JdbcLocalI18n . invalidUrlPrefix . text ( LocalJcrDriver . JNDI_URL_PREFIX ) ) ; } return create ( determineProtocol ( url ) ... | Create a RepositoryDelegate instance given the connection information . |
33,166 | public static Set < SelectorName > nameSetFrom ( Set < SelectorName > firstSet , Set < SelectorName > secondSet ) { if ( ( firstSet == null || firstSet . isEmpty ( ) ) && ( secondSet == null || secondSet . isEmpty ( ) ) ) { return Collections . emptySet ( ) ; } Set < SelectorName > result = new LinkedHashSet < Selector... | Create a set that contains the SelectName objects in the supplied sets . |
33,167 | public void setSplitPattern ( String regularExpression ) throws PatternSyntaxException { CheckArg . isNotNull ( regularExpression , "regularExpression" ) ; Pattern . compile ( splitPattern ) ; splitPattern = regularExpression ; } | Sets the regular expression to use to split incoming rows . |
33,168 | public Document read ( ) { try { do { if ( stream == null ) { stream = openNextFile ( ) ; if ( stream == null ) { return null ; } documents = Json . readMultiple ( stream , false ) ; } try { Document doc = documents . nextDocument ( ) ; if ( doc != null ) return doc ; } catch ( IOException e ) { } close ( stream ) ; st... | Read the next document from the files . |
33,169 | public Duration add ( long duration , TimeUnit unit ) { long durationInNanos = TimeUnit . NANOSECONDS . convert ( duration , unit ) ; return new Duration ( this . durationInNanos + durationInNanos ) ; } | Add the supplied duration to this duration and return the result . |
33,170 | public Duration subtract ( long duration , TimeUnit unit ) { long durationInNanos = TimeUnit . NANOSECONDS . convert ( duration , unit ) ; return new Duration ( this . durationInNanos - durationInNanos ) ; } | Subtract the supplied duration from this duration and return the result . |
33,171 | public Duration add ( Duration duration ) { return new Duration ( this . durationInNanos + ( duration == null ? 0l : duration . longValue ( ) ) ) ; } | Add the supplied duration to this duration and return the result . A null value is treated as a duration of 0 nanoseconds . |
33,172 | public Duration subtract ( Duration duration ) { return new Duration ( this . durationInNanos - ( duration == null ? 0l : duration . longValue ( ) ) ) ; } | Subtract the supplied duration from this duration and return the result . A null value is treated as a duration of 0 nanoseconds . |
33,173 | public Components getComponents ( ) { if ( this . components == null ) { BigDecimal bigSeconds = new BigDecimal ( this . durationInNanos ) . divide ( new BigDecimal ( 1000000000 ) ) ; int minutes = bigSeconds . intValue ( ) / 60 ; double dMinutes = minutes ; double seconds = bigSeconds . doubleValue ( ) - dMinutes * 60... | Return the duration components . |
33,174 | public long getDuration ( TimeUnit unit ) { if ( unit == null ) throw new IllegalArgumentException ( ) ; return unit . convert ( durationInNanos , TimeUnit . NANOSECONDS ) ; } | Get the duration value in the supplied unit of time . |
33,175 | public void changed ( ChangeSet changes ) { checkNotClosed ( ) ; if ( LOGGER . isTraceEnabled ( ) ) { LOGGER . trace ( "Cache for workspace '{0}' received {1} changes from local sessions: {2}" , workspaceName , changes . size ( ) , changes ) ; } for ( NodeKey key : changes . changedNodes ( ) ) { if ( closed ) break ; n... | Signal that changes have been made to the persisted data . Related information in the cache is cleared and this workspace s listener is notified of the changes . |
33,176 | private static synchronized JcrRepository getRepository ( String configFileName , String repositoryName , final Context nameCtx , final Name jndiName ) throws IOException , RepositoryException , NamingException { if ( ! StringUtil . isBlank ( repositoryName ) ) { ENGINE . start ( ) ; try { JcrRepository repository = EN... | Get or initialize the JCR Repository instance as described by the supplied configuration file and repository name . |
33,177 | public static TimeBasedKeys create ( int bitsUsedInCounter ) { CheckArg . isPositive ( bitsUsedInCounter , "bitsUsedInCounter" ) ; int maxAvailableBitsToShift = Long . numberOfLeadingZeros ( System . currentTimeMillis ( ) ) ; CheckArg . isLessThan ( bitsUsedInCounter , maxAvailableBitsToShift , "bitsUsedInCounter" ) ; ... | Create a new generator that uses the specified number of bits for the counter portion of the keys . |
33,178 | public long nextKey ( ) { final long timestamp = System . currentTimeMillis ( ) ; final int increment = counterFor ( timestamp ) ; if ( increment <= maximumCounterValue ) { return ( timestamp << counterBits ) + increment ; } return this . nextKey ( ) ; } | Get the next key for the current time in UTC . |
33,179 | protected void nullReference ( List < Comparison > comparisons , Comparison comparisonToNull ) { if ( comparisonToNull != null ) { for ( int i = 0 ; i != comparisons . size ( ) ; ++ i ) { if ( comparisons . get ( i ) == comparisonToNull ) comparisons . set ( i , null ) ; } } } | Find all occurrences of the comparison object in the supplied list and null the list s reference to it . |
33,180 | protected void nullReference ( List < Comparison > comparisons , Iterable < Comparison > comparisonsToNull ) { for ( Comparison comparisonToNull : comparisonsToNull ) { nullReference ( comparisons , comparisonToNull ) ; } } | Find all references in the supplied list that match those supplied and set them to null . |
33,181 | protected int compareStaticOperands ( QueryContext context , Comparison comparison1 , Comparison comparison2 ) { Object value1 = getValue ( context , comparison1 . getOperand2 ( ) ) ; Object value2 = getValue ( context , comparison2 . getOperand2 ( ) ) ; return ValueComparators . OBJECT_COMPARATOR . compare ( value1 , ... | Compare the values used in the two comparisons |
33,182 | private String getContentType ( List < FileItem > items ) { for ( FileItem i : items ) { if ( ! i . isFormField ( ) && i . getFieldName ( ) . equals ( CONTENT_PARAMETER ) ) { return i . getContentType ( ) ; } } return null ; } | Determines content - type of the uploaded file . |
33,183 | protected long claimUpTo ( int number ) { assert number > 0 ; long nextPosition = this . nextPosition ; long maxPosition = nextPosition + number ; long wrapPoint = maxPosition - bufferSize ; long cachedSlowestConsumerPosition = this . slowestConsumerPosition ; if ( wrapPoint > cachedSlowestConsumerPosition || cachedSlo... | Claim up to the supplied number of positions . |
33,184 | private List < String > getRootfiles ( ZipInputStream zipStream ) throws Exception { List < String > rootfiles = new ArrayList < > ( ) ; ZipEntry entry = null ; while ( ( entry = zipStream . getNextEntry ( ) ) != null ) { String entryName = entry . getName ( ) ; if ( entryName . endsWith ( "META-INF/container.xml" ) ) ... | Parse the container file to get the list of all rootfile packages . |
33,185 | private ByteArrayOutputStream getZipEntryContent ( ZipInputStream zipStream , ZipEntry entry ) throws IOException { try ( ByteArrayOutputStream content = new ByteArrayOutputStream ( ) ) { byte [ ] bytes = new byte [ ( int ) entry . getSize ( ) ] ; int read ; while ( ( read = zipStream . read ( bytes , 0 , bytes . lengt... | Read the content of the ZipEntry without closing the stream . |
33,186 | protected void incrementBinaryReferenceCount ( BinaryKey binaryKey , Set < BinaryKey > unusedBinaryKeys , Set < BinaryKey > usedBinaryKeys ) { String sha1 = binaryKey . toString ( ) ; String key = keyForBinaryReferenceDocument ( sha1 ) ; EditableDocument entry = documentStore . edit ( key , false ) ; if ( entry == null... | Increment the reference count for the stored binary value with the supplied SHA - 1 hash . |
33,187 | protected void decrementBinaryReferenceCount ( Object fieldValue , Set < BinaryKey > unusedBinaryKeys , Set < BinaryKey > usedBinaryKeys ) { if ( fieldValue instanceof List < ? > ) { for ( Object value : ( List < ? > ) fieldValue ) { decrementBinaryReferenceCount ( value , unusedBinaryKeys , usedBinaryKeys ) ; } } else... | Decrement the reference count for the binary value . |
33,188 | protected boolean isLocked ( EditableDocument doc ) { return hasProperty ( doc , JcrLexicon . LOCK_OWNER ) || hasProperty ( doc , JcrLexicon . LOCK_IS_DEEP ) ; } | Checks if the given document is already locked |
33,189 | public static InputStream read ( String path , ClassLoader classLoader , boolean useTLCL ) { if ( useTLCL ) { InputStream stream = Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( path ) ; if ( stream != null ) { return stream ; } } return classLoader != null ? classLoader . getResourceAsS... | Returns the stream of a resource at a given path using some optional class loaders . |
33,190 | public static InputStream read ( String path , Class < ? > clazz , boolean useTLCL ) { return read ( path , clazz . getClassLoader ( ) , useTLCL ) ; } | Returns the stream of a resource at a given path using the CL of a class . |
33,191 | private void setS3ObjectTag ( String objectKey , String tagKey , String tagValue ) throws BinaryStoreException { try { GetObjectTaggingRequest getTaggingRequest = new GetObjectTaggingRequest ( bucketName , objectKey ) ; GetObjectTaggingResult getTaggingResult = s3Client . getObjectTagging ( getTaggingRequest ) ; List <... | Sets a tag on a S3 object potentially overwriting the existing value . |
33,192 | private List < Tag > mergeS3TagSet ( List < Tag > initialTags , Tag changeTag ) { Map < String , String > mergedTags = initialTags . stream ( ) . collect ( Collectors . toMap ( Tag :: getKey , Tag :: getValue ) ) ; mergedTags . put ( changeTag . getKey ( ) , changeTag . getValue ( ) ) ; return mergedTags . entrySet ( )... | Merges a new tag into an existing list of tags . It will be either appended to the list or overwrite the value of an existing tag with the same key . |
33,193 | protected long parseLong ( DdlTokenStream tokens , DataType dataType ) { String value = consume ( tokens , dataType , false ) ; return parseLong ( value ) ; } | Returns a long value from the input token stream assuming the long is not bracketed with parenthesis . |
33,194 | protected long parseBracketedLong ( DdlTokenStream tokens , DataType dataType ) { consume ( tokens , dataType , false , L_PAREN ) ; String value = consume ( tokens , dataType , false ) ; consume ( tokens , dataType , false , R_PAREN ) ; return parseLong ( value ) ; } | Returns a long value from the input token stream assuming the long is bracketed with parenthesis . |
33,195 | public static final SequencerPathExpression compile ( String expression ) throws InvalidSequencerPathExpression { CheckArg . isNotNull ( expression , "sequencer path expression" ) ; expression = expression . trim ( ) ; if ( expression . length ( ) == 0 ) { throw new InvalidSequencerPathExpression ( RepositoryI18n . pat... | Compile the supplied expression and return the resulting SequencerPathExpression instance . |
33,196 | public Matcher matcher ( String absolutePath ) { PathExpression . Matcher inputMatcher = selectExpression . matcher ( absolutePath ) ; String outputPath = null ; WorkspacePath wsPath = null ; if ( inputMatcher . matches ( ) ) { Map < Integer , String > replacements = new HashMap < Integer , String > ( ) ; for ( int i =... | Obtain a Matcher that can be used to convert the supplied workspace key and absolute path into an output workspace name and and output path . |
33,197 | public static EditableDocument newDocument ( Document original ) { BasicDocument newDoc = new BasicDocument ( ) ; newDoc . putAll ( original ) ; return new DocumentEditor ( newDoc , DEFAULT_FACTORY ) ; } | Create a new editable document that is a copy of the supplied document . |
33,198 | public static EditableDocument newDocument ( String name , Object value ) { return new DocumentEditor ( new BasicDocument ( name , value ) , DEFAULT_FACTORY ) ; } | Create a new editable document initialized with a single field that can be used as a new document entry in a SchematicDb or as nested documents for other documents . |
33,199 | public static EditableDocument newDocument ( String name1 , Object value1 , String name2 , Object value2 ) { return new DocumentEditor ( new BasicDocument ( name1 , value1 , name2 , value2 ) , DEFAULT_FACTORY ) ; } | Create a new editable document initialized with two fields that can be used as a new document entry in a SchematicDb or as nested documents for other documents . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.