idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
15,700 | public List < ItemState > getChildrenChanges ( String rootIdentifier , boolean forNodes ) { List < ItemState > children = forNodes ? childNodeStates . get ( rootIdentifier ) : childPropertyStates . get ( rootIdentifier ) ; return children == null ? new ArrayList < ItemState > ( ) : children ; } | Collect changes of all item direct childs . Including the item itself . |
15,701 | public ItemState getItemState ( String itemIdentifier , int state ) { return index . get ( new IDStateBasedKey ( itemIdentifier , state ) ) ; } | Get ItemState by identifier and state . |
15,702 | public ItemState getItemState ( NodeData parentData , QPathEntry name , ItemType itemType ) throws IllegalPathException { if ( itemType != ItemType . UNKNOWN ) { return index . get ( new ParentIDQPathBasedKey ( parentData . getIdentifier ( ) , name , itemType ) ) ; } else { ItemState state = index . get ( new ParentIDQ... | Get ItemState by parent and item name . |
15,703 | public List < ItemState > getItemStates ( String itemIdentifier ) { List < ItemState > states = new ArrayList < ItemState > ( ) ; List < ItemState > currentStates = getAllStates ( ) ; for ( int i = 0 , length = currentStates . size ( ) ; i < length ; i ++ ) { ItemState state = currentStates . get ( i ) ; if ( state . g... | Gets items by identifier . |
15,704 | public ItemState findItemState ( String id , Boolean isPersisted , int ... states ) throws IllegalPathException { List < ItemState > allStates = getAllStates ( ) ; for ( int i = allStates . size ( ) - 1 ; i >= 0 ; i -- ) { ItemState istate = allStates . get ( i ) ; boolean byState = false ; if ( states != null ) { for ... | Search for an item state of item with given id and filter parameters . |
15,705 | private String checkIfFile ( Node node ) { return ResourceUtil . isFile ( node ) ? Boolean . TRUE . toString ( ) : Boolean . FALSE . toString ( ) ; } | Checks if node is file or folder . |
15,706 | private void onConnectionClosed ( ) { ConnectionEvent evt = new ConnectionEvent ( this , ConnectionEvent . CONNECTION_CLOSED ) ; for ( ConnectionEventListener listener : listeners ) { try { listener . connectionClosed ( evt ) ; } catch ( Exception e1 ) { LOG . warn ( "An error occurs while notifying the listener " + li... | Broadcasts the connection closed event |
15,707 | public PropertyDefinitionData [ ] readPropertyDefinitions ( NodeData nodeData ) throws NodeTypeReadException , RepositoryException { List < PropertyDefinitionData > propertyDefinitionDataList ; List < NodeData > childDefinitions = dataManager . getChildNodesData ( nodeData ) ; InternalQName name = null ; if ( childDefi... | Read PropertyDefinitionData of node type . |
15,708 | public static String getPath ( String relativePath , String backupDirCanonicalPath ) throws MalformedURLException { String path = "file:" + backupDirCanonicalPath + "/" + relativePath ; URL urlPath = new URL ( resolveFileURL ( path ) ) ; return urlPath . getFile ( ) ; } | Will be returned absolute path . |
15,709 | protected void rollback ( WorkspaceStorageConnection conn ) { try { if ( conn != null ) { conn . rollback ( ) ; } } catch ( IllegalStateException e ) { LOG . error ( "Can not rollback connection" , e ) ; } catch ( RepositoryException e ) { LOG . error ( "Can not rollback connection" , e ) ; } } | Rollback data . |
15,710 | private void cleanupSwapDirectory ( ) { PrivilegedAction < Void > action = new PrivilegedAction < Void > ( ) { public Void run ( ) { File [ ] files = containerConfig . spoolConfig . tempDirectory . listFiles ( ) ; if ( files != null && files . length > 0 ) { LOG . info ( "Some files have been found in the swap director... | Deletes all the files from the swap directory |
15,711 | protected void checkIntegrity ( WorkspaceEntry wsConfig , RepositoryEntry repConfig ) throws RepositoryConfigurationException { DatabaseStructureType dbType = DBInitializerHelper . getDatabaseType ( wsConfig ) ; for ( WorkspaceEntry wsEntry : repConfig . getWorkspaceEntries ( ) ) { if ( wsEntry . getName ( ) . equals (... | Checks if DataSources used in right manner . |
15,712 | private String validateDialect ( String confParam ) { for ( String dbType : DBConstants . DB_DIALECTS ) { if ( confParam . equals ( dbType ) ) { return dbType ; } } return DBConstants . DB_DIALECT_AUTO ; } | Validate dialect . |
15,713 | private String composeWorkspaceUniqueName ( String repositoryName , String workspaceName ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( repositoryName ) ; builder . append ( '/' ) ; builder . append ( workspaceName ) ; builder . append ( '/' ) ; return builder . toString ( ) ; } | Compose unique workspace name in global JCR instance . |
15,714 | private void waitForCoordinator ( ) { LOG . info ( "Waiting to be released by the coordinator" ) ; try { lock . await ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } } | Make the current node wait until being released by the coordinator |
15,715 | public static void configureCacheStore ( MappedParametrizedObjectEntry parameterEntry , String dataSourceParamName , String dataColumnParamName , String idColumnParamName , String timeColumnParamName , String dialectParamName ) throws RepositoryException { String dataSourceName = parameterEntry . getParameterValue ( da... | If a cache store is used then fills - in column types . If column type configured from jcr - configuration file then nothing is overridden . Parameters are injected into the given parameterEntry . |
15,716 | public final String getGroup ( ) { if ( fullGroupName != null ) { return fullGroupName ; } StringBuilder sb = new StringBuilder ( ) ; if ( ownerId != null ) { sb . append ( ownerId ) . append ( '-' ) ; } return fullGroupName = sb . append ( group == null ? id : group ) . toString ( ) ; } | This method is used for the grouping when its enabled . It will return the value of the group if it has been explicitly set otherwise it will return the value of the fullId |
15,717 | public long getGlobalDataSizeDirectly ( ) throws QuotaManagerException { long size = 0 ; for ( RepositoryQuotaManager rqm : rQuotaManagers . values ( ) ) { size += rqm . getRepositoryDataSizeDirectly ( ) ; } return size ; } | Calculates the global size by summing sized of all repositories . |
15,718 | private PathQueryNode createPathQueryNode ( SimpleNode node ) { root . setLocationNode ( factory . createPathQueryNode ( root ) ) ; node . childrenAccept ( this , root . getLocationNode ( ) ) ; return root . getLocationNode ( ) ; } | Creates the primary path query node . |
15,719 | public static Calendar parse ( String dateString ) throws ValueFormatException { try { return ISO8601 . parseEx ( dateString ) ; } catch ( ParseException e ) { throw new ValueFormatException ( "Can not parse date from [" + dateString + "]" , e ) ; } catch ( NumberFormatException e ) { throw new ValueFormatException ( "... | Parse string using possible formats list . |
15,720 | public static long createHash ( byte [ ] data ) { long h = 0 ; byte [ ] res ; synchronized ( digestFunction ) { res = digestFunction . digest ( data ) ; } for ( int i = 0 ; i < 4 ; i ++ ) { h <<= 8 ; h |= ( ( int ) res [ i ] ) & 0xFF ; } return h ; } | Generates a digest based on the contents of an array of bytes . |
15,721 | public static void backup ( File storageDir , Connection jdbcConn , Map < String , String > scripts ) throws BackupException { Exception exc = null ; ZipObjectWriter contentWriter = null ; ZipObjectWriter contentLenWriter = null ; try { contentWriter = new ZipObjectWriter ( PrivilegedFileHelper . zipOutputStream ( new ... | Backup tables . |
15,722 | private static void dumpTable ( Connection jdbcConn , String tableName , String script , File storageDir , ZipObjectWriter contentWriter , ZipObjectWriter contentLenWriter ) throws IOException , SQLException { SecurityManager security = System . getSecurityManager ( ) ; if ( security != null ) { security . checkPermiss... | Dump table . |
15,723 | BackupChain startBackup ( BackupConfig config , BackupJobListener jobListener ) throws BackupOperationException , BackupConfigurationException , RepositoryException , RepositoryConfigurationException { validateBackupConfig ( config ) ; Calendar startTime = Calendar . getInstance ( ) ; File dir = FileNameProducer . gene... | Internally used for call with job listener from scheduler . |
15,724 | private void validateBackupConfig ( RepositoryBackupConfig config ) throws BackupConfigurationException { if ( config . getIncrementalJobPeriod ( ) < 0 ) { throw new BackupConfigurationException ( "The parameter 'incremental job period' can not be negative." ) ; } if ( config . getIncrementalJobNumber ( ) < 0 ) { throw... | Initialize backup chain to workspace backup . |
15,725 | private void readParamsFromFile ( ) { PropertiesParam pps = initParams . getPropertiesParam ( BACKUP_PROPERTIES ) ; backupDir = pps . getProperty ( BACKUP_DIR ) ; fullBackupType = pps . getProperty ( FULL_BACKUP_TYPE ) == null ? DEFAULT_VALUE_FULL_BACKUP_TYPE : pps . getProperty ( FULL_BACKUP_TYPE ) ; defIncrPeriod = p... | Get parameters which passed from the file . |
15,726 | public synchronized void endLog ( ) { if ( ! finalized ) { finishedTime = Calendar . getInstance ( ) ; finalized = true ; logWriter . writeEndLog ( ) ; try { InputStream in = PrivilegedFileHelper . fileInputStream ( log ) ; File dest = new File ( config . getBackupDir ( ) + File . separator + log . getName ( ) ) ; if (... | Finalize log . |
15,727 | public Response delete ( Session session , String path , String lockTokenHeader ) { try { if ( lockTokenHeader == null ) { lockTokenHeader = "" ; } Item item = session . getItem ( path ) ; if ( item . isNode ( ) ) { Node node = ( Node ) item ; if ( node . isLocked ( ) ) { String nodeLockToken = node . getLock ( ) . get... | Webdav Delete method implementation . |
15,728 | protected void spoolInputStream ( ) { if ( spoolFile != null || data != null ) { return ; } byte [ ] buffer = new byte [ 0 ] ; byte [ ] tmpBuff = new byte [ 2048 ] ; int read = 0 ; int len = 0 ; SpoolFile sf = null ; OutputStream sfout = null ; try { while ( ( read = stream . read ( tmpBuff ) ) >= 0 ) { if ( sfout != n... | Spool ValueData temp InputStream to a temp File . |
15,729 | private void removeSpoolFile ( ) throws IOException { if ( spoolFile != null ) { if ( spoolFile instanceof SpoolFile ) { ( spoolFile ) . release ( this ) ; } if ( PrivilegedFileHelper . exists ( spoolFile ) ) { if ( ! PrivilegedFileHelper . delete ( spoolFile ) ) { spoolConfig . fileCleaner . addFile ( spoolFile ) ; if... | Delete current spool file . |
15,730 | public boolean validateNodeType ( ) { boolean hasValidated = false ; if ( primaryItemName != null ) { if ( primaryItemName . length ( ) <= 0 ) { primaryItemName = null ; hasValidated = true ; } } if ( declaredSupertypeNames == null ) { declaredSupertypeNames = new ArrayList < String > ( ) ; hasValidated = true ; } else... | validateNodeType method checks the value bean for each valid filed |
15,731 | public Value [ ] getValueArray ( ) throws RepositoryException { Value [ ] values = new Value [ propertyData . getValues ( ) . size ( ) ] ; for ( int i = 0 ; i < values . length ; i ++ ) { values [ i ] = valueFactory . loadValue ( propertyData . getValues ( ) . get ( i ) , propertyData . getType ( ) ) ; } return values ... | Copies property values into array . |
15,732 | public String dump ( ) { StringBuilder vals = new StringBuilder ( "Property " ) ; try { vals = new StringBuilder ( getPath ( ) ) . append ( " values: " ) ; for ( int i = 0 ; i < getValueArray ( ) . length ; i ++ ) { vals . append ( ValueDataUtil . getString ( ( ( BaseValue ) getValueArray ( ) [ i ] ) . getInternalData ... | Get info about property values . |
15,733 | public void setParentId ( String parentId ) { this . parentId = ( parentId == null || parentId . equals ( "" ) ? null : parentId ) ; setGroupName ( groupName ) ; } | Sets new parenId and refresh groupId . |
15,734 | public void skip ( long n ) throws IllegalArgumentException , NoSuchElementException { if ( n < 0 ) { throw new IllegalArgumentException ( "skip(" + n + ")" ) ; } for ( long i = 0 ; i < n ; i ++ ) { next ( ) ; } } | Skips the given number of elements . |
15,735 | public static List < File > listFiles ( File srcPath ) throws IOException { List < File > result = new ArrayList < File > ( ) ; if ( ! srcPath . isDirectory ( ) ) { throw new IOException ( srcPath . getAbsolutePath ( ) + " is a directory" ) ; } for ( File subFile : srcPath . listFiles ( ) ) { result . add ( subFile ) ;... | Returns the files list of whole directory including its sub directories . |
15,736 | public static void copyDirectory ( File srcPath , File dstPath ) throws IOException { if ( srcPath . isDirectory ( ) ) { if ( ! dstPath . exists ( ) ) { dstPath . mkdirs ( ) ; } String files [ ] = srcPath . list ( ) ; for ( int i = 0 ; i < files . length ; i ++ ) { copyDirectory ( new File ( srcPath , files [ i ] ) , n... | Copy directory . |
15,737 | public static void removeDirectory ( File dir ) throws IOException { if ( dir . isDirectory ( ) ) { for ( File subFile : dir . listFiles ( ) ) { removeDirectory ( subFile ) ; } if ( ! dir . delete ( ) ) { throw new IOException ( "Can't remove folder : " + dir . getCanonicalPath ( ) ) ; } } else { if ( ! dir . delete ( ... | Remove directory . |
15,738 | private static void compressDirectory ( String relativePath , File srcPath , ZipOutputStream zip ) throws IOException { if ( srcPath . isDirectory ( ) ) { zip . putNextEntry ( new ZipEntry ( relativePath + "/" + srcPath . getName ( ) + "/" ) ) ; zip . closeEntry ( ) ; String files [ ] = srcPath . list ( ) ; for ( int i... | Compress files and directories . |
15,739 | public static void deleteDstAndRename ( File srcFile , File dstFile ) throws IOException { if ( dstFile . exists ( ) ) { if ( ! dstFile . delete ( ) ) { throw new IOException ( "Cannot delete " + dstFile ) ; } } renameFile ( srcFile , dstFile ) ; } | Rename file . Trying to remove destination first . If file can t be renamed in standard way the coping data will be used instead . |
15,740 | public static void renameFile ( File srcFile , File dstFile ) throws IOException { if ( ! srcFile . renameTo ( dstFile ) ) { InputStream in = null ; OutputStream out = null ; try { in = new FileInputStream ( srcFile ) ; out = new FileOutputStream ( dstFile ) ; transfer ( in , out ) ; } catch ( IOException ioe ) { IOExc... | Rename file . If file can t be renamed in standard way the coping data will be used instead . |
15,741 | public static long getSize ( File dir ) { long size = 0 ; for ( File file : dir . listFiles ( ) ) { if ( file . isFile ( ) ) { size += file . length ( ) ; } else { size += getSize ( file ) ; } } return size ; } | Returns the size of directory including all subfolders . |
15,742 | protected void removeWorkspace ( ManageableRepository mr , String workspaceName ) throws RepositoryException { boolean isExists = false ; for ( String wsName : mr . getWorkspaceNames ( ) ) if ( workspaceName . equals ( wsName ) ) { isExists = true ; break ; } if ( isExists ) { if ( ! mr . canRemoveWorkspace ( workspace... | Remove workspace . |
15,743 | private void removeChildrenItems ( JDBCStorageConnection conn , ResultSet resultSet ) throws SQLException , IllegalNameException , IllegalStateException , UnsupportedOperationException , InvalidItemStateException , RepositoryException { String parentId = resultSet . getString ( DBConstants . COLUMN_ID ) ; String select... | Removes all children items . |
15,744 | private void loadScript ( Node node ) throws Exception { ResourceId key = new NodeScriptKey ( repository . getConfiguration ( ) . getName ( ) , workspaceName , node ) ; ObjectFactory < AbstractResourceDescriptor > resource = groovyScript2RestLoader . groovyPublisher . unpublishResource ( key ) ; if ( resource != null )... | Load script form supplied node . |
15,745 | private void unloadScript ( String path ) throws Exception { ResourceId key = new NodeScriptKey ( repository . getConfiguration ( ) . getName ( ) , workspaceName , path ) ; groovyScript2RestLoader . groovyPublisher . unpublishResource ( key ) ; } | Unload script . |
15,746 | private ExoContainer getContainer ( ) throws ResourceException { ExoContainer container = ExoContainerContext . getCurrentContainer ( ) ; if ( container instanceof RootContainer ) { String portalContainerName = portalContainer == null ? PortalContainer . DEFAULT_PORTAL_CONTAINER_NAME : portalContainer ; container = Roo... | Gets the container from the current context |
15,747 | public static ValueDataWrapper readValueData ( String cid , int type , int orderNumber , int version , final InputStream content , SpoolConfig spoolConfig ) throws IOException { ValueDataWrapper vdDataWrapper = new ValueDataWrapper ( ) ; byte [ ] buffer = new byte [ 0 ] ; byte [ ] spoolBuffer = new byte [ ValueFileIOHe... | Read value data from stream . |
15,748 | public static ValueDataWrapper readValueData ( int type , int orderNumber , File file , SpoolConfig spoolConfig ) throws IOException { ValueDataWrapper vdDataWrapper = new ValueDataWrapper ( ) ; long fileSize = file . length ( ) ; vdDataWrapper . size = fileSize ; if ( fileSize > spoolConfig . maxBufferSize ) { vdDataW... | Read value data from file . |
15,749 | public static PersistedValueData createValueData ( int type , int orderNumber , byte [ ] data ) throws IOException { switch ( type ) { case PropertyType . BINARY : case PropertyType . UNDEFINED : return new ByteArrayPersistedValueData ( orderNumber , data ) ; case PropertyType . BOOLEAN : return new BooleanPersistedVal... | Creates value data depending on its type . It avoids storing unnecessary bytes in memory every time . |
15,750 | private boolean isRecordAlreadyExistsException ( SQLException e ) { String err = e . toString ( ) ; if ( dialect . startsWith ( DBConstants . DB_DIALECT_MYSQL ) ) { return MYSQL_PK_CONSTRAINT_DETECT . matcher ( err ) . find ( ) ; } else if ( err . toLowerCase ( ) . toUpperCase ( ) . indexOf ( sqlConstraintPK . toLowerC... | Tell is it a RecordAlreadyExistsException . |
15,751 | public boolean isTextContent ( ) { try { return dataProperty ( ) . getType ( ) != PropertyType . BINARY ; } catch ( RepositoryException exc ) { LOG . error ( exc . getMessage ( ) , exc ) ; return false ; } } | if the content of node is text . |
15,752 | public QName createQName ( String strName ) { String [ ] parts = strName . split ( ":" ) ; if ( parts . length > 1 ) return new QName ( getNamespaceURI ( parts [ 0 ] ) , parts [ 1 ] , parts [ 0 ] ) ; else return new QName ( parts [ 0 ] ) ; } | Converts String into QName . |
15,753 | public String getNamespaceURI ( String prefix ) { String uri = null ; try { uri = namespaceRegistry . getURI ( prefix ) ; } catch ( NamespaceException exc ) { uri = namespaces . get ( prefix ) ; } catch ( RepositoryException exc ) { log . error ( exc . getMessage ( ) , exc ) ; } return uri ; } | Returns namespace URI . |
15,754 | public String getPrefix ( String namespaceURI ) { String prefix = null ; try { prefix = namespaceRegistry . getPrefix ( namespaceURI ) ; } catch ( NamespaceException exc ) { prefix = prefixes . get ( namespaceURI ) ; } catch ( RepositoryException exc ) { log . error ( exc . getMessage ( ) , exc ) ; } return prefix ; } | Returns namespace prefix . |
15,755 | public Iterator < String > getPrefixes ( String namespaceURI ) { List < String > list = new ArrayList < String > ( ) ; list . add ( getPrefix ( namespaceURI ) ) ; return list . iterator ( ) ; } | Returns the list of registered for this URI namespace prefixes . |
15,756 | private static Map < String , String [ ] > getSynonyms ( InputStream config ) throws IOException { try { Map < String , String [ ] > synonyms = new HashMap < String , String [ ] > ( ) ; Properties props = new Properties ( ) ; props . load ( config ) ; Iterator < Map . Entry < Object , Object > > it = props . entrySet (... | Reads the synonym properties file and returns the contents as a synonym Map . |
15,757 | private static void addSynonym ( String term , String synonym , Map < String , String [ ] > synonyms ) { term = term . toLowerCase ( ) ; String [ ] syns = synonyms . get ( term ) ; if ( syns == null ) { syns = new String [ ] { synonym } ; } else { String [ ] tmp = new String [ syns . length + 1 ] ; System . arraycopy (... | Adds a synonym definition to the map . |
15,758 | public Response uncheckout ( Session session , String path ) { try { Node node = session . getRootNode ( ) . getNode ( TextUtil . relativizePath ( path ) ) ; Version restoreVersion = node . getBaseVersion ( ) ; node . restore ( restoreVersion , true ) ; return Response . ok ( ) . header ( HttpHeaders . CACHE_CONTROL , ... | Webdav Uncheckout method implementation . |
15,759 | protected boolean isDbInitialized ( final Connection con ) { return SecurityHelper . doPrivilegedAction ( new PrivilegedAction < Boolean > ( ) { public Boolean run ( ) { return JDBCUtils . tableExists ( configTableName , con ) ; } } ) ; } | Check if config table already exists |
15,760 | public boolean aquire ( final Object resource , final ValueLockSupport lockHolder ) throws InterruptedException , IOException { final Thread myThread = Thread . currentThread ( ) ; final VDResource res = resources . get ( resource ) ; if ( res != null ) { if ( res . addUserLock ( myThread , lockHolder ) ) return false ... | Aquire ValueData resource . |
15,761 | public boolean release ( final Object resource ) throws IOException { final Thread myThread = Thread . currentThread ( ) ; final VDResource res = resources . get ( resource ) ; if ( res != null ) { if ( res . removeUserLock ( myThread ) ) { synchronized ( res . lock ) { res . lockSupport . unlock ( ) ; res . lock . not... | Release resource . |
15,762 | public PropertyData getProperty ( String name ) { return properties == null ? null : properties . get ( name ) ; } | Property data . |
15,763 | public PersistedPropertyData read ( ObjectReader in ) throws UnknownClassIdException , IOException { int key ; if ( ( key = in . readInt ( ) ) != SerializationConstants . PERSISTED_PROPERTY_DATA ) { throw new UnknownClassIdException ( "There is unexpected class [" + key + "]" ) ; } QPath qpath ; try { String sQPath = i... | Read and set PersistedPropertyData object data . |
15,764 | void addDocuments ( final Document [ ] docs ) throws IOException { final IndexWriter writer = getIndexWriter ( ) ; IOException ioExc = null ; try { for ( Document doc : docs ) { try { writer . addDocument ( doc ) ; } catch ( Throwable e ) { if ( ioExc == null ) { if ( e instanceof IOException ) { ioExc = ( IOException ... | Adds documents to this index and invalidates the shared reader . |
15,765 | synchronized void close ( ) { releaseWriterAndReaders ( ) ; if ( directory != null ) { try { directory . close ( ) ; } catch ( IOException e ) { directory = null ; } } } | Closes this index releasing all held resources . |
15,766 | protected void releaseWriterAndReaders ( ) { if ( indexWriter != null ) { try { indexWriter . close ( ) ; } catch ( IOException e ) { log . warn ( "Exception closing index writer: " + e . toString ( ) ) ; } indexWriter = null ; } if ( indexReader != null ) { try { indexReader . close ( ) ; } catch ( IOException e ) { l... | Releases all potentially held index writer and readers . |
15,767 | protected synchronized void invalidateSharedReader ( ) throws IOException { if ( readOnlyReader != null ) { readOnlyReader . release ( ) ; readOnlyReader = null ; } if ( sharedReader != null ) { sharedReader . release ( ) ; sharedReader = null ; } } | Closes the shared reader . |
15,768 | public String getQueryLanguage ( ) throws UnsupportedQueryException { if ( body . getChild ( 0 ) . getName ( ) . getNamespaceURI ( ) . equals ( "DAV:" ) && body . getChild ( 0 ) . getName ( ) . getLocalPart ( ) . equals ( "sql" ) ) { return "sql" ; } else if ( body . getChild ( 0 ) . getName ( ) . getNamespaceURI ( ) .... | Get query language . |
15,769 | public String getQuery ( ) throws UnsupportedQueryException { if ( body . getChild ( 0 ) . getName ( ) . getNamespaceURI ( ) . equals ( "DAV:" ) && body . getChild ( 0 ) . getName ( ) . getLocalPart ( ) . equals ( "sql" ) ) { return body . getChild ( 0 ) . getValue ( ) ; } else if ( body . getChild ( 0 ) . getName ( ) ... | Get query . |
15,770 | public synchronized void setMode ( IndexerIoMode mode ) { if ( this . mode != mode ) { log . info ( "Indexer io mode=" + mode ) ; this . mode = mode ; for ( IndexerIoModeListener listener : listeners ) { listener . onChangeMode ( mode ) ; } } } | Changes the current mode of the indexer . If the value has changes all the listeners will be notified |
15,771 | public void read ( ) throws IOException { SecurityHelper . doPrivilegedIOExceptionAction ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws Exception { dir . listAll ( ) ; names . clear ( ) ; indexes . clear ( ) ; if ( dir . fileExists ( name ) ) { InputStream in = new IndexInputStream ( dir ... | Reads the index infos . Before reading it checks if file exists |
15,772 | public void write ( ) throws IOException { SecurityHelper . doPrivilegedIOExceptionAction ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws Exception { if ( ! dirty ) { return null ; } OutputStream out = new IndexOutputStream ( dir . createOutput ( name + ".new" ) ) ; DataOutputStream dataOu... | Writes the index infos to disk if they are dirty . |
15,773 | private void rename ( String from , String to ) throws IOException { IndexOutputStream out = null ; IndexInputStream in = null ; try { out = new IndexOutputStream ( dir . createOutput ( to ) ) ; in = new IndexInputStream ( dir . openInput ( from ) ) ; DirectoryHelper . transfer ( in , out ) ; } finally { if ( in != nul... | Renames file by copying . |
15,774 | public void addName ( String name ) { if ( names . contains ( name ) ) { throw new IllegalArgumentException ( "already contains: " + name ) ; } indexes . add ( name ) ; names . add ( name ) ; dirty = true ; } | Adds a name to the index infos . |
15,775 | protected void setNames ( Set < String > names ) { this . names . clear ( ) ; this . indexes . clear ( ) ; this . names . addAll ( names ) ; this . indexes . addAll ( names ) ; dirty = false ; } | Sets new names clearing existing . It is thought to be used when list of indexes can be externally changed . |
15,776 | public void addPermissions ( String identity , String [ ] perm ) throws RepositoryException { for ( String p : perm ) { accessList . add ( new AccessControlEntry ( identity , p ) ) ; } } | Adds a set of permission types to a given identity |
15,777 | public void removePermissions ( String identity ) { for ( Iterator < AccessControlEntry > iter = accessList . iterator ( ) ; iter . hasNext ( ) ; ) { AccessControlEntry a = iter . next ( ) ; if ( a . getIdentity ( ) . equals ( identity ) ) iter . remove ( ) ; } } | Removes all the permissions of a given identity |
15,778 | public List < AccessControlEntry > getPermissionEntries ( ) { List < AccessControlEntry > list = new ArrayList < AccessControlEntry > ( ) ; for ( int i = 0 , length = accessList . size ( ) ; i < length ; i ++ ) { AccessControlEntry entry = accessList . get ( i ) ; list . add ( new AccessControlEntry ( entry . getIdenti... | Gives all the permission entries |
15,779 | public LocationStepQueryNode [ ] getPathSteps ( ) { if ( operands == null ) { return EMPTY ; } else { return ( LocationStepQueryNode [ ] ) operands . toArray ( new LocationStepQueryNode [ operands . size ( ) ] ) ; } } | Returns an array of all currently set location step nodes . |
15,780 | protected boolean isResidualMatch ( InternalQName itemName , T [ ] recipientDefinition ) { boolean containsResidual = false ; for ( int i = 0 ; i < recipientDefinition . length ; i ++ ) { if ( itemName . equals ( recipientDefinition [ i ] . getName ( ) ) ) return false ; else if ( Constants . JCR_ANY_NAME . equals ( re... | Return true if recipientDefinition contains Constants . JCR_ANY_NAME and doesn t contain definition with name itemName . |
15,781 | private Thread createThreadFindNodesCount ( final Reindexable reindexableComponent ) { return new Thread ( "Nodes count(" + handler . getContext ( ) . getWorkspaceName ( ) + ")" ) { public void run ( ) { try { if ( reindexableComponent != null ) { Long value = reindexableComponent . getNodesCount ( ) ; if ( value != nu... | Create thread finding count of nodes . |
15,782 | int numDocs ( ) throws IOException { if ( indexNames . size ( ) == 0 ) { return volatileIndex . getNumDocuments ( ) ; } else { CachingMultiIndexReader reader = getIndexReader ( ) ; try { return reader . numDocs ( ) ; } finally { reader . release ( ) ; } } } | Returns the number of documents in this index . |
15,783 | public void reindex ( ItemDataConsumer stateMgr ) throws IOException , RepositoryException { if ( stopped . get ( ) ) { throw new IllegalStateException ( "Can't invoke reindexing on closed index." ) ; } if ( online . get ( ) ) { throw new IllegalStateException ( "Can't invoke reindexing while index still online." ) ; }... | Recreates index by reindexing in runtime . |
15,784 | synchronized void update ( final Collection < String > remove , final Collection < Document > add ) throws IOException { if ( ! online . get ( ) ) { doUpdateOffline ( remove , add ) ; } else if ( modeHandler . getMode ( ) == IndexerIoMode . READ_WRITE && redoLog != null ) { doUpdateRW ( remove , add ) ; } else { doUpda... | Atomically updates the index by removing some documents and adding others . |
15,785 | private void doUpdateRW ( final Collection < String > remove , final Collection < Document > add ) throws IOException { if ( add . size ( ) > handler . getBufferSize ( ) ) { try { releaseMultiReader ( ) ; } catch ( IOException e ) { LOG . warn ( "unable to prepare index reader " + "for queries during update" , e ) ; } ... | For investigation purposes only |
15,786 | private void doUpdateOffline ( final Collection < String > remove , final Collection < Document > add ) throws IOException { SecurityHelper . doPrivilegedIOExceptionAction ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws Exception { for ( Iterator < String > it = remove . iterator ( ) ; it ... | Performs indexing while re - indexing is in progress |
15,787 | void addDocument ( Document doc ) throws IOException { update ( Collections . < String > emptyList ( ) , Arrays . asList ( new Document [ ] { doc } ) ) ; } | Adds a document to the index . |
15,788 | private void initMerger ( ) throws IOException { if ( merger == null ) { merger = new IndexMerger ( this ) ; merger . setMaxMergeDocs ( handler . getMaxMergeDocs ( ) ) ; merger . setMergeFactor ( handler . getMergeFactor ( ) ) ; merger . setMinMergeDocs ( handler . getMinMergeDocs ( ) ) ; for ( Object index : indexes )... | Initialize IndexMerger . |
15,789 | private void scheduleFlushTask ( ) { if ( flushTask != null ) { flushTask . cancel ( ) ; } FLUSH_TIMER . purge ( ) ; flushTask = new TimerTask ( ) { public void run ( ) { checkFlush ( ) ; } } ; FLUSH_TIMER . schedule ( flushTask , 0 , 1000 ) ; lastFlushTime = System . currentTimeMillis ( ) ; lastFileSystemFlushTime = S... | Cancel flush task and add new one |
15,790 | private void resetVolatileIndex ( ) throws IOException { volatileIndex = new VolatileIndex ( handler . getTextAnalyzer ( ) , handler . getSimilarity ( ) ) ; volatileIndex . setUseCompoundFile ( handler . getUseCompoundFile ( ) ) ; volatileIndex . setMaxFieldLength ( handler . getMaxFieldLength ( ) ) ; volatileIndex . s... | Resets the volatile index to a new instance . |
15,791 | private void commitVolatileIndex ( ) throws IOException { if ( volatileIndex . getNumDocuments ( ) > 0 ) { long time = 0 ; if ( LOG . isDebugEnabled ( ) ) { time = System . currentTimeMillis ( ) ; } CreateIndex create = new CreateIndex ( getTransactionId ( ) , null ) ; executeAndLog ( create ) ; executeAndLog ( new Vol... | Commits the volatile index to a persistent index . The new persistent index is added to the list of indexes but not written to disk . When this method returns a new volatile index has been created . |
15,792 | private void removeDeletable ( ) { String fileName = "deletable" ; try { if ( indexDir . fileExists ( fileName ) ) { indexDir . deleteFile ( fileName ) ; } } catch ( IOException e ) { LOG . warn ( "Unable to remove file 'deletable'." , e ) ; } } | Removes the deletable file if it exists . The file is not used anymore in Jackrabbit versions > = 1 . 5 . |
15,793 | protected void setReadOnly ( ) { if ( merger != null ) { merger . dispose ( ) ; merger = null ; } if ( flushTask != null ) { flushTask . cancel ( ) ; } FLUSH_TIMER . purge ( ) ; this . redoLog = null ; } | Sets mode to READ_ONLY discarding flush task |
15,794 | protected void setReadWrite ( ) throws IOException { synchronized ( updateMonitor ) { indexUpdateMonitor . setUpdateInProgress ( false , true ) ; updateMonitor . notifyAll ( ) ; releaseMultiReader ( ) ; } this . redoLog = new RedoLog ( indexDir ) ; redoLogApplied = redoLog . hasEntries ( ) ; Recovery . run ( this , red... | Sets mode to READ_WRITE initiating recovery process |
15,795 | public void refreshIndexList ( ) throws IOException { synchronized ( updateMonitor ) { releaseMultiReader ( ) ; Set < String > newList = new HashSet < String > ( indexNames . getNames ( ) ) ; Iterator < PersistentIndex > iterator = indexes . iterator ( ) ; while ( iterator . hasNext ( ) ) { PersistentIndex index = iter... | Refresh list of indexes . Used to be called asynchronously when list changes . New actual list is read from IndexInfos . |
15,796 | public synchronized void setOnline ( boolean isOnline , boolean dropStaleIndexes , boolean initMerger ) throws IOException { if ( online . get ( ) != isOnline ) { if ( isOnline ) { LOG . info ( "Setting index ONLINE ({})" , handler . getContext ( ) . getWorkspacePath ( true ) ) ; if ( modeHandler . getMode ( ) == Index... | Switches index mode |
15,797 | private boolean recoveryIndexFromCoordinator ( ) throws IOException { File indexDirectory = new File ( handler . getContext ( ) . getIndexDirectory ( ) ) ; try { IndexRecovery indexRecovery = handler . getContext ( ) . getIndexRecovery ( ) ; if ( ! indexRecovery . checkIndexReady ( ) ) { return false ; } indexRecovery ... | Retrieves index from other node . |
15,798 | private boolean rsyncRecoveryIndexFromCoordinator ( ) throws IOException { File indexDirectory = new File ( handler . getContext ( ) . getIndexDirectory ( ) ) ; RSyncConfiguration rSyncConfiguration = handler . getRsyncConfiguration ( ) ; try { IndexRecovery indexRecovery = handler . getContext ( ) . getIndexRecovery (... | Retrieves index from other node using rsync server . |
15,799 | public boolean hasDeletions ( ) throws CorruptIndexException , IOException { boolean result = false ; for ( PersistentIndex index : indexes ) { IndexWriter writer = index . getIndexWriter ( ) ; result |= writer . hasDeletions ( ) ; } return result ; } | Checks if index has deletions . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.