idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
32,900
public void setStrategy ( T minimum , T maximum ) { this . bucketingStrategy = new ExplicitBucketingStrategy ( minimum , maximum ) ; this . bucketWidth = null ; }
Set the histogram to use the supplied minimum and maximum values to determine the bucket size .
32,901
public Histogram < T > setSignificantFigures ( int significantFigures ) { if ( significantFigures != this . significantFigures ) { this . significantFigures = significantFigures ; this . bucketWidth = null ; this . buckets . clear ( ) ; } return this ; }
Set the number of significant figures used in the calculation of the bucket widths .
32,902
public Histogram < T > setBucketCount ( int count ) { if ( count != this . bucketCount ) { this . bucketCount = count ; this . bucketWidth = null ; this . buckets . clear ( ) ; } return this ; }
Set the number of buckets that this histogram will use .
32,903
public synchronized void start ( BootstrapContext ctx ) throws ResourceAdapterInternalException { if ( engine == null ) { engine = new ModeShapeEngine ( ) ; engine . start ( ) ; } }
This is called when a resource adapter instance is bootstrapped .
32,904
public synchronized void stop ( ) { if ( engine != null ) { Future < Boolean > shutdown = engine . shutdown ( ) ; final int SHUTDOWN_TIMEOUT = 30 ; try { LOGGER . debug ( "Shutting down engine to stop resource adapter" ) ; if ( ! shutdown . get ( SHUTDOWN_TIMEOUT , TimeUnit . SECONDS ) ) { LOGGER . error ( JcaI18n . un...
This is called when a resource adapter instance is undeployed or during application server shutdown .
32,905
public Serializer < ? > serializerFor ( TypeFactory < ? > type ) { if ( type instanceof TupleFactory ) { return ( ( TupleFactory < ? > ) type ) . getSerializer ( this ) ; } return serializers . serializerFor ( type . getType ( ) ) ; }
Obtain a serializer for the given value type .
32,906
public BTreeKeySerializer < ? > bTreeKeySerializerFor ( TypeFactory < ? > type , boolean pack ) { return serializers . bTreeKeySerializerFor ( type . getType ( ) , type . getComparator ( ) , pack ) ; }
Obtain a serializer for the given key type .
32,907
JcrNodeDefinition getNodeDefinition ( NodeDefinitionId definitionId ) { if ( definitionId == null ) return null ; return nodeTypes ( ) . getChildNodeDefinition ( definitionId ) ; }
Get the node definition given the supplied identifier .
32,908
JcrPropertyDefinition getPropertyDefinition ( PropertyDefinitionId definitionId ) { if ( definitionId == null ) return null ; return nodeTypes ( ) . getPropertyDefinition ( definitionId ) ; }
Get the property definition given the supplied identifier .
32,909
public boolean isDerivedFrom ( String [ ] testTypeNames , String primaryTypeName , String [ ] mixinNames ) throws RepositoryException { CheckArg . isNotEmpty ( testTypeNames , "testTypeNames" ) ; CheckArg . isNotEmpty ( primaryTypeName , "primaryTypeName" ) ; NameFactory nameFactory = context ( ) . getValueFactories ( ...
Determine if any of the test type names are equal to or have been derived from the primary type or any of the mixins .
32,910
public static int valueFromName ( String name ) { if ( name . equals ( TYPENAME_SIMPLE_REFERENCE ) ) { return SIMPLE_REFERENCE ; } return javax . jcr . PropertyType . valueFromName ( name ) ; }
Returns the numeric constant value of the type with the specified name .
32,911
protected CachedNode nodeInWorkspace ( AbstractSessionCache session ) { return isNew ( ) ? null : session . getWorkspace ( ) . getNode ( key ) ; }
Get the CachedNode within the workspace cache .
32,912
protected final Segment getSegment ( NodeCache cache , CachedNode parent ) { if ( parent != null ) { ChildReference ref = parent . getChildReferences ( cache ) . getChild ( key ) ; if ( ref == null ) { throw new NodeNotFoundInParentException ( key , parent . getKey ( ) ) ; } return ref . getSegment ( ) ; } return works...
Get the segment for this node .
32,913
private void emitValue ( Value value , ContentHandler contentHandler , int propertyType , boolean skipBinary ) throws RepositoryException , SAXException { if ( PropertyType . BINARY == propertyType ) { startElement ( contentHandler , JcrSvLexicon . VALUE , null ) ; if ( ! skipBinary ) { byte [ ] bytes = new byte [ BASE...
Fires the appropriate SAX events on the content handler to build the XML elements for the value .
32,914
private Node nodeFor ( ITransaction transaction , ResolvedRequest request ) throws RepositoryException { return ( ( JcrSessionTransaction ) transaction ) . nodeFor ( request ) ; }
Get the node that corresponds to the resolved request using the supplied active transaction .
32,915
private String [ ] childrenFor ( ITransaction transaction , ResolvedRequest request ) throws RepositoryException { return ( ( JcrSessionTransaction ) transaction ) . childrenFor ( request ) ; }
Determine the names of the children given the supplied request
32,916
public RestQueryResult addColumn ( String name , String type ) { if ( ! StringUtil . isBlank ( name ) ) { columns . put ( name , type ) ; } return this ; }
Adds a new column to this result .
32,917
static < T > LocalDuplicateIndex < T > create ( String name , String workspaceName , DB db , Converter < T > converter , Serializer < T > valueSerializer , Comparator < T > comparator ) { return new LocalDuplicateIndex < > ( name , workspaceName , db , converter , valueSerializer , comparator ) ; }
Create a new index that allows duplicate values across all keys .
32,918
public String currentTransactionId ( ) { try { javax . transaction . Transaction txn = txnMgr . getTransaction ( ) ; return txn != null ? txn . toString ( ) : null ; } catch ( SystemException e ) { return null ; } }
Get a string representation of the current transaction if there already is an existing transaction .
32,919
public Transaction begin ( ) throws NotSupportedException , SystemException , RollbackException { NestableThreadLocalTransaction localTx = LOCAL_TRANSACTION . get ( ) ; if ( localTx != null ) { if ( logger . isTraceEnabled ( ) ) { logger . trace ( "Found active ModeShape transaction '{0}' " , localTx ) ; } return local...
Starts a new transaction if one does not already exist and associate it with the calling thread .
32,920
public void commit ( ) throws HeuristicRollbackException , RollbackException , HeuristicMixedException , SystemException { Transaction transaction = currentTransaction ( ) ; if ( transaction == null ) { throw new IllegalStateException ( "No active transaction" ) ; } transaction . commit ( ) ; }
Commits the current transaction if one exists .
32,921
public void rollback ( ) throws SystemException { Transaction transaction = currentTransaction ( ) ; if ( transaction == null ) { throw new IllegalStateException ( "No active transaction" ) ; } transaction . rollback ( ) ; }
Rolls back the current transaction if one exists .
32,922
protected NodeTypes without ( Collection < JcrNodeType > removedNodeTypes ) { if ( removedNodeTypes . isEmpty ( ) ) return this ; Collection < JcrNodeType > nodeTypes = new HashSet < JcrNodeType > ( this . nodeTypes . values ( ) ) ; nodeTypes . removeAll ( removedNodeTypes ) ; return new NodeTypes ( this . context , no...
Obtain a new version of this cache with the specified node types removed from the new cache .
32,923
protected NodeTypes with ( Collection < JcrNodeType > addedNodeTypes ) { if ( addedNodeTypes . isEmpty ( ) ) return this ; Collection < JcrNodeType > nodeTypes = new HashSet < JcrNodeType > ( this . nodeTypes . values ( ) ) ; nodeTypes . removeAll ( addedNodeTypes ) ; nodeTypes . addAll ( addedNodeTypes ) ; return new ...
Obtain a new version of this cache with the specified node types added to the new cache .
32,924
public boolean isTypeOrSubtype ( Name nodeTypeName , Name candidateSupertypeName ) { if ( JcrNtLexicon . BASE . equals ( candidateSupertypeName ) ) { return true ; } if ( nodeTypeName . equals ( candidateSupertypeName ) ) return true ; JcrNodeType nodeType = getNodeType ( nodeTypeName ) ; return nodeType != null && nod...
Determine whether the node s given node type matches or extends the node type with the supplied name .
32,925
public boolean isTypeOrSubtype ( Set < Name > nodeTypeNames , Name candidateSupertypeName ) { for ( Name nodeTypeName : nodeTypeNames ) { if ( isTypeOrSubtype ( nodeTypeName , candidateSupertypeName ) ) return true ; } return false ; }
Determine whether at least one of the node s given node types matches or extends the node type with the supplied name .
32,926
public boolean allowsNameSiblings ( Name primaryType , Set < Name > mixinTypes ) { if ( isUnorderedCollection ( primaryType , mixinTypes ) ) { return false ; } if ( nodeTypeNamesThatAllowSameNameSiblings . contains ( primaryType ) ) return true ; if ( mixinTypes != null && ! mixinTypes . isEmpty ( ) ) { for ( Name mixi...
Determine if either the primary type or any of the mixin types allows SNS .
32,927
public int getBucketIdLengthForUnorderedCollection ( Name nodeTypeName , Set < Name > mixinTypes ) { Set < Name > allTypes = new LinkedHashSet < > ( ) ; allTypes . add ( nodeTypeName ) ; if ( mixinTypes != null && ! mixinTypes . isEmpty ( ) ) { allTypes . addAll ( mixinTypes ) ; } for ( Name typeName : allTypes ) { if ...
Determine the length of a bucket ID for an unordered collection based on its type and possible mixins .
32,928
public boolean isReferenceProperty ( Name nodeTypeName , Name propertyName ) { JcrNodeType type = getNodeType ( nodeTypeName ) ; if ( type != null ) { for ( JcrPropertyDefinition propDefn : type . allPropertyDefinitions ( propertyName ) ) { int requiredType = propDefn . getRequiredType ( ) ; if ( requiredType == Proper...
Determine if the named property on the node type is a reference property .
32,929
public boolean hasMandatoryPropertyDefinitions ( Name primaryType , Set < Name > mixinTypes ) { if ( mandatoryPropertiesNodeTypes . containsKey ( primaryType ) ) return true ; for ( Name mixinType : mixinTypes ) { if ( mandatoryPropertiesNodeTypes . containsKey ( mixinType ) ) return true ; } return false ; }
Determine if the named primary node type or mixin types has at least one mandatory property definitions declared on it or any of its supertypes .
32,930
public boolean hasMandatoryChildNodeDefinitions ( Name primaryType , Set < Name > mixinTypes ) { if ( mandatoryChildrenNodeTypes . containsKey ( primaryType ) ) return true ; for ( Name mixinType : mixinTypes ) { if ( mandatoryChildrenNodeTypes . containsKey ( mixinType ) ) return true ; } return false ; }
Determine if the named primary node type or mixin types has at least one mandatory child node definitions declared on it or any of its supertypes .
32,931
public boolean isQueryable ( Name nodeTypeName , Set < Name > mixinTypes ) { if ( nonQueryableNodeTypes . contains ( nodeTypeName ) ) { return false ; } if ( ! mixinTypes . isEmpty ( ) ) { for ( Name mixinType : mixinTypes ) { if ( nonQueryableNodeTypes . contains ( mixinType ) ) { return false ; } } } return true ; }
Check if the node type and mixin types are queryable or not .
32,932
boolean canRemoveItem ( Name primaryTypeNameOfParent , List < Name > mixinTypeNamesOfParent , Name itemName , boolean skipProtected ) { JcrNodeType primaryType = getNodeType ( primaryTypeNameOfParent ) ; if ( primaryType != null ) { for ( JcrPropertyDefinition definition : primaryType . allPropertyDefinitions ( itemNam...
Determine if the node and property definitions of the supplied primary type and mixin types allow the item with the supplied name to be removed .
32,933
protected JcrNodeType findTypeInMapOrList ( Name typeName , Collection < JcrNodeType > pendingList ) { for ( JcrNodeType pendingNodeType : pendingList ) { if ( pendingNodeType . getInternalName ( ) . equals ( typeName ) ) { return pendingNodeType ; } } return nodeTypes . get ( typeName ) ; }
Finds the named type in the given collection of types pending registration if it exists else returns the type definition from the repository
32,934
protected List < JcrNodeType > supertypesFor ( NodeTypeDefinition nodeType , Collection < JcrNodeType > pendingTypes ) throws RepositoryException { assert nodeType != null ; List < JcrNodeType > supertypes = new LinkedList < JcrNodeType > ( ) ; boolean isMixin = nodeType . isMixin ( ) ; boolean needsPrimaryAncestor = !...
Returns the list of node types for the supertypes defined in the given node type .
32,935
final Collection < JcrNodeType > subtypesFor ( JcrNodeType nodeType ) { List < JcrNodeType > subtypes = new LinkedList < JcrNodeType > ( ) ; for ( JcrNodeType type : this . nodeTypes . values ( ) ) { if ( type . supertypes ( ) . contains ( nodeType ) ) { subtypes . add ( type ) ; } } return subtypes ; }
Returns the list of subtypes for the given node .
32,936
final Collection < JcrNodeType > declaredSubtypesFor ( JcrNodeType nodeType ) { CheckArg . isNotNull ( nodeType , "nodeType" ) ; String nodeTypeName = nodeType . getName ( ) ; List < JcrNodeType > subtypes = new LinkedList < JcrNodeType > ( ) ; for ( JcrNodeType type : this . nodeTypes . values ( ) ) { if ( Arrays . as...
Returns the list of declared subtypes for the given node .
32,937
protected void validate ( JcrNodeType nodeType , List < JcrNodeType > supertypes , List < JcrNodeType > pendingTypes ) throws RepositoryException { validateSupertypes ( supertypes ) ; List < Name > supertypeNames = new ArrayList < Name > ( supertypes . size ( ) ) ; for ( JcrNodeType supertype : supertypes ) { supertype...
Validates that the given node type definition is valid under the ModeShape and JCR type rules within the given context .
32,938
public boolean isCaseSensitive ( ) { switch ( getJcrType ( ) ) { case PropertyType . DOUBLE : case PropertyType . LONG : case PropertyType . DECIMAL : case PropertyType . WEAKREFERENCE : case PropertyType . REFERENCE : case PropertyType . BOOLEAN : return false ; } return true ; }
Get the indicator if the value is case sensitive
32,939
public boolean isSigned ( ) { switch ( getJcrType ( ) ) { case PropertyType . DOUBLE : case PropertyType . LONG : case PropertyType . DECIMAL : case PropertyType . DATE : return true ; } return false ; }
Get the indicator if the value is considered a signed value .
32,940
public static < T > Iterable < T > concat ( final Iterable < T > a , final Iterable < T > b ) { assert ( a != null ) ; assert ( b != null ) ; return ( ) -> Collections . concat ( a . iterator ( ) , b . iterator ( ) ) ; }
Concatenate two Iterable sources
32,941
public static < T > Iterator < T > concat ( final Iterator < T > a , final Iterator < T > b ) { assert ( a != null ) ; assert ( b != null ) ; return new Iterator < T > ( ) { public boolean hasNext ( ) { return a . hasNext ( ) || b . hasNext ( ) ; } public T next ( ) { if ( a . hasNext ( ) ) { return a . next ( ) ; } re...
Concatenate two Iterators
32,942
public EsIndexColumn column ( String name ) { return columns . get ( noprefix ( name , EsIndexColumn . LENGTH_PREFIX , EsIndexColumn . LOWERCASE_PREFIX , EsIndexColumn . UPPERCASE_PREFIX ) ) ; }
Gets column with given name .
32,943
private String noprefix ( String name , String ... prefix ) { for ( int i = 0 ; i < prefix . length ; i ++ ) { if ( name . startsWith ( prefix [ i ] ) ) { name = name . replaceAll ( prefix [ i ] , "" ) ; } } return name ; }
Cuts name prefix for the pseudo column case .
32,944
public EsRequest mappings ( String type ) { EsRequest mappings = new EsRequest ( ) ; EsRequest mappingsValue = new EsRequest ( ) ; EsRequest mtype = new EsRequest ( ) ; EsRequest properties = new EsRequest ( ) ; for ( EsIndexColumn col : columns ( ) ) { properties . put ( col . getName ( ) , fieldMapping ( col . getTyp...
Provides Elasticsearch mapping definition for the given type and this columns .
32,945
private EsRequest fieldMapping ( PropertyType type ) { EsRequest mappings = new EsRequest ( ) ; switch ( type ) { case BINARY : mappings . put ( "type" , "binary" ) ; break ; case BOOLEAN : mappings . put ( "type" , "boolean" ) ; break ; case DATE : mappings . put ( "type" , "long" ) ; break ; case LONG : case DECIMAL ...
Creates mapping definition for the specified column type .
32,946
public void setControls ( FormItem ... items ) { FormItem [ ] controls = new FormItem [ items . length + 3 ] ; int i = 0 ; for ( FormItem item : items ) { controls [ i ++ ] = item ; } controls [ i ++ ] = new SpacerItem ( ) ; controls [ i ++ ] = confirmButton ; controls [ i ++ ] = cancelButton ; form . setItems ( contro...
Adds controls to this dialog .
32,947
public static void unzip ( InputStream zipFile , String dest ) throws IOException { byte [ ] buffer = new byte [ 1024 ] ; File folder = new File ( dest ) ; if ( folder . exists ( ) ) { FileUtil . delete ( folder ) ; } folder . mkdir ( ) ; try ( ZipInputStream zis = new ZipInputStream ( zipFile ) ) { ZipEntry ze = zis ....
Unzip archive to the specified destination .
32,948
public static void zipDir ( String dirName , String nameZipFile ) throws IOException { try ( FileOutputStream fW = new FileOutputStream ( nameZipFile ) ; ZipOutputStream zip = new ZipOutputStream ( fW ) ) { addFolderToZip ( "" , dirName , zip ) ; } }
Compresses directory into zip archive .
32,949
public static void addFolderToZip ( String path , String srcFolder , ZipOutputStream zip ) throws IOException { File folder = new File ( srcFolder ) ; if ( folder . list ( ) . length == 0 ) { addFileToZip ( path , srcFolder , zip , true ) ; } else { for ( String fileName : folder . list ( ) ) { if ( path . equals ( "" ...
Adds folder to the archive .
32,950
public static void addFileToZip ( String path , String srcFile , ZipOutputStream zip , boolean flag ) throws IOException { File folder = new File ( srcFile ) ; if ( flag ) { zip . putNextEntry ( new ZipEntry ( path + "/" + folder . getName ( ) + "/" ) ) ; } else { if ( folder . isDirectory ( ) ) { addFolderToZip ( path...
Appends file to the archive .
32,951
public static String getExtension ( final String filename ) { Objects . requireNonNull ( filename , "filename cannot be null" ) ; int lastDotIdx = filename . lastIndexOf ( "." ) ; return lastDotIdx >= 0 ? filename . substring ( lastDotIdx ) : "" ; }
Returns the extension of a file including the dot .
32,952
public void read ( InputStream stream , Node outputNode ) throws Exception { read ( new InputSource ( stream ) , outputNode ) ; }
Read the document from the supplied stream and produce the derived content .
32,953
private JcrSession openSession ( ) throws ResourceException { try { Repository repo = mcf . getRepository ( ) ; Session s = repo . login ( cri . getCredentials ( ) , cri . getWorkspace ( ) ) ; return ( JcrSession ) s ; } catch ( RepositoryException e ) { throw new ResourceException ( "Failed to create session: " + e . ...
Create a new session .
32,954
public void destroy ( ) throws ResourceException { LOGGER . debug ( "Shutting down connection to repo '{0}'" , mcf . getRepositoryURL ( ) ) ; this . session . logout ( ) ; this . handles . clear ( ) ; }
Destroys the physical connection to the underlying resource manager .
32,955
public ManagedConnectionMetaData getMetaData ( ) throws ResourceException { try { return new JcrManagedConnectionMetaData ( mcf . getRepository ( ) , session ) ; } catch ( Exception e ) { throw new ResourceException ( e ) ; } }
Gets the metadata information for this connection s underlying EIS resource manager instance .
32,956
public Session getSession ( JcrSessionHandle handle ) { if ( ( handles . size ( ) > 0 ) && ( handles . get ( 0 ) == handle ) ) { return session ; } throw new java . lang . IllegalStateException ( "Inactive logical session handle called" ) ; }
Searches session object using handle .
32,957
public static String combineLines ( String [ ] lines , char separator ) { if ( lines == null || lines . length == 0 ) return "" ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i != lines . length ; ++ i ) { String line = lines [ i ] ; if ( i != 0 ) sb . append ( separator ) ; sb . append ( line ) ; } ret...
Combine the lines into a single string using the supplied separator as the delimiter .
32,958
public static List < String > splitLines ( final String content ) { if ( content == null || content . length ( ) == 0 ) return Collections . emptyList ( ) ; String [ ] lines = content . split ( "[\\r]?\\n" ) ; return Arrays . asList ( lines ) ; }
Split the supplied content into lines returning each line as an element in the returned list .
32,959
public static String createString ( final char charToRepeat , int numberOfRepeats ) { assert numberOfRepeats >= 0 ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < numberOfRepeats ; ++ i ) { sb . append ( charToRepeat ) ; } return sb . toString ( ) ; }
Create a new string containing the specified character repeated a specific number of times .
32,960
public static String justify ( Justify justify , String str , final int width , char padWithChar ) { switch ( justify ) { case LEFT : return justifyLeft ( str , width , padWithChar ) ; case RIGHT : return justifyRight ( str , width , padWithChar ) ; case CENTER : return justifyCenter ( str , width , padWithChar ) ; } a...
Justify the contents of the string .
32,961
public static String justifyRight ( String str , final int width , char padWithChar ) { assert width > 0 ; str = str != null ? str . trim ( ) : "" ; final int length = str . length ( ) ; int addChars = width - length ; if ( addChars < 0 ) { return str . subSequence ( length - width , length ) . toString ( ) ; } final S...
Right justify the contents of the string ensuring that the string ends at the last character . If the supplied string is longer than the desired width the leading characters are removed so that the last character in the supplied string at the last position . If the supplied string is shorter than the desired width the ...
32,962
public static String justifyLeft ( String str , final int width , char padWithChar ) { return justifyLeft ( str , width , padWithChar , true ) ; }
Left justify the contents of the string ensuring that the supplied string begins at the first character and that the resulting string is of the desired length . If the supplied string is longer than the desired width it is truncated to the specified length . If the supplied string is shorter than the desired width the ...
32,963
public static String justifyCenter ( String str , final int width , char padWithChar ) { str = str != null ? str . trim ( ) : "" ; int addChars = width - str . length ( ) ; if ( addChars < 0 ) { return str . subSequence ( 0 , width ) . toString ( ) ; } int prependNumber = addChars / 2 ; int appendNumber = prependNumber...
Center the contents of the string . If the supplied string is longer than the desired width it is truncated to the specified length . If the supplied string is shorter than the desired width padding characters are added to the beginning and end of the string such that the length is that specified ; one additional paddi...
32,964
public static String truncate ( Object obj , int maxLength , String suffix ) { CheckArg . isNonNegative ( maxLength , "maxLength" ) ; if ( obj == null || maxLength == 0 ) { return "" ; } String str = obj . toString ( ) ; if ( str . length ( ) <= maxLength ) return str ; if ( suffix == null ) suffix = "..." ; int maxNum...
Truncate the supplied string to be no more than the specified length . This method returns an empty string if the supplied object is null .
32,965
public static String getStackTrace ( Throwable throwable ) { if ( throwable == null ) return null ; final ByteArrayOutputStream bas = new ByteArrayOutputStream ( ) ; final PrintWriter pw = new PrintWriter ( bas ) ; throwable . printStackTrace ( pw ) ; pw . close ( ) ; return bas . toString ( ) ; }
Get the stack trace of the supplied exception .
32,966
public static String normalize ( String text ) { CheckArg . isNotNull ( text , "text" ) ; return NORMALIZE_PATTERN . matcher ( text ) . replaceAll ( " " ) . trim ( ) ; }
Removes leading and trailing whitespace from the supplied text and reduces other consecutive whitespace characters to a single space . Whitespace includes line - feeds .
32,967
public static String getHexString ( byte [ ] bytes ) { try { byte [ ] hex = new byte [ 2 * bytes . length ] ; int index = 0 ; for ( byte b : bytes ) { int v = b & 0xFF ; hex [ index ++ ] = HEX_CHAR_TABLE [ v >>> 4 ] ; hex [ index ++ ] = HEX_CHAR_TABLE [ v & 0xF ] ; } return new String ( hex , "ASCII" ) ; } catch ( Unsu...
Get the hexadecimal string representation of the supplied byte array .
32,968
public static boolean containsAnyOf ( String str , char ... chars ) { CharacterIterator iter = new StringCharacterIterator ( str ) ; for ( char c = iter . first ( ) ; c != CharacterIterator . DONE ; c = iter . next ( ) ) { for ( char match : chars ) { if ( c == match ) return true ; } } return false ; }
Return whether the supplied string contains any of the supplied characters .
32,969
protected void refreshFromSystem ( ) { try { SessionCache systemCache = repository . createSystemSession ( repository . context ( ) , false ) ; SystemContent system = new SystemContent ( systemCache ) ; CachedNode locks = system . locksNode ( ) ; MutableCachedNode mutableLocks = null ; Set < NodeKey > corruptedLocks = ...
Refresh the locks from the stored representation .
32,970
protected void record ( final Sequencer . Context context , final char [ ] sourceCode , final Node outputNode ) throws Exception { if ( ( sourceCode == null ) || ( sourceCode . length == 0 ) ) { LOGGER . debug ( "No source code was found for output node {0}" , outputNode . getName ( ) ) ; return ; } this . context = co...
Convert the compilation unit into JCR nodes .
32,971
private String getTypeName ( Type type ) { CheckArg . isNotNull ( type , "type" ) ; if ( type . isPrimitiveType ( ) ) { PrimitiveType primitiveType = ( PrimitiveType ) type ; return primitiveType . getPrimitiveTypeCode ( ) . toString ( ) ; } if ( type . isSimpleType ( ) ) { SimpleType simpleType = ( SimpleType ) type ;...
Extract the type name
32,972
public static DatabaseType determineType ( DatabaseMetaData metaData ) throws SQLException { metaData = Objects . requireNonNull ( metaData , "metaData cannot be null" ) ; int majorVersion = metaData . getDatabaseMajorVersion ( ) ; int minorVersion = metaData . getDatabaseMinorVersion ( ) ; String name = metaData . get...
Determine the type of a database based on the metadata information from the DB metadata .
32,973
@ SuppressWarnings ( "unchecked" ) public synchronized void addConsumer ( MessageConsumer < ? extends Serializable > consumer ) { consumers . add ( ( MessageConsumer < Serializable > ) consumer ) ; }
Adds a new message consumer to this service .
32,974
public synchronized boolean shutdown ( ) { if ( channel == null ) { return false ; } Address address = channel . getAddress ( ) ; LOGGER . debug ( "{0} shutting down clustering service..." , address ) ; consumers . clear ( ) ; isOpen . set ( false ) ; try { channel . disconnect ( ) ; channel . removeChannelListener ( l...
Shuts down and clears resources held by this service .
32,975
public boolean sendMessage ( Serializable payload ) { if ( ! isOpen ( ) || ! multipleMembersInCluster ( ) ) { return false ; } if ( LOGGER . isDebugEnabled ( ) ) { LOGGER . debug ( "{0} SENDING {1} " , toString ( ) , payload ) ; } try { byte [ ] messageData = toByteArray ( payload ) ; Message jgMessage = new Message ( ...
Sends a message of a given type across a cluster .
32,976
public static ClusteringService startStandalone ( String clusterName , String jgroupsConfig ) { ClusteringService clusteringService = new StandaloneClusteringService ( clusterName , jgroupsConfig ) ; clusteringService . init ( ) ; return clusteringService ; }
Starts a standalone clustering service which in turn will start & connect its own JGroup channel .
32,977
public static ClusteringService startStandalone ( String clusterName , Channel channel ) { ClusteringService clusteringService = new StandaloneClusteringService ( clusterName , channel ) ; clusteringService . init ( ) ; return clusteringService ; }
Starts a standalone clustering service which uses the supplied channel .
32,978
public static ClusteringService startForked ( Channel mainChannel ) { if ( ! mainChannel . isConnected ( ) ) { throw new IllegalStateException ( ClusteringI18n . channelNotConnected . text ( ) ) ; } ClusteringService clusteringService = new ForkedClusteringService ( mainChannel ) ; clusteringService . init ( ) ; return...
Starts a new clustering service by forking a channel of an existing JGroups channel .
32,979
public boolean isNotOneOf ( Type first , Type ... rest ) { return isNotOneOf ( EnumSet . of ( first , rest ) ) ; }
Return true if this node s type does not match any of the supplied types
32,980
public boolean isOneOf ( Type first , Type ... rest ) { return isOneOf ( EnumSet . of ( first , rest ) ) ; }
Return true if this node s type matches one of the supplied types
32,981
public boolean isBelow ( PlanNode possibleAncestor ) { PlanNode node = this ; while ( node != null ) { if ( node == possibleAncestor ) return true ; node = node . getParent ( ) ; } return false ; }
Determine if the supplied node is an ancestor of this node .
32,982
public boolean replaceChild ( PlanNode child , PlanNode replacement ) { assert child != null ; assert replacement != null ; if ( child . parent == this ) { int i = this . children . indexOf ( child ) ; if ( replacement . parent == this ) { int j = this . children . indexOf ( replacement ) ; this . children . set ( i , ...
Replace the supplied child with another node . If the replacement is already a child of this node this method effectively swaps the position of the child and replacement nodes .
32,983
public Set < Property > getPropertyKeys ( ) { return nodeProperties != null ? nodeProperties . keySet ( ) : Collections . < Property > emptySet ( ) ; }
Get the keys for the property values that are set on this node .
32,984
public Object getProperty ( Property propertyId ) { return nodeProperties != null ? nodeProperties . get ( propertyId ) : null ; }
Get the node s value for this supplied property .
32,985
public < ValueType > ValueType getProperty ( Property propertyId , Class < ValueType > type ) { return nodeProperties != null ? type . cast ( nodeProperties . get ( propertyId ) ) : null ; }
Get the node s value for this supplied property casting the result to the supplied type .
32,986
public Object setProperty ( Property propertyId , Object value ) { if ( value == null ) { return nodeProperties != null ? nodeProperties . remove ( propertyId ) : null ; } if ( nodeProperties == null ) nodeProperties = new TreeMap < Property , Object > ( ) ; return nodeProperties . put ( propertyId , value ) ; }
Set the node s value for the supplied property .
32,987
public Object removeProperty ( Object propertyId ) { return nodeProperties != null ? nodeProperties . remove ( propertyId ) : null ; }
Remove the node s value for this supplied property .
32,988
public boolean hasCollectionProperty ( Property propertyId ) { Object value = getProperty ( propertyId ) ; return ( value instanceof Collection < ? > && ! ( ( Collection < ? > ) value ) . isEmpty ( ) ) ; }
Indicates if there is a non - null and non - empty Collection value for the property .
32,989
public boolean replaceSelector ( SelectorName original , SelectorName replacement ) { if ( original != null && replacement != null ) { if ( selectors . remove ( original ) ) { selectors . add ( replacement ) ; return true ; } } return false ; }
Replace this plan s use of the named selector with the replacement . to this plan node . This method does nothing if either of the supplied selector names is null or if the supplied original selector name is not found .
32,990
public List < PlanNode > findAllFirstNodesAtOrBelow ( Type typeToFind ) { List < PlanNode > results = new LinkedList < PlanNode > ( ) ; LinkedList < PlanNode > queue = new LinkedList < PlanNode > ( ) ; queue . add ( this ) ; while ( ! queue . isEmpty ( ) ) { PlanNode aNode = queue . poll ( ) ; if ( aNode . getType ( ) ...
Look at nodes below this node searching for nodes that have the supplied type . As soon as a node with a matching type is found then no other nodes below it are searched .
32,991
public void apply ( Traversal order , final Operation operation , final Type type ) { apply ( order , new Operation ( ) { public void apply ( PlanNode node ) { if ( node . getType ( ) == type ) operation . apply ( node ) ; } } ) ; }
Walk the plan tree starting in the specified traversal order and apply the supplied operation to every plan node with a type that matches the given type .
32,992
public void apply ( Traversal order , Operation operation ) { assert order != null ; switch ( order ) { case LEVEL_ORDER : operation . apply ( this ) ; applyLevelOrder ( order , operation ) ; break ; case PRE_ORDER : operation . apply ( this ) ; for ( PlanNode child : this ) { child . apply ( order , operation ) ; } br...
Walk the plan tree starting in the specified traversal order and apply the supplied operation to every plan node .
32,993
public void applyToAncestorsUpTo ( Type stopType , Operation operation ) { PlanNode ancestor = getParent ( ) ; while ( ancestor != null ) { if ( ancestor . getType ( ) == stopType ) return ; operation . apply ( ancestor ) ; ancestor = ancestor . getParent ( ) ; } }
Apply the operation to all ancestor nodes below a node of the given type .
32,994
public void applyToAncestors ( Operation operation ) { PlanNode ancestor = getParent ( ) ; while ( ancestor != null ) { operation . apply ( ancestor ) ; ancestor = ancestor . getParent ( ) ; } }
Apply the operation to all ancestor nodes .
32,995
public List < PlanNode > findAllAtOrBelow ( Traversal order ) { assert order != null ; LinkedList < PlanNode > results = new LinkedList < PlanNode > ( ) ; LinkedList < PlanNode > queue = new LinkedList < PlanNode > ( ) ; queue . add ( this ) ; while ( ! queue . isEmpty ( ) ) { PlanNode aNode = queue . poll ( ) ; switch...
Find all of the nodes that are at or below this node .
32,996
public List < PlanNode > findAllAtOrBelow ( Traversal order , Type typeToFind ) { return findAllAtOrBelow ( order , EnumSet . of ( typeToFind ) ) ; }
Find all of the nodes of the specified type that are at or below this node .
32,997
public PlanNode findAtOrBelow ( Traversal order , Type typeToFind ) { return findAtOrBelow ( order , EnumSet . of ( typeToFind ) ) ; }
Find the first node with the specified type that are at or below this node .
32,998
public String findJcrName ( String cmisName ) { for ( Relation aList : list ) { if ( aList . cmisName . equals ( cmisName ) ) { return aList . jcrName ; } } return cmisName ; }
Gets the name of the given property in JCR domain .
32,999
public String findCmisName ( String jcrName ) { for ( Relation aList : list ) { if ( aList . jcrName . equals ( jcrName ) ) { return aList . cmisName ; } } return jcrName ; }
Gets the name of the given property in CMIS domain .