idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
33,400
public static List < Class < ? > > convertArgumentClassesToPrimitives ( Class < ? > ... arguments ) { if ( arguments == null || arguments . length == 0 ) return Collections . emptyList ( ) ; List < Class < ? > > result = new ArrayList < Class < ? > > ( arguments . length ) ; for ( Class < ? > clazz : arguments ) { if (...
Convert any argument classes to primitives .
33,401
public static String getClassName ( final Class < ? > clazz ) { final String fullName = clazz . getName ( ) ; final int fullNameLength = fullName . length ( ) ; int numArrayDimensions = 0 ; while ( numArrayDimensions < fullNameLength ) { final char c = fullName . charAt ( numArrayDimensions ) ; if ( c != '[' ) { String...
Returns the name of the class . The result will be the fully - qualified class name or the readable form for arrays and primitive types .
33,402
public static void setValue ( Object instance , String fieldName , Object value ) { try { Field f = findFieldRecursively ( instance . getClass ( ) , fieldName ) ; if ( f == null ) throw new NoSuchMethodException ( "Cannot find field " + fieldName + " on " + instance . getClass ( ) + " or superclasses" ) ; f . setAccess...
Sets the value of a field of an object instance via reflection
33,403
public static Method findMethod ( Class < ? > type , String methodName ) { try { return type . getDeclaredMethod ( methodName ) ; } catch ( NoSuchMethodException e ) { if ( type . equals ( Object . class ) || type . isInterface ( ) ) { throw new RuntimeException ( e ) ; } return findMethod ( type . getSuperclass ( ) , ...
Searches for a method with a given name in a class .
33,404
public Method [ ] findMethods ( Pattern methodNamePattern ) { final Method [ ] allMethods = this . targetClass . getMethods ( ) ; final List < Method > result = new ArrayList < Method > ( ) ; for ( int i = 0 ; i < allMethods . length ; i ++ ) { final Method m = allMethods [ i ] ; if ( methodNamePattern . matcher ( m . ...
Find the methods on the target class that matches the supplied method name .
33,405
public Object invokeGetterMethodOnTarget ( String javaPropertyName , Object target ) throws NoSuchMethodException , SecurityException , IllegalArgumentException , IllegalAccessException , InvocationTargetException { String [ ] methodNamesArray = findMethodNames ( "get" + javaPropertyName ) ; if ( methodNamesArray . len...
Find and execute the getter method on the target class for the supplied property name . If no such method is found a NoSuchMethodException is thrown .
33,406
public void setProperty ( Object target , Property property , Object value ) throws SecurityException , IllegalArgumentException , NoSuchMethodException , IllegalAccessException , InvocationTargetException { CheckArg . isNotNull ( target , "target" ) ; CheckArg . isNotNull ( property , "property" ) ; CheckArg . isNotNu...
Set the property on the supplied target object to the specified value .
33,407
public Object getProperty ( Object target , Property property ) throws SecurityException , IllegalArgumentException , NoSuchMethodException , IllegalAccessException , InvocationTargetException { CheckArg . isNotNull ( target , "target" ) ; CheckArg . isNotNull ( property , "property" ) ; CheckArg . isNotNull ( property...
Get current value for the property on the supplied target object .
33,408
public String getPropertyAsString ( Object target , Property property ) throws SecurityException , IllegalArgumentException , NoSuchMethodException , IllegalAccessException , InvocationTargetException { Object value = getProperty ( target , property ) ; StringBuilder sb = new StringBuilder ( ) ; writeObjectAsString ( v...
Get current value represented as a string for the property on the supplied target object .
33,409
public String getSourceKey ( ) { if ( sourceKey == null ) { sourceKey = key . substring ( SOURCE_START_INDEX , SOURCE_END_INDEX ) ; } return sourceKey ; }
Get the multi - character key uniquely identifying the repository s storage source in which this node appears .
33,410
public String getWorkspaceKey ( ) { if ( workspaceKey == null ) { workspaceKey = key . substring ( WORKSPACE_START_INDEX , WORKSPACE_END_INDEX ) ; } return workspaceKey ; }
Get the multi - character key uniquely identifying the workspace in which the node appears .
33,411
public QueryBuilder union ( ) { this . firstQuery = query ( ) ; this . firstQuerySetOperation = Operation . UNION ; this . firstQueryAll = false ; clear ( false ) ; return this ; }
Perform a UNION between the query as defined prior to this method and the query that will be defined following this method .
33,412
public QueryBuilder unionAll ( ) { this . firstQuery = query ( ) ; this . firstQuerySetOperation = Operation . UNION ; this . firstQueryAll = true ; clear ( false ) ; return this ; }
Perform a UNION ALL between the query as defined prior to this method and the query that will be defined following this method .
33,413
public QueryBuilder intersect ( ) { this . firstQuery = query ( ) ; this . firstQuerySetOperation = Operation . INTERSECT ; this . firstQueryAll = false ; clear ( false ) ; return this ; }
Perform an INTERSECT between the query as defined prior to this method and the query that will be defined following this method .
33,414
public QueryBuilder intersectAll ( ) { this . firstQuery = query ( ) ; this . firstQuerySetOperation = Operation . INTERSECT ; this . firstQueryAll = true ; clear ( false ) ; return this ; }
Perform an INTERSECT ALL between the query as defined prior to this method and the query that will be defined following this method .
33,415
public QueryBuilder except ( ) { this . firstQuery = query ( ) ; this . firstQuerySetOperation = Operation . EXCEPT ; this . firstQueryAll = false ; clear ( false ) ; return this ; }
Perform an EXCEPT between the query as defined prior to this method and the query that will be defined following this method .
33,416
public QueryBuilder exceptAll ( ) { this . firstQuery = query ( ) ; this . firstQuerySetOperation = Operation . EXCEPT ; this . firstQueryAll = true ; clear ( false ) ; return this ; }
Perform an EXCEPT ALL between the query as defined prior to this method and the query that will be defined following this method .
33,417
public static IndexChangeAdapter forMultipleColumns ( ExecutionContext context , NodeTypePredicate matcher , String workspaceName , ProvidedIndex < ? > index , Iterable < IndexChangeAdapter > adapters ) { return new MultiColumnChangeAdapter ( context , workspaceName , matcher , index , adapters ) ; }
Creates a composite change adapter which handles the case when an index has multiple columns .
33,418
private boolean checkSupportedAudio ( ) { AudioHeader header = audioFile . getAudioHeader ( ) ; bitrate = header . getBitRateAsNumber ( ) ; sampleRate = header . getSampleRateAsNumber ( ) ; channels = header . getChannels ( ) ; if ( header . getChannels ( ) . toLowerCase ( ) . contains ( "stereo" ) ) { channels = "2" ;...
Parse tags common for all audio files .
33,419
static < T > LocalUniqueIndex < T > create ( String name , String workspaceName , DB db , Converter < T > converter , BTreeKeySerializer < T > valueSerializer , Serializer < T > rawSerializer ) { return new LocalUniqueIndex < > ( name , workspaceName , db , converter , valueSerializer , rawSerializer ) ; }
Create a new index that allows only a single value for each unique key .
33,420
protected Object columnValue ( Object value ) { switch ( type ) { case PATH : case NAME : case STRING : case REFERENCE : case SIMPLEREFERENCE : case WEAKREFERENCE : case URI : return valueFactories . getStringFactory ( ) . create ( value ) ; case DATE : return ( ( DateTime ) value ) . getMilliseconds ( ) ; default : re...
Converts representation of the given value using type conversation rules between JCR type of this column and Elasticsearch core type of this column .
33,421
protected Object cast ( Object value ) { switch ( type ) { case STRING : return valueFactories . getStringFactory ( ) . create ( value ) ; case LONG : return valueFactories . getLongFactory ( ) . create ( value ) ; case NAME : return valueFactories . getNameFactory ( ) . create ( value ) ; case PATH : return valueFacto...
Converts given value to the value of JCR type of this column .
33,422
public boolean indexExists ( String name ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpHead head = new HttpHead ( String . format ( "http://%s:%d/%s" , host , port , name ) ) ; try { CloseableHttpResponse response = client . execute ( head ) ; return response . getStatusLine ...
Tests for the index existence with specified name .
33,423
public boolean createIndex ( String name , String type , EsRequest mappings ) throws IOException { if ( indexExists ( name ) ) { return true ; } CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpPost method = new HttpPost ( String . format ( "http://%s:%d/%s" , host , port , name ) ) ; try { StringEnti...
Creates new index .
33,424
public boolean deleteIndex ( String name ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpDelete delete = new HttpDelete ( String . format ( "http://%s:%d/%s" , host , port , name ) ) ; try { CloseableHttpResponse resp = client . execute ( delete ) ; return resp . getStatusLine ...
Deletes index .
33,425
public boolean storeDocument ( String name , String type , String id , EsRequest doc ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpPost method = new HttpPost ( String . format ( "http://%s:%d/%s/%s/%s" , host , port , name , type , id ) ) ; try { StringEntity requestEntity = ...
Indexes document .
33,426
public EsRequest getDocument ( String name , String type , String id ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpGet method = new HttpGet ( String . format ( "http://%s:%d/%s/%s/%s" , host , port , name , type , id ) ) ; try { CloseableHttpResponse resp = client . execute (...
Searches indexed document .
33,427
public boolean deleteDocument ( String name , String type , String id ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpDelete delete = new HttpDelete ( String . format ( "http://%s:%d/%s/%s/%s" , host , port , name , type , id ) ) ; try { return client . execute ( delete ) . get...
Deletes document .
33,428
public void deleteAll ( String name , String type ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpPost method = new HttpPost ( String . format ( "http://%s:%d/%s/%s" , host , port , name , type ) ) ; try { EsRequest query = new EsRequest ( ) ; query . put ( "query" , new MatchA...
Deletes all documents .
33,429
public void flush ( String name ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpPost method = new HttpPost ( String . format ( "http://%s:%d/%s/_flush" , host , port , name ) ) ; try { CloseableHttpResponse resp = client . execute ( method ) ; int status = resp . getStatusLine ...
Flushes index data .
33,430
public EsResponse search ( String name , String type , EsRequest query ) throws IOException { CloseableHttpClient client = HttpClients . createDefault ( ) ; HttpPost method = new HttpPost ( String . format ( "http://%s:%d/%s/%s/_search" , host , port , name , type ) ) ; try { StringEntity requestEntity = new StringEnti...
Executes query .
33,431
protected String doGetString ( NamespaceRegistry namespaceRegistry , TextEncoder encoder , TextEncoder delimiterEncoder ) { if ( encoder == null ) encoder = DEFAULT_ENCODER ; final String delimiter = delimiterEncoder != null ? delimiterEncoder . encode ( DELIMITER_STR ) : DELIMITER_STR ; StringBuilder sb = new StringBu...
Method that creates the string representation . This method works two different ways depending upon whether the namespace registry is provided .
33,432
public Lock lock ( AbstractJcrNode node , boolean isDeep , boolean isSessionScoped , long timeoutHint , String ownerInfo ) throws LockException , AccessDeniedException , InvalidItemStateException , RepositoryException { if ( ! node . isLockable ( ) ) { throw new LockException ( JcrI18n . nodeNotLockable . text ( node ....
Attempt to obtain a lock on the supplied node .
33,433
protected String removeQuotes ( String text ) { assert text != null ; if ( text . length ( ) > 2 ) { char first = text . charAt ( 0 ) ; if ( first == '"' || first == '\'' ) { int indexOfLast = text . length ( ) - 1 ; char last = text . charAt ( indexOfLast ) ; if ( last == first ) { text = text . substring ( 1 , indexO...
Remove any leading and trailing single - quotes or double - quotes from the supplied text .
33,434
public void write ( Document document ) { assert document != null ; ++ count ; ++ totalCount ; if ( count > maxDocumentsPerFile ) { close ( ) ; count = 1 ; } try { if ( stream == null ) { ++ fileCount ; String suffix = StringUtil . justifyRight ( Long . toString ( fileCount ) , BackupService . NUM_CHARS_IN_FILENAME_SUF...
Append the supplied document to the files .
33,435
public Query constrainedBy ( Constraint constraint ) { return new Query ( source , constraint , orderings ( ) , columns , getLimits ( ) , distinct ) ; }
Create a copy of this query but one that uses the supplied constraint .
33,436
public Query orderedBy ( List < Ordering > orderings ) { return new Query ( source , constraint , orderings , columns , getLimits ( ) , distinct ) ; }
Create a copy of this query but one whose results should be ordered by the supplied orderings .
33,437
public Query returning ( List < Column > columns ) { return new Query ( source , constraint , orderings ( ) , columns , getLimits ( ) , distinct ) ; }
Create a copy of this query but that returns results with the supplied columns .
33,438
public Query adding ( Column ... columns ) { List < Column > newColumns = null ; if ( this . columns != null ) { newColumns = new ArrayList < Column > ( this . columns ) ; for ( Column column : columns ) { newColumns . add ( column ) ; } } else { newColumns = Arrays . asList ( columns ) ; } return new Query ( source , ...
Create a copy of this query but that returns results that include the columns specified by this query as well as the supplied columns .
33,439
private void getCredentials ( ) { jcrService . getUserName ( new BaseCallback < String > ( ) { public void onSuccess ( String name ) { showMainForm ( name ) ; } } ) ; }
Checks user s credentials .
33,440
public void loadNodeSpecifiedByURL ( ) { repositoriesList . select ( jcrURL . getRepository ( ) , jcrURL . getWorkspace ( ) , jcrURL . getPath ( ) , true ) ; }
Reconstructs URL and points browser to the requested node path .
33,441
public void showMainForm ( String userName ) { align ( ) ; changeUserName ( userName ) ; mainForm . addMember ( header ) ; mainForm . addMember ( repositoryHeader ) ; mainForm . addMember ( viewPort ) ; mainForm . addMember ( strut ( 30 ) ) ; mainForm . addMember ( footer ) ; setLayoutWidth ( LAYOUT_WIDTH ) ; loadData ...
Shows main page for the logged in user .
33,442
public void changeRepositoryInURL ( String name , boolean changeHistory ) { jcrURL . setRepository ( name ) ; if ( changeHistory ) { htmlHistory . newItem ( jcrURL . toString ( ) , false ) ; } }
Changes repository name in URL displayed by browser .
33,443
public void changeWorkspaceInURL ( String name , boolean changeHistory ) { jcrURL . setWorkspace ( name ) ; if ( changeHistory ) { htmlHistory . newItem ( jcrURL . toString ( ) , false ) ; } }
Changes workspace in the URL displayed by browser .
33,444
public void changePathInURL ( String path , boolean changeHistory ) { jcrURL . setPath ( path ) ; if ( changeHistory ) { htmlHistory . newItem ( jcrURL . toString ( ) , false ) ; } }
Changes node path in the URL displayed by browser .
33,445
public void showRepositories ( Collection < RepositoryName > names ) { repositoriesList . show ( names ) ; display ( repositoriesList ) ; this . hideRepository ( ) ; }
Displays list of availables repositories .
33,446
public void displayContent ( String repository , String workspace , String path , boolean changeHistory ) { contents . show ( repository , workspace , path , changeHistory ) ; displayRepository ( repository ) ; display ( contents ) ; changeRepositoryInURL ( repository , changeHistory ) ; }
Displays node for the given repository workspace and path .
33,447
public int removeAllChildren ( Node node ) throws RepositoryException { isNotNull ( node , "node" ) ; int childrenRemoved = 0 ; NodeIterator iter = node . getNodes ( ) ; while ( iter . hasNext ( ) ) { Node child = iter . nextNode ( ) ; child . remove ( ) ; ++ childrenRemoved ; } return childrenRemoved ; }
Remove all children from the specified node
33,448
public Node getNode ( Node node , String relativePath , boolean required ) throws RepositoryException { isNotNull ( node , "node" ) ; isNotNull ( relativePath , "relativePath" ) ; Node result = null ; try { result = node . getNode ( relativePath ) ; } catch ( PathNotFoundException e ) { if ( required ) { throw e ; } } ...
Get the node under a specified node at a location defined by the specified relative path . If node is required then a problem is created and added to the Problems list .
33,449
public String getReadable ( Node node ) { if ( node == null ) return "" ; try { return node . getPath ( ) ; } catch ( RepositoryException err ) { return node . toString ( ) ; } }
Get the readable string form for a specified node .
33,450
public Node findOrCreateNode ( Session session , String path , String nodeType ) throws RepositoryException { return findOrCreateNode ( session , path , nodeType , nodeType ) ; }
Get or create a node at the specified path and node type .
33,451
public Node findOrCreateChild ( Node parent , String name ) throws RepositoryException { return findOrCreateChild ( parent , name , null ) ; }
Get or create a node with the specified node under the specified parent node .
33,452
public Node findOrCreateChild ( Node parent , String name , String nodeType ) throws RepositoryException { return findOrCreateNode ( parent , name , nodeType , nodeType ) ; }
Get or create a node with the specified node and node type under the specified parent node .
33,453
public void onEachNode ( Session session , boolean includeSystemNodes , NodeOperation operation ) throws Exception { Node node = session . getRootNode ( ) ; operation . run ( node ) ; NodeIterator iter = node . getNodes ( ) ; while ( iter . hasNext ( ) ) { Node child = iter . nextNode ( ) ; if ( ! includeSystemNodes &&...
Execute the supplied operation on each node in the workspace accessible by the supplied session .
33,454
public List < AstNode > getChildrenForType ( AstNode astNode , String nodeType ) { CheckArg . isNotNull ( astNode , "astNode" ) ; CheckArg . isNotNull ( nodeType , "nodeType" ) ; List < AstNode > childrenOfType = new ArrayList < AstNode > ( ) ; for ( AstNode child : astNode . getChildren ( ) ) { if ( hasMixinType ( chi...
Utility method to obtain the children of a given node that match the given type
33,455
private List < AbstractJcrNode > findOutputNodes ( AbstractJcrNode rootOutputNode ) throws RepositoryException { if ( rootOutputNode . isNew ( ) ) { return Arrays . asList ( rootOutputNode ) ; } List < AbstractJcrNode > nodes = new ArrayList < AbstractJcrNode > ( ) ; NodeIterator childrenIt = rootOutputNode . getNodesI...
Finds the top nodes which have been created during the sequencing process based on the original output node . It is important that this is called before the session is saved because it uses the new flag .
33,456
private void removeExistingOutputNodes ( AbstractJcrNode parentOfOutput , String outputNodeName , String selectedPath , String logMsg ) throws RepositoryException { if ( TRACE ) { LOGGER . trace ( "Looking under '{0}' for existing output to be removed for {1}" , parentOfOutput . getPath ( ) , logMsg ) ; } NodeIterator ...
Remove any existing nodes that were generated by previous sequencing operations of the node at the selected path .
33,457
private boolean contentExists ( BinaryKey key , boolean alive ) throws BinaryStoreException { try { String query = "SELECT payload from modeshape.binary where cid='" + key . toString ( ) + "'" ; query = alive ? query + " and usage=1;" : query + " and usage = 0;" ; ResultSet rs = session . execute ( query ) ; return rs ...
Test content for existence .
33,458
private ByteBuffer buffer ( InputStream stream ) throws IOException { stream . reset ( ) ; ByteArrayOutputStream bout = new ByteArrayOutputStream ( ) ; IoUtil . write ( stream , bout ) ; return ByteBuffer . wrap ( bout . toByteArray ( ) ) ; }
Converts input stream into ByteBuffer .
33,459
public static Map < SelectorName , SelectorName > getSelectorAliasesByName ( Visitable visitable ) { final Map < SelectorName , SelectorName > result = new HashMap < SelectorName , SelectorName > ( ) ; Visitors . visitAll ( visitable , new Visitors . AbstractVisitor ( ) { public void visit ( AllNodes allNodes ) { if ( ...
Get a map of the selector aliases keyed by their names .
33,460
public String getComment ( int index ) { if ( comments == null || index < 0 || index >= comments . size ( ) ) { throw new IllegalArgumentException ( "Not a valid comment index: " + index ) ; } return comments . elementAt ( index ) ; }
Returns the index th comment retrieved from the file .
33,461
protected boolean hasPrivileges ( Privilege [ ] privileges ) { for ( Privilege p : privileges ) { if ( ! contains ( this . privileges , p ) ) { return false ; } } return true ; }
Tests given privileges .
33,462
protected boolean addIfNotPresent ( Privilege [ ] privileges ) { ArrayList < Privilege > list = new ArrayList < Privilege > ( ) ; Collections . addAll ( list , privileges ) ; boolean res = combineRecursively ( list , privileges ) ; this . privileges . addAll ( list ) ; return res ; }
Adds specified privileges to this entry .
33,463
protected boolean combineRecursively ( List < Privilege > list , Privilege [ ] privileges ) { boolean res = false ; for ( Privilege p : privileges ) { if ( p . isAggregate ( ) ) { res = combineRecursively ( list , p . getAggregatePrivileges ( ) ) ; } else if ( ! contains ( list , p ) ) { list . add ( p ) ; res = true ;...
Adds specified privileges to the given list .
33,464
protected NodeSequence createNodeSequenceForSource ( QueryCommand originalQuery , QueryContext context , PlanNode sourceNode , Columns columns , QuerySources sources ) { for ( PlanNode indexNode : sourceNode . getChildren ( ) ) { if ( indexNode . getType ( ) != Type . INDEX ) continue ; IndexPlan index = indexNode . ge...
Create a node sequence for the given source .
33,465
protected NodeSequence createNodeSequenceForSource ( QueryCommand originalQuery , QueryContext context , PlanNode sourceNode , IndexPlan index , Columns columns , QuerySources sources ) { if ( index . getProviderName ( ) == null ) { String name = index . getName ( ) ; String pathStr = ( String ) index . getParameters (...
Create a node sequence for the given index
33,466
private String getHash ( ) { try { Node contentNode = getContextNode ( ) ; Property data = contentNode . getProperty ( Property . JCR_DATA ) ; Binary bin = ( Binary ) data . getBinary ( ) ; return String . format ( "{%s}%s" , HASH_ALGORITHM , bin . getHexHash ( ) ) ; } catch ( RepositoryException e ) { return "" ; } }
Get the hexadecimal form of the SHA - 1 hash of the contents .
33,467
public void setWorkspaceNames ( String [ ] values ) { col2 . combo . setValueMap ( values ) ; if ( values . length > 0 ) { col2 . combo . setValue ( values [ 0 ] ) ; } }
Assigns workspace names to the combo box into column 2 .
33,468
private Set < String > versionLabelsFor ( Version version ) throws RepositoryException { if ( ! version . getParent ( ) . equals ( this ) ) { throw new VersionException ( JcrI18n . invalidVersion . text ( version . getPath ( ) , getPath ( ) ) ) ; } String versionId = version . getIdentifier ( ) ; PropertyIterator iter ...
Returns the version labels that point to the given version
33,469
private int computeCredsHashCode ( Credentials c ) { if ( c instanceof SimpleCredentials ) { return computeSimpleCredsHashCode ( ( SimpleCredentials ) c ) ; } return c . hashCode ( ) ; }
Returns Credentials instance hash code . Handles instances of SimpleCredentials in a special way .
33,470
public int getSameNameSiblingIndex ( ) { int snsIndex = 1 ; if ( this . parent == null ) { return snsIndex ; } for ( AstNode sibling : this . parent . getChildren ( ) ) { if ( sibling == this ) { break ; } if ( sibling . getName ( ) . equals ( this . name ) ) { ++ snsIndex ; } } return snsIndex ; }
Get the current same - name - sibling index .
33,471
public String getAbsolutePath ( ) { StringBuilder pathBuilder = new StringBuilder ( "/" ) . append ( this . getName ( ) ) ; AstNode parent = this . getParent ( ) ; while ( parent != null ) { pathBuilder . insert ( 0 , "/" + parent . getName ( ) ) ; parent = parent . getParent ( ) ; } return pathBuilder . toString ( ) ;...
Get the current path of this node
33,472
public AstNode setProperty ( String name , Object value ) { CheckArg . isNotNull ( name , "name" ) ; CheckArg . isNotNull ( value , "value" ) ; properties . put ( name , value ) ; return this ; }
Set the property with the given name to the supplied value . Any existing property with the same name will be replaced .
33,473
public AstNode setProperty ( String name , Object ... values ) { CheckArg . isNotNull ( name , "name" ) ; CheckArg . isNotNull ( values , "value" ) ; if ( values . length != 0 ) { properties . put ( name , Arrays . asList ( values ) ) ; } return this ; }
Set the property with the given name to the supplied values . If there is at least one value the new property will replace any existing property with the same name . This method does nothing if zero values are supplied .
33,474
protected String removeBracketsAndQuotes ( String text , Position position ) { return removeBracketsAndQuotes ( text , true , position ) ; }
Remove all leading and trailing single - quotes double - quotes or square brackets from the supplied text . If multiple properly - paired quotes or brackets are found they will all be removed .
33,475
protected String removeBracketsAndQuotes ( String text , boolean recursive , Position position ) { if ( text . length ( ) > 0 ) { char firstChar = text . charAt ( 0 ) ; switch ( firstChar ) { case '\'' : case '"' : if ( text . charAt ( text . length ( ) - 1 ) != firstChar ) { String msg = GraphI18n . expectingValidName...
Remove any leading and trailing single - quotes double - quotes or square brackets from the supplied text .
33,476
private String [ ] propertyDefs ( Node node ) throws RepositoryException { ArrayList < String > list = new ArrayList < > ( ) ; NodeType primaryType = node . getPrimaryNodeType ( ) ; PropertyDefinition [ ] defs = primaryType . getPropertyDefinitions ( ) ; for ( PropertyDefinition def : defs ) { if ( ! def . isProtected ...
Gets the list of properties available to the given node .
33,477
private AccessControlList findAccessList ( AccessControlManager acm , String path ) throws RepositoryException { AccessControlPolicy [ ] policy = acm . getPolicies ( path ) ; if ( policy != null && policy . length > 0 ) { return ( AccessControlList ) policy [ 0 ] ; } policy = acm . getEffectivePolicies ( path ) ; if ( ...
Searches access list for the given node .
33,478
private Collection < JcrProperty > getProperties ( String repository , String workspace , String path , Node node ) throws RepositoryException { ArrayList < PropertyDefinition > names = new ArrayList < > ( ) ; NodeType primaryType = node . getPrimaryNodeType ( ) ; PropertyDefinition [ ] defs = primaryType . getProperty...
Reads properties of the given node .
33,479
private String values ( PropertyDefinition pd , Property p ) throws RepositoryException { if ( p == null ) { return "N/A" ; } if ( pd . getRequiredType ( ) == PropertyType . BINARY ) { return "BINARY" ; } if ( ! p . isMultiple ( ) ) { return p . getString ( ) ; } return multiValue ( p ) ; }
Displays property value as string
33,480
private AccessControlEntry pick ( AccessControlList acl , String principal ) throws RepositoryException { for ( AccessControlEntry entry : acl . getAccessControlEntries ( ) ) { if ( entry . getPrincipal ( ) . getName ( ) . equals ( principal ) ) { return entry ; } } return null ; }
Picks access entry for the given principal .
33,481
private Privilege [ ] excludePrivilege ( Privilege [ ] privileges , JcrPermission permission ) { ArrayList < Privilege > list = new ArrayList < > ( ) ; for ( Privilege privilege : privileges ) { if ( ! privilege . getName ( ) . equalsIgnoreCase ( permission . getName ( ) ) ) { list . add ( privilege ) ; } } Privilege [...
Excludes given privilege .
33,482
private Privilege [ ] includePrivilege ( AccessControlManager acm , Privilege [ ] privileges , JcrPermission permission ) throws RepositoryException { ArrayList < Privilege > list = new ArrayList < > ( ) ; for ( Privilege privilege : privileges ) { if ( ! privilege . getName ( ) . equalsIgnoreCase ( permission . getNam...
Includes given privilege .
33,483
public static FileSystemBinaryStore create ( File directory , File trash ) { String key = directory . getAbsolutePath ( ) ; FileSystemBinaryStore store = INSTANCES . get ( key ) ; if ( store == null ) { store = trash != null ? new FileSystemBinaryStore ( directory , trash ) : new FileSystemBinaryStore ( directory ) ; F...
Creates a new FS binary store instance
33,484
protected void loadRemaining ( ) { if ( ! loadedAll ) { assert targetNumRowsInMemory >= 0L ; assert batchSize != null ; Batch batch = original . nextBatch ( ) ; boolean loadIntoMemory = inMemoryBatches != null && actualNumRowsInMemory < targetNumRowsInMemory ; while ( batch != null ) { long rows = loadBatch ( batch , l...
Load all of the remaining rows from the supplied sequence into the buffer .
33,485
public BinaryKey moveValue ( BinaryKey key , String source , String destination ) throws BinaryStoreException { final BinaryStore sourceStore ; if ( source == null ) { sourceStore = findBinaryStoreContainingKey ( key ) ; } else { sourceStore = selectBinaryStore ( source ) ; } if ( sourceStore == null || ! sourceStore ....
Move a value from one named store to another store
33,486
public void moveValue ( BinaryKey key , String destination ) throws BinaryStoreException { moveValue ( key , null , destination ) ; }
Move a BinaryKey to a named store
33,487
public BinaryStore findBinaryStoreContainingKey ( BinaryKey key ) { Iterator < Map . Entry < String , BinaryStore > > binaryStoreIterator = getNamedStoreIterator ( ) ; while ( binaryStoreIterator . hasNext ( ) ) { BinaryStore bs = binaryStoreIterator . next ( ) . getValue ( ) ; if ( bs . hasBinary ( key ) ) { return bs...
Get the named binary store that contains the key
33,488
private BinaryStore selectBinaryStore ( String hint ) { BinaryStore namedBinaryStore = null ; if ( hint != null ) { logger . trace ( "Selecting named binary store for hint: " + hint ) ; namedBinaryStore = namedStores . get ( hint ) ; } if ( namedBinaryStore == null ) { namedBinaryStore = getDefaultBinaryStore ( ) ; } l...
Select a named binary store for the given hint
33,489
public void start ( ) { if ( state == State . RUNNING ) return ; final Lock lock = this . lock . writeLock ( ) ; try { lock . lock ( ) ; this . state = State . STARTING ; ThreadFactory threadFactory = new NamedThreadFactory ( "modeshape-start-repo" ) ; repositoryStarterService = Executors . newCachedThreadPool ( thread...
Start this engine to make it available for use . This method does nothing if the engine is already running .
33,490
public Future < Boolean > shutdown ( boolean forceShutdownOfAllRepositories ) { if ( ! forceShutdownOfAllRepositories ) { final Lock lock = this . lock . readLock ( ) ; try { lock . lock ( ) ; for ( JcrRepository repository : repositories . values ( ) ) { switch ( repository . getState ( ) ) { case NOT_RUNNING : case S...
Shutdown this engine optionally stopping all still - running repositories .
33,491
protected boolean doShutdown ( ) { if ( state == State . NOT_RUNNING ) { LOGGER . debug ( "Engine already shut down." ) ; return true ; } LOGGER . debug ( "Shutting down engine..." ) ; final Lock lock = this . lock . writeLock ( ) ; try { lock . lock ( ) ; state = State . STOPPING ; if ( ! repositories . isEmpty ( ) ) ...
Do the work of shutting down this engine and its repositories .
33,492
public Map < String , State > getRepositories ( ) { checkRunning ( ) ; Map < String , State > results = new HashMap < String , State > ( ) ; final Lock lock = this . lock . readLock ( ) ; try { lock . lock ( ) ; for ( JcrRepository repository : repositories . values ( ) ) { results . put ( repository . getName ( ) , re...
Get an instantaneous snapshot of the JCR repositories and their state . Note that the results are accurate only when this methods returns .
33,493
protected Collection < JcrRepository > repositories ( ) { if ( this . state == State . RUNNING ) { final Lock lock = this . lock . readLock ( ) ; try { lock . lock ( ) ; return new ArrayList < JcrRepository > ( repositories . values ( ) ) ; } finally { lock . unlock ( ) ; } } return Collections . emptyList ( ) ; }
Returns a copy of the repositories . Note that when returned not all repositories may be active .
33,494
protected JcrRepository deploy ( final RepositoryConfiguration repositoryConfiguration , final String repositoryKey ) throws ConfigurationException , RepositoryException { CheckArg . isNotNull ( repositoryConfiguration , "repositoryConfiguration" ) ; checkRunning ( ) ; final String repoName = repositoryKey != null ? re...
Deploy a new repository with the given configuration . This method will fail if this engine already contains a repository with the specified name .
33,495
public Status validateRequest ( final NormalisedPath requestPath , HttpServerExchange exchange , OpenApiOperation openApiOperation ) { requireNonNull ( requestPath , "A request path is required" ) ; requireNonNull ( exchange , "An exchange is required" ) ; requireNonNull ( openApiOperation , "An OpenAPI operation is re...
Validate the request against the given API operation
33,496
public Status validateResponse ( final HttpServerExchange exchange , final SwaggerOperation swaggerOperation ) { requireNonNull ( exchange , "An exchange is required" ) ; requireNonNull ( swaggerOperation , "A swagger operation is required" ) ; io . swagger . models . Response swaggerResponse = swaggerOperation . getOp...
Validate the given response against the API operation .
33,497
public Status validate ( final Object value , final Property schema ) { return doValidate ( value , schema , null ) ; }
Validate the given value against the given property schema .
33,498
public Status validate ( final Object value , final Model schema , SchemaValidatorsConfig config ) { return doValidate ( value , schema , config ) ; }
Validate the given value against the given model schema .
33,499
public Status validateResponseContent ( Object responseContent , OpenApiOperation openApiOperation , String statusCode , String mediaTypeName ) { if ( responseContent instanceof String ) { responseContent = convertStrToObjTree ( ( String ) responseContent ) ; } JsonNode schema = getContentSchema ( openApiOperation , st...
validate a given response content object