idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
15,800 | protected String createDefaultExcerpt ( String text , String excerptStart , String excerptEnd , String fragmentStart , String fragmentEnd , int maxLength ) throws IOException { StringReader reader = new StringReader ( text ) ; StringBuilder excerpt = new StringBuilder ( excerptStart ) ; excerpt . append ( fragmentStart... | Creates a default excerpt with the given text . |
15,801 | protected void putItem ( final ItemData data ) { cache . put ( new CacheId ( data . getIdentifier ( ) ) , new CacheValue ( data , System . currentTimeMillis ( ) + liveTime ) ) ; cache . put ( new CacheQPath ( data . getParentIdentifier ( ) , data . getQPath ( ) , ItemType . getItemType ( data ) ) , new CacheValue ( dat... | Put item in cache C . |
15,802 | protected ItemData getItem ( final String identifier ) { long start = System . currentTimeMillis ( ) ; try { final CacheId k = new CacheId ( identifier ) ; final CacheValue v = cache . get ( k ) ; if ( v != null ) { final ItemData c = v . getItem ( ) ; if ( v . getExpiredTime ( ) > System . currentTimeMillis ( ) ) { if... | Get item from cache C by item id . Checks is it expired calcs statistics . |
15,803 | public void setLiveTime ( long liveTime ) { writeLock . lock ( ) ; try { this . liveTime = liveTime ; } finally { writeLock . unlock ( ) ; } LOG . info ( name + " : set liveTime=" + liveTime + "ms. New value will be applied to items cached from this moment." ) ; } | Set liveTime of newly cached items . |
15,804 | protected void removeItem ( final ItemData item ) { final String itemId = item . getIdentifier ( ) ; cache . remove ( new CacheId ( itemId ) ) ; final CacheValue v2 = cache . remove ( new CacheQPath ( item . getParentIdentifier ( ) , item . getQPath ( ) , ItemType . getItemType ( item ) ) ) ; if ( v2 != null && ! v2 . ... | Remove item from cache C . |
15,805 | protected PropertyData removeChildProperty ( final String parentIdentifier , final String childIdentifier ) { final List < PropertyData > childProperties = propertiesCache . get ( parentIdentifier ) ; if ( childProperties != null ) { synchronized ( childProperties ) { for ( Iterator < PropertyData > i = childProperties... | Remove property by id if parent properties are cached in CP . |
15,806 | protected NodeData removeChildNode ( final String parentIdentifier , final String childIdentifier ) { final List < NodeData > childNodes = nodesCache . get ( parentIdentifier ) ; if ( childNodes != null ) { synchronized ( childNodes ) { for ( Iterator < NodeData > i = childNodes . iterator ( ) ; i . hasNext ( ) ; ) { N... | Remove child node by id if parent child nodes are cached in CN . |
15,807 | String dump ( ) { StringBuilder res = new StringBuilder ( ) ; for ( Map . Entry < CacheKey , CacheValue > ce : cache . entrySet ( ) ) { res . append ( ce . getKey ( ) . hashCode ( ) ) ; res . append ( "\t\t" ) ; res . append ( ce . getValue ( ) . getItem ( ) . getIdentifier ( ) ) ; res . append ( ", " ) ; res . append ... | For debug . |
15,808 | final protected void restore ( ) throws RepositoryRestoreExeption { try { stateRestore = REPOSITORY_RESTORE_STARTED ; startTime = Calendar . getInstance ( ) ; restoreRepository ( ) ; stateRestore = REPOSITORY_RESTORE_SUCCESSFUL ; endTime = Calendar . getInstance ( ) ; } catch ( Throwable t ) { stateRestore = REPOSITORY... | Restore repository . Provide information about start and finish process . |
15,809 | protected void removeRepository ( RepositoryService repositoryService , String repositoryName ) throws RepositoryException , RepositoryConfigurationException { ManageableRepository mr = null ; try { mr = repositoryService . getRepository ( repositoryName ) ; } catch ( RepositoryException e ) { if ( LOG . isTraceEnabled... | Remove repository . |
15,810 | private void closeAllSession ( ManageableRepository mr ) throws NoSuchWorkspaceException { for ( String wsName : mr . getWorkspaceNames ( ) ) { if ( ! mr . canRemoveWorkspace ( wsName ) ) { WorkspaceContainerFacade wc = mr . getWorkspaceContainer ( wsName ) ; SessionRegistry sessionRegistry = ( SessionRegistry ) wc . g... | Close all open session in repository |
15,811 | protected List < ItemState > findItemStates ( QPath itemPath ) { List < ItemState > istates = new ArrayList < ItemState > ( ) ; for ( ItemState istate : itemAddStates ) { if ( istate . getData ( ) . getQPath ( ) . equals ( itemPath ) ) istates . add ( istate ) ; } return istates ; } | Find item states . |
15,812 | protected ItemState findLastItemState ( QPath itemPath ) { for ( int i = itemAddStates . size ( ) - 1 ; i >= 0 ; i -- ) { ItemState istate = itemAddStates . get ( i ) ; if ( istate . getData ( ) . getQPath ( ) . equals ( itemPath ) ) return istate ; } return null ; } | Find last ItemState . |
15,813 | public List < NodeTypeData > read ( InputStream is ) throws RepositoryException { try { if ( is != null ) { CNDLexer lex = new CNDLexer ( new ANTLRInputStream ( is ) ) ; CommonTokenStream tokens = new CommonTokenStream ( lex ) ; CNDParser parser = new CNDParser ( tokens ) ; CNDParser . cnd_return r ; if ( lex . hasErro... | Method which reads input stream as compact node type definition string . If any namespaces are placed in stream they are registered through namespace registry . |
15,814 | protected void execute ( List < String > scripts ) throws SQLException { SecurityHelper . validateSecurityPermission ( JCRRuntimePermissions . MANAGE_REPOSITORY_PERMISSION ) ; boolean autoCommit = connection . getAutoCommit ( ) ; if ( autoCommit != this . autoCommit ) { connection . setAutoCommit ( this . autoCommit ) ... | Execute script on database . Set auto commit mode if needed . |
15,815 | private void initOrderedIterator ( ) { if ( orderedNodes != null ) { return ; } long time = 0 ; if ( LOG . isDebugEnabled ( ) ) { time = System . currentTimeMillis ( ) ; } ScoreNode [ ] [ ] nodes = ( ScoreNode [ ] [ ] ) scoreNodes . toArray ( new ScoreNode [ scoreNodes . size ( ) ] [ ] ) ; final Set < String > invalidI... | Initializes the NodeIterator in document order |
15,816 | public static File getFullBackupFile ( File restoreDir ) { Pattern p = Pattern . compile ( ".+\\.0" ) ; for ( File f : PrivilegedFileHelper . listFiles ( restoreDir , new FileFilter ( ) { public boolean accept ( File pathname ) { Pattern p = Pattern . compile ( ".+\\.[0-9]+" ) ; Matcher m = p . matcher ( pathname . get... | Returns file with full backup . In case of RDBMS backup it may be a directory . |
15,817 | public static List < File > getIncrementalFiles ( File restoreDir ) { ArrayList < File > list = new ArrayList < File > ( ) ; Pattern fullBackupPattern = Pattern . compile ( ".+\\.0" ) ; for ( File f : PrivilegedFileHelper . listFiles ( restoreDir , new FileFilter ( ) { public boolean accept ( File pathname ) { Pattern ... | Get list of incremental backup files . |
15,818 | public void incrementalRestore ( File incrementalBackupFile ) throws FileNotFoundException , IOException , ClassNotFoundException , RepositoryException { ObjectInputStream ois = null ; try { ois = new ObjectInputStream ( PrivilegedFileHelper . fileInputStream ( incrementalBackupFile ) ) ; while ( true ) { TransactionCh... | Perform incremental restore operation . |
15,819 | public long getNodeChangedSize ( String nodePath ) { Long delta = calculatedChangedNodesSize . get ( nodePath ) ; return delta == null ? 0 : delta ; } | Returns node data changed size if exists or zero otherwise . |
15,820 | public void merge ( ChangesItem changesItem ) { workspaceChangedSize += changesItem . getWorkspaceChangedSize ( ) ; for ( Entry < String , Long > changesEntry : changesItem . calculatedChangedNodesSize . entrySet ( ) ) { String nodePath = changesEntry . getKey ( ) ; Long currentDelta = changesEntry . getValue ( ) ; Lon... | Merges current changes with new one . |
15,821 | public static boolean isFile ( Node node ) { try { if ( ! node . isNodeType ( "nt:file" ) ) return false ; if ( ! node . getNode ( "jcr:content" ) . isNodeType ( "nt:resource" ) ) return false ; return true ; } catch ( RepositoryException exc ) { LOG . error ( exc . getMessage ( ) , exc ) ; return false ; } } | If the node is file . |
15,822 | public static boolean isVersion ( Node node ) { try { if ( node . isNodeType ( "nt:version" ) ) return true ; return false ; } catch ( RepositoryException exc ) { LOG . error ( exc . getMessage ( ) , exc ) ; return false ; } } | If the node is version . |
15,823 | private void validateNodeType ( NodeTypeData nodeType ) throws RepositoryException { if ( nodeType == null ) { throw new RepositoryException ( "NodeType object " + nodeType + " is null" ) ; } if ( nodeType . getName ( ) == null ) { throw new RepositoryException ( "NodeType implementation class " + nodeType . getClass (... | Check according the JSR - 170 |
15,824 | public Version version ( String versionName , boolean pool ) throws VersionException , RepositoryException { JCRName jcrVersionName = locationFactory . parseJCRName ( versionName ) ; VersionImpl version = ( VersionImpl ) dataManager . getItem ( nodeData ( ) , new QPathEntry ( jcrVersionName . getInternalName ( ) , 1 ) ... | For internal use . Doesn t check InvalidItemStateException . May return unpooled Version object . |
15,825 | void migrate ( ) throws RepositoryException { try { LOG . info ( "Migration started." ) ; moveOldStructure ( ) ; service . createStructure ( ) ; migrateGroups ( ) ; migrateMembershipTypes ( ) ; migrateUsers ( ) ; migrateProfiles ( ) ; migrateMemberships ( ) ; removeOldStructure ( ) ; LOG . info ( "Migration completed."... | Method that aggregates all needed migration operations in needed order . |
15,826 | boolean migrationRequired ( ) throws RepositoryException { Session session = service . getStorageSession ( ) ; try { if ( session . itemExists ( storagePathOld ) ) { return true ; } try { Node node = ( Node ) session . getItem ( service . getStoragePath ( ) ) ; return node . isNodeType ( JOS_ORGANIZATION_NODETYPE_OLD )... | Method to know if migration is need . |
15,827 | private void moveOldStructure ( ) throws Exception { ExtendedSession session = ( ExtendedSession ) service . getStorageSession ( ) ; try { if ( session . itemExists ( storagePathOld ) ) { return ; } else { session . move ( service . getStoragePath ( ) , storagePathOld , false ) ; session . save ( ) ; } } finally { sess... | Method for moving old storage into temporary location . |
15,828 | private void removeOldStructure ( ) throws RepositoryException { ExtendedSession session = ( ExtendedSession ) service . getStorageSession ( ) ; try { if ( session . itemExists ( storagePathOld ) ) { NodeIterator usersIter = ( ( ExtendedNode ) session . getItem ( usersStorageOld ) ) . getNodesLazily ( ) ; while ( users... | Method for removing old storage from temporary location . |
15,829 | private void migrateUsers ( ) throws Exception { Session session = service . getStorageSession ( ) ; try { if ( session . itemExists ( usersStorageOld ) ) { NodeIterator iterator = ( ( ExtendedNode ) session . getItem ( usersStorageOld ) ) . getNodesLazily ( ) ; UserHandlerImpl uh = ( ( UserHandlerImpl ) service . getU... | Method for users migration . |
15,830 | private void migrateGroups ( ) throws Exception { Session session = service . getStorageSession ( ) ; try { if ( session . itemExists ( groupsStorageOld ) ) { NodeIterator iterator = ( ( ExtendedNode ) session . getItem ( groupsStorageOld ) ) . getNodesLazily ( ) ; GroupHandlerImpl gh = ( ( GroupHandlerImpl ) service .... | Method for groups migration . Must be run after users and membershipTypes migration . |
15,831 | private void migrateGroups ( Node startNode ) throws Exception { NodeIterator iterator = ( ( ExtendedNode ) startNode ) . getNodesLazily ( ) ; GroupHandlerImpl gh = ( ( GroupHandlerImpl ) service . getGroupHandler ( ) ) ; while ( iterator . hasNext ( ) ) { Node oldGroupNode = iterator . nextNode ( ) ; gh . migrateGroup... | Method for groups migration . |
15,832 | private void migrateMembershipTypes ( ) throws Exception { Session session = service . getStorageSession ( ) ; try { if ( session . itemExists ( membershipTypesStorageOld ) ) { NodeIterator iterator = ( ( ExtendedNode ) session . getItem ( membershipTypesStorageOld ) ) . getNodesLazily ( ) ; MembershipTypeHandlerImpl m... | Method for membershipTypes migration . |
15,833 | private void migrateProfiles ( ) throws Exception { Session session = service . getStorageSession ( ) ; try { if ( session . itemExists ( usersStorageOld ) ) { NodeIterator iterator = ( ( ExtendedNode ) session . getItem ( usersStorageOld ) ) . getNodesLazily ( ) ; UserProfileHandlerImpl uph = ( ( UserProfileHandlerImp... | Method for profiles migration . |
15,834 | private void migrateMemberships ( ) throws Exception { Session session = service . getStorageSession ( ) ; try { if ( session . itemExists ( usersStorageOld ) ) { NodeIterator iterator = ( ( ExtendedNode ) session . getItem ( usersStorageOld ) ) . getNodesLazily ( ) ; MembershipHandlerImpl mh = ( ( MembershipHandlerImp... | Method for memberships migration . |
15,835 | protected void addBooleanValue ( Document doc , String fieldName , Object internalValue ) { doc . add ( createFieldWithoutNorms ( fieldName , internalValue . toString ( ) , PropertyType . BOOLEAN ) ) ; } | Adds the string representation of the boolean value to the document as the named field . |
15,836 | protected void addReferenceValue ( Document doc , String fieldName , Object internalValue ) { String uuid = internalValue . toString ( ) ; doc . add ( createFieldWithoutNorms ( fieldName , uuid , PropertyType . REFERENCE ) ) ; doc . add ( new Field ( FieldNames . PROPERTIES , FieldNames . createNamedValue ( fieldName ,... | Adds the reference value to the document as the named field . The value s string representation is added as the reference data . Additionally the reference data is stored in the index . |
15,837 | protected void addPathValue ( Document doc , String fieldName , Object pathString ) { doc . add ( createFieldWithoutNorms ( fieldName , pathString . toString ( ) , PropertyType . PATH ) ) ; } | Adds the path value to the document as the named field . The path value is converted to an indexable string value using the name space mappings with which this class has been created . |
15,838 | protected void addNameValue ( Document doc , String fieldName , Object internalValue ) { doc . add ( createFieldWithoutNorms ( fieldName , internalValue . toString ( ) , PropertyType . NAME ) ) ; } | Adds the name value to the document as the named field . The name value is converted to an indexable string treating the internal value as a qualified name and mapping the name space using the name space mappings with which this class has been created . |
15,839 | protected float getPropertyBoost ( InternalQName propertyName ) { if ( indexingConfig == null ) { return DEFAULT_BOOST ; } else { return indexingConfig . getPropertyBoost ( node , propertyName ) ; } } | Returns the boost value for the given property name . |
15,840 | protected void addNodeName ( Document doc , String namespaceURI , String localName ) throws RepositoryException { String name = mappings . getNamespacePrefixByURI ( namespaceURI ) + ":" + localName ; doc . add ( new Field ( FieldNames . LABEL , name , Field . Store . NO , Field . Index . NOT_ANALYZED_NO_NORMS ) ) ; if ... | Depending on the index format version adds one or two fields to the document for the node name . |
15,841 | protected long writeValue ( File file , ValueData value ) throws IOException { if ( value . isByteArray ( ) ) { return writeByteArrayValue ( file , value ) ; } else { return writeStreamedValue ( file , value ) ; } } | Write value to a file . |
15,842 | protected long writeByteArrayValue ( File file , ValueData value ) throws IOException { OutputStream out = new FileOutputStream ( file ) ; try { byte [ ] data = value . getAsByteArray ( ) ; out . write ( data ) ; return data . length ; } finally { out . close ( ) ; } } | Write value array of bytes to a file . |
15,843 | protected long writeStreamedValue ( File file , ValueData value ) throws IOException { long size ; if ( value instanceof StreamPersistedValueData ) { StreamPersistedValueData streamed = ( StreamPersistedValueData ) value ; if ( streamed . isPersisted ( ) ) { size = copyClose ( streamed . getAsStream ( ) , new FileOutpu... | Write streamed value to a file . |
15,844 | protected long writeOutput ( OutputStream out , ValueData value ) throws IOException { if ( value . isByteArray ( ) ) { byte [ ] buff = value . getAsByteArray ( ) ; out . write ( buff ) ; return buff . length ; } else { InputStream in ; if ( value instanceof StreamPersistedValueData ) { StreamPersistedValueData streame... | Stream value data to the output . |
15,845 | protected long copy ( InputStream in , OutputStream out ) throws IOException { boolean inFile = in instanceof FileInputStream && FileInputStream . class . equals ( in . getClass ( ) ) ; boolean outFile = out instanceof FileOutputStream && FileOutputStream . class . equals ( out . getClass ( ) ) ; if ( inFile && outFile... | Copy input to output data using NIO . |
15,846 | protected long copyClose ( InputStream in , OutputStream out ) throws IOException { try { try { return copy ( in , out ) ; } finally { in . close ( ) ; } } finally { out . close ( ) ; } } | Copy input to output data using NIO . Input and output streams will be closed after the operation . |
15,847 | public Response report ( Session session , String path , HierarchicalProperty body , Depth depth , String baseURI ) { try { Node node = ( Node ) session . getItem ( path ) ; WebDavNamespaceContext nsContext = new WebDavNamespaceContext ( session ) ; String strUri = baseURI + node . getPath ( ) ; URI uri = new URI ( Tex... | Webdav Report method implementation . |
15,848 | protected Set < QName > getProperties ( HierarchicalProperty body ) { HashSet < QName > properties = new HashSet < QName > ( ) ; HierarchicalProperty prop = body . getChild ( new QName ( "DAV:" , "prop" ) ) ; if ( prop == null ) { return properties ; } for ( int i = 0 ; i < prop . getChildren ( ) . size ( ) ; i ++ ) { ... | Returns the list of properties . |
15,849 | public void write ( List < NodeTypeData > nodeTypes , OutputStream os ) throws RepositoryException { OutputStreamWriter out = new OutputStreamWriter ( os ) ; try { for ( NodeTypeData nodeType : nodeTypes ) { printNamespaces ( nodeType , out ) ; printNodeTypeDeclaration ( nodeType , out ) ; } out . close ( ) ; } catch (... | Write given list of node types to output stream . |
15,850 | private void printNamespaces ( NodeTypeData nodeTypeData , OutputStreamWriter out ) throws RepositoryException , IOException { Set < String > namespaces = new HashSet < String > ( ) ; printNameNamespace ( nodeTypeData . getName ( ) , namespaces ) ; printNameNamespace ( nodeTypeData . getPrimaryItemName ( ) , namespaces... | Print namespaces to stream |
15,851 | private void printNodeTypeDeclaration ( NodeTypeData nodeTypeData , OutputStreamWriter out ) throws RepositoryException , IOException { out . write ( "[" + qNameToString ( nodeTypeData . getName ( ) ) + "] " ) ; InternalQName [ ] superTypes = nodeTypeData . getDeclaredSupertypeNames ( ) ; if ( superTypes != null && sup... | Method recursively print to output stream node type definition in cnd format . |
15,852 | private void printPropertyDeclaration ( PropertyDefinitionData propertyDefinition , OutputStreamWriter out ) throws IOException , RepositoryException { out . write ( "\r\n " ) ; out . write ( "- " + qNameToString ( propertyDefinition . getName ( ) ) ) ; out . write ( " (" + ExtendedPropertyType . nameFromValue ( prope... | Prints to output stream property definition in CND format |
15,853 | private void printChildDeclaration ( NodeDefinitionData nodeDefinition , OutputStreamWriter out ) throws IOException , RepositoryException { out . write ( "\r\n " ) ; out . write ( "+ " + qNameToString ( nodeDefinition . getName ( ) ) + " " ) ; InternalQName [ ] requiredTypes = nodeDefinition . getRequiredPrimaryTypes... | Print to output stream child node definition in CND format |
15,854 | public float getNodeBoost ( NodeData state ) { IndexingRule rule = getApplicableIndexingRule ( state ) ; if ( rule != null ) { return rule . getNodeBoost ( ) ; } return DEFAULT_BOOST ; } | Returns the boost for the node scope fulltext index field . |
15,855 | private PathExpression getCondition ( Node config ) throws IllegalNameException , RepositoryException { Node conditionAttr = config . getAttributes ( ) . getNamedItem ( "condition" ) ; if ( conditionAttr == null ) { return null ; } String conditionString = conditionAttr . getNodeValue ( ) ; int idx ; int axis ; Interna... | Gets the condition expression from the configuration . |
15,856 | public void remove ( ) throws IOException { if ( ( fileBuffer != null ) && PrivilegedFileHelper . exists ( fileBuffer ) ) { if ( ! PrivilegedFileHelper . delete ( fileBuffer ) ) { throw new IOException ( "Cannot remove file " + PrivilegedFileHelper . getAbsolutePath ( fileBuffer ) + " Close all streams." ) ; } } } | Remove buffer . |
15,857 | private void swapBuffers ( ) throws IOException { byte [ ] data = ( ( ByteArrayOutputStream ) out ) . toByteArray ( ) ; fileBuffer = PrivilegedFileHelper . createTempFile ( "decoderBuffer" , ".tmp" ) ; PrivilegedFileHelper . deleteOnExit ( fileBuffer ) ; out = new BufferedOutputStream ( PrivilegedFileHelper . fileOutpu... | Swap in - memory buffer with file . |
15,858 | public void logComment ( String message ) throws IOException { if ( reportContext . get ( ) != null ) { reportContext . get ( ) . addComment ( message ) ; } else { writeMessage ( message ) ; } } | Adds comment to log . |
15,859 | public void logDescription ( String description ) throws IOException { if ( reportContext . get ( ) != null ) { reportContext . get ( ) . addComment ( description ) ; } else { writeMessage ( description ) ; } } | Adds description to log . |
15,860 | public void logBrokenObjectAndSetInconsistency ( String brokenObject ) throws IOException { setInconsistency ( ) ; if ( reportContext . get ( ) != null ) { reportContext . get ( ) . addBrokenObject ( brokenObject ) ; } else { writeBrokenObject ( brokenObject ) ; } } | Adds detailed event to log . |
15,861 | public void logExceptionAndSetInconsistency ( String message , Throwable e ) throws IOException { setInconsistency ( ) ; if ( reportContext . get ( ) != null ) { reportContext . get ( ) . addLogException ( message , e ) ; } else { writeException ( message , e ) ; } } | Adds exception with full stack trace . |
15,862 | private String getIdColumn ( ) throws SQLException { try { return lockManagerEntry . getParameterValue ( ISPNCacheableLockManagerImpl . INFINISPAN_JDBC_CL_ID_COLUMN_NAME ) ; } catch ( RepositoryConfigurationException e ) { throw new SQLException ( e ) ; } } | Returns the column name which contain node identifier . |
15,863 | protected String getTableName ( ) throws SQLException { try { String dialect = getDialect ( ) ; String quote = "\"" ; if ( dialect . startsWith ( DBConstants . DB_DIALECT_MYSQL ) ) quote = "`" ; return quote + lockManagerEntry . getParameterValue ( ISPNCacheableLockManagerImpl . INFINISPAN_JDBC_TABLE_NAME ) + "_" + "L"... | Returns the name of LOCK table . |
15,864 | public File getNextFile ( ) { File nextFile = null ; try { String sNextName = generateName ( ) ; nextFile = new File ( backupSetDir . getAbsoluteFile ( ) + File . separator + sNextName ) ; if ( isFullBackup && isDirectoryForFullBackup ) { if ( ! PrivilegedFileHelper . exists ( nextFile ) ) { PrivilegedFileHelper . mkdi... | Get next file in backup set . |
15,865 | private String getStrDate ( Calendar c ) { int m = c . get ( Calendar . MONTH ) + 1 ; int d = c . get ( Calendar . DATE ) ; return "" + c . get ( Calendar . YEAR ) + ( m < 10 ? "0" + m : m ) + ( d < 10 ? "0" + d : d ) ; } | Returns date as String in format YYYYMMDD . |
15,866 | private String getStrTime ( Calendar c ) { int h = c . get ( Calendar . HOUR ) ; int m = c . get ( Calendar . MINUTE ) ; int s = c . get ( Calendar . SECOND ) ; return "" + ( h < 10 ? "0" + h : h ) + ( m < 10 ? "0" + m : m ) + ( s < 10 ? "0" + s : s ) ; } | Returns time as String in format HHMMSS . |
15,867 | void createStructure ( ) throws RepositoryException { Session session = getStorageSession ( ) ; try { Node storage = session . getRootNode ( ) . addNode ( storagePath . substring ( 1 ) , STORAGE_NODETYPE ) ; storage . addNode ( STORAGE_JOS_USERS , STORAGE_JOS_USERS_NODETYPE ) ; storage . addNode ( STORAGE_JOS_GROUPS , ... | Creates storage structure . |
15,868 | Session getStorageSession ( ) throws RepositoryException { try { ManageableRepository repository = getWorkingRepository ( ) ; String workspaceName = storageWorkspace ; if ( workspaceName == null ) { workspaceName = repository . getConfiguration ( ) . getDefaultWorkspaceName ( ) ; } return repository . getSystemSession ... | Return system Session to org - service storage workspace . For internal use only . |
15,869 | protected ManageableRepository getWorkingRepository ( ) throws RepositoryException , RepositoryConfigurationException { return repositoryName != null ? repositoryService . getRepository ( repositoryName ) : repositoryService . getCurrentRepository ( ) ; } | Returns working repository . If repository name is configured then it will be returned otherwise the current repository is used . |
15,870 | public JCRPath createJCRPath ( JCRPath parentLoc , String relPath ) throws RepositoryException { JCRPath addPath = parseNames ( relPath , false ) ; return parentLoc . add ( addPath ) ; } | Creates JCRPath from parent path and relPath |
15,871 | private boolean isNonspace ( String str , char ch ) throws RepositoryException { if ( ch == '|' ) { throw new RepositoryException ( "Illegal absPath: \"" + str + "\": The path entry contains an illegal char: \"" + ch + "\"" ) ; } return ! ( ( ch == '\t' ) || ( ch == '\n' ) || ( ch == '\f' ) || ( ch == '\r' ) || ( ch ==... | Some functions for JCRPath Validation |
15,872 | public boolean isAbsolute ( ) { if ( names [ 0 ] . getIndex ( ) == 1 && names [ 0 ] . getName ( ) . length ( ) == 0 && names [ 0 ] . getNamespace ( ) . length ( ) == 0 ) return true ; else return false ; } | Tell if the path is absolute . |
15,873 | public QPathEntry [ ] getRelPath ( int relativeDegree ) throws IllegalPathException { int len = getLength ( ) - relativeDegree ; if ( len < 0 ) throw new IllegalPathException ( "Relative degree " + relativeDegree + " is more than depth for " + getAsString ( ) ) ; QPathEntry [ ] relPath = new QPathEntry [ relativeDegree... | Get relative path with degree . |
15,874 | public static QPath getCommonAncestorPath ( QPath firstPath , QPath secondPath ) throws PathNotFoundException { if ( ! firstPath . getEntries ( ) [ 0 ] . equals ( secondPath . getEntries ( ) [ 0 ] ) ) { throw new PathNotFoundException ( "For the given ways there is no common ancestor." ) ; } List < QPathEntry > caEntri... | Get common ancestor path . |
15,875 | public String getAsString ( ) { if ( stringName == null ) { StringBuilder str = new StringBuilder ( ) ; for ( int i = 0 ; i < getLength ( ) ; i ++ ) { str . append ( names [ i ] . getAsString ( true ) ) ; } stringName = str . toString ( ) ; } return stringName ; } | Get String representation . |
15,876 | public static QPath parse ( String qPath ) throws IllegalPathException { if ( qPath == null ) throw new IllegalPathException ( "Bad internal path '" + qPath + "'" ) ; if ( qPath . length ( ) < 2 || ! qPath . startsWith ( "[]" ) ) throw new IllegalPathException ( "Bad internal path '" + qPath + "'" ) ; int uriStart = 0 ... | Parses string and make internal path from it . |
15,877 | void repair ( boolean ignoreFailure ) throws IOException { if ( errors . size ( ) == 0 ) { log . info ( "No errors found." ) ; return ; } int notRepairable = 0 ; for ( Iterator < ConsistencyCheckError > it = errors . iterator ( ) ; it . hasNext ( ) ; ) { final ConsistencyCheckError error = it . next ( ) ; try { if ( er... | Repairs detected errors during the consistency check . |
15,878 | private void run ( ) throws IOException , RepositoryException { Set < String > multipleEntries = new HashSet < String > ( ) ; documentUUIDs = new HashSet < String > ( ) ; CachingMultiIndexReader reader = index . getIndexReader ( ) ; try { for ( int i = 0 ; i < reader . maxDoc ( ) ; i ++ ) { if ( i > 10 && i % ( reader ... | Runs the consistency check . |
15,879 | public WorkspaceContainer getWorkspaceContainer ( String workspaceName ) { Object comp = getComponentInstance ( workspaceName ) ; return comp != null && comp instanceof WorkspaceContainer ? ( WorkspaceContainer ) comp : null ; } | Get workspace Container by name . |
15,880 | public WorkspaceEntry getWorkspaceEntry ( String wsName ) { for ( WorkspaceEntry entry : config . getWorkspaceEntries ( ) ) { if ( entry . getName ( ) . equals ( wsName ) ) return entry ; } return null ; } | Get workspace configuration entry by name . |
15,881 | private void load ( ) throws RepositoryException { NamespaceDataPersister namespacePersister = ( NamespaceDataPersister ) this . getComponentInstanceOfType ( NamespaceDataPersister . class ) ; NamespaceRegistryImpl nsRegistry = ( NamespaceRegistryImpl ) getNamespaceRegistry ( ) ; namespacePersister . start ( ) ; nsRegi... | Load namespaces and nodetypes from persistent repository . |
15,882 | protected InternalQName [ ] getSelectProperties ( ) throws RepositoryException { List < InternalQName > selectProps = new ArrayList < InternalQName > ( ) ; selectProps . addAll ( Arrays . asList ( root . getSelectProperties ( ) ) ) ; if ( selectProps . size ( ) == 0 ) { LocationStepQueryNode [ ] steps = root . getLocat... | Returns the select properties for this query . |
15,883 | protected Session session ( String repoName , String wsName , List < String > lockTokens ) throws Exception , NoSuchWorkspaceException { ManageableRepository repo = repositoryService . getCurrentRepository ( ) ; if ( PropertyManager . isDevelopping ( ) && log . isWarnEnabled ( ) ) { String currentRepositoryName = repo ... | Gives access to the current session . |
15,884 | protected String getRepositoryName ( String repoName ) throws RepositoryException { ManageableRepository repo = repositoryService . getCurrentRepository ( ) ; String currentRepositoryName = repo . getConfiguration ( ) . getName ( ) ; if ( PropertyManager . isDevelopping ( ) && log . isWarnEnabled ( ) ) { if ( ! current... | Gives the name of the repository to access . |
15,885 | protected String normalizePath ( String repoPath ) { if ( repoPath . length ( ) > 0 && repoPath . endsWith ( "/" ) ) { return repoPath . substring ( 0 , repoPath . length ( ) - 1 ) ; } return repoPath ; } | Normalizes path . |
15,886 | protected String path ( String repoPath , boolean withIndex ) { String path = repoPath . substring ( workspaceName ( repoPath ) . length ( ) ) ; if ( path . length ( ) > 0 ) { if ( ! withIndex ) { return TextUtil . removeIndexFromPath ( path ) ; } return path ; } return "/" ; } | Extracts path from repository path . |
15,887 | protected List < String > lockTokens ( String lockTokenHeader , String ifHeader ) { ArrayList < String > lockTokens = new ArrayList < String > ( ) ; if ( lockTokenHeader != null ) { if ( lockTokenHeader . startsWith ( "<" ) ) { lockTokenHeader = lockTokenHeader . substring ( 1 , lockTokenHeader . length ( ) - 1 ) ; } i... | Creates the list of Lock tokens from Lock - Token and If headers . |
15,888 | private URI buildURI ( String path ) throws URISyntaxException { try { return new URI ( path ) ; } catch ( URISyntaxException e ) { return new URI ( TextUtil . escape ( path , '%' , true ) ) ; } } | Build URI from string . |
15,889 | private boolean isAllowedPath ( String workspaceName , String path ) { if ( pattern == null ) return true ; Matcher matcher = pattern . matcher ( workspaceName + ":" + path ) ; if ( ! matcher . find ( ) ) { log . warn ( "Access not allowed to webdav resource {}" , path ) ; return false ; } return true ; } | Check resource access allowed |
15,890 | protected void createRepositoryInternally ( String backupId , RepositoryEntry rEntry , String rToken , DBCreationProperties creationProps ) throws RepositoryConfigurationException , RepositoryCreationException { if ( rpcService != null ) { String stringRepositoryEntry = null ; try { JsonGeneratorImpl generatorImpl = ne... | Create repository internally . serverUrl and connProps contain specific properties for db creation . |
15,891 | protected void removeRepositoryLocally ( String repositoryName , boolean forceRemove ) throws RepositoryCreationException { try { ManageableRepository repositorty = repositoryService . getRepository ( repositoryName ) ; Set < String > datasources = extractDataSourceNames ( repositorty . getConfiguration ( ) , false ) ;... | Remove repository locally . |
15,892 | private void traverseResources ( Resource resource , int counter ) throws XMLStreamException , RepositoryException , IllegalResourceTypeException , URISyntaxException , UnsupportedEncodingException { xmlStreamWriter . writeStartElement ( "DAV:" , "response" ) ; xmlStreamWriter . writeStartElement ( "DAV:" , "href" ) ; ... | Traverses resources and collects the vales of required properties . |
15,893 | private void calculateWorkspaceDataSize ( ) { long dataSize ; try { dataSize = getWorkspaceDataSizeDirectly ( ) ; } catch ( QuotaManagerException e1 ) { throw new IllegalStateException ( "Can't calculate workspace data size" , e1 ) ; } ChangesItem changesItem = new ChangesItem ( ) ; changesItem . updateWorkspaceChanged... | Calculates and accumulates workspace data size . |
15,894 | private void printWarning ( PropertyImpl property , Exception exception ) throws RepositoryException { if ( PropertyManager . isDevelopping ( ) ) { LOG . warn ( "Binary value reader error, content by path " + property . getPath ( ) + ", property id " + property . getData ( ) . getIdentifier ( ) + " : " + exception . ge... | Print warning message on the console |
15,895 | private void setJCRProperties ( NodeImpl parent , Properties props ) throws Exception { if ( ! parent . isNodeType ( "dc:elementSet" ) ) { parent . addMixin ( "dc:elementSet" ) ; } ValueFactory vFactory = parent . getSession ( ) . getValueFactory ( ) ; LocationFactory lFactory = parent . getSession ( ) . getLocationFac... | Sets metainfo properties as JCR properties to node . |
15,896 | private static String prepareScripts ( String initScriptPath , String itemTableSuffix , String valueTableSuffix , String refTableSuffix , boolean isolatedDB ) throws IOException { String scripts = IOUtil . getStreamContentAsString ( PrivilegedFileHelper . getResourceAsStream ( initScriptPath ) ) ; if ( isolatedDB ) { s... | Preparing SQL scripts for database initialization . |
15,897 | public static String scriptPath ( String dbDialect , boolean multiDb ) { String suffix = multiDb ? "m" : "s" ; String sqlPath = null ; if ( dbDialect . startsWith ( DBConstants . DB_DIALECT_ORACLE ) ) { sqlPath = "/conf/storage/jcr-" + suffix + "jdbc.ora.sql" ; } else if ( dbDialect . startsWith ( DBConstants . DB_DIAL... | Returns path where SQL scripts for database initialization is stored . |
15,898 | public static String getRootNodeInitializeScript ( String itemTableName , boolean multiDb ) { String singeDbScript = "insert into " + itemTableName + "(ID, PARENT_ID, NAME, CONTAINER_NAME, VERSION, I_CLASS, I_INDEX, " + "N_ORDER_NUM) VALUES('" + Constants . ROOT_PARENT_UUID + "', '" + Constants . ROOT_PARENT_UUID + "',... | Initialization script for root node . |
15,899 | public static String getObjectScript ( String objectName , boolean multiDb , String dialect , WorkspaceEntry wsEntry ) throws RepositoryConfigurationException , IOException { String scripts = prepareScripts ( wsEntry , dialect ) ; String sql = null ; for ( String query : JDBCUtils . splitWithSQLDelimiter ( scripts ) ) ... | Returns SQL script for create objects such as index primary of foreign key . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.