idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
15,600
public String getAsString ( boolean showIndex ) { if ( showIndex ) { if ( cachedToStringShowIndex != null ) { return cachedToStringShowIndex ; } } else { if ( cachedToString != null ) { return cachedToString ; } } // String res ; if ( showIndex ) { res = super . getAsString ( ) + QPath . PREFIX_DELIMITER + getIndex ( )...
Return entry textual representation .
136
5
15,601
private List < NodeTypeData > registerListOfNodeTypes ( final List < NodeTypeData > nodeTypes , final int alreadyExistsBehaviour ) throws RepositoryException { // validate nodeTypeDataValidator . validateNodeType ( nodeTypes ) ; nodeTypeRepository . registerNodeType ( nodeTypes , this , accessControlPolicy , alreadyExi...
Registers the provided node types
268
6
15,602
public Query rewrite ( IndexReader reader ) throws IOException { if ( transform == TRANSFORM_NONE ) { Query stdRangeQueryImpl = new TermRangeQuery ( lowerTerm . field ( ) , lowerTerm . text ( ) , upperTerm . text ( ) , inclusive , inclusive ) ; try { stdRangeQuery = stdRangeQueryImpl . rewrite ( reader ) ; return stdRa...
Tries to rewrite this query into a standard lucene RangeQuery . This rewrite might fail with a TooManyClauses exception . If that happens we use our own implementation .
126
35
15,603
public static void start ( final Cache < Serializable , Object > cache ) { PrivilegedAction < Object > action = new PrivilegedAction < Object > ( ) { public Object run ( ) { cache . start ( ) ; return null ; } } ; SecurityHelper . doPrivilegedAction ( action ) ; }
Start Infinispan cache in privileged mode .
64
9
15,604
public static Object put ( final Cache < Serializable , Object > cache , final Serializable key , final Object value , final long lifespan , final TimeUnit unit ) { PrivilegedAction < Object > action = new PrivilegedAction < Object > ( ) { public Object run ( ) { return cache . put ( key , value , lifespan , unit ) ; }...
Put in Infinispan cache in privileged mode .
88
10
15,605
public Response lock ( Session session , String path , HierarchicalProperty body , Depth depth , String timeout ) { boolean bodyIsEmpty = ( body == null ) ; String lockToken ; //To force read only mode when open a document by user with only read permission if ( isReadOnly ( session , path ) ) { return Response . status...
Webdav Lock comand implementation .
651
8
15,606
private StreamingOutput body ( WebDavNamespaceContext nsContext , LockRequestEntity input , Depth depth , String lockToken , String lockOwner , String timeout ) { return new LockResultResponseEntity ( nsContext , lockToken , lockOwner , timeout ) ; }
Writes response body into the stream .
54
8
15,607
private boolean isReadOnly ( Session session , String path ) { try { session . checkPermission ( path , PermissionType . SET_PROPERTY ) ; return false ; } catch ( AccessControlException e ) { return true ; } catch ( RepositoryException e ) { return false ; } }
Check node permission
63
3
15,608
public String dump ( ) throws RepositoryException { StringBuilder tmp = new StringBuilder ( ) ; QueryTreeDump . dump ( this , tmp ) ; return tmp . toString ( ) ; }
Dumps this QueryNode and its child nodes to a String .
41
13
15,609
public Query createQuery ( SessionImpl session , SessionDataManager sessionDataManager , Node node ) throws InvalidQueryException , RepositoryException { AbstractQueryImpl query = createQueryInstance ( ) ; query . init ( session , sessionDataManager , handler , node ) ; return query ; }
Creates a query object from a node that can be executed on the workspace .
58
16
15,610
public Query createQuery ( SessionImpl session , SessionDataManager sessionDataManager , String statement , String language ) throws InvalidQueryException , RepositoryException { AbstractQueryImpl query = createQueryInstance ( ) ; query . init ( session , sessionDataManager , handler , statement , language ) ; return q...
Creates a query object that can be executed on the workspace .
63
13
15,611
public void checkIndex ( final InspectionReport report , final boolean isSystem ) throws RepositoryException , IOException { if ( isSuspended . get ( ) ) { try { SecurityHelper . doPrivilegedExceptionAction ( new PrivilegedExceptionAction < Object > ( ) { public Object run ( ) throws RepositoryException , IOException {...
Check index consistency . Iterator goes through index documents and check does each document have according jcr - node . If index is suspended then it will be temporary resumed while check is running and suspended afterwards .
351
40
15,612
public Set < String > getNodesByUri ( final String uri ) throws RepositoryException { Set < String > result ; final int defaultClauseCount = BooleanQuery . getMaxClauseCount ( ) ; try { // final LocationFactory locationFactory = new // LocationFactory(this); final ValueFactoryImpl valueFactory = new ValueFactoryImpl ( ...
Return set of uuid of nodes . Contains in names prefixes maped to the given uri
422
20
15,613
protected String getIndexDirParam ( ) throws RepositoryConfigurationException { String dir = config . getParameterValue ( QueryHandlerParams . PARAM_INDEX_DIR , null ) ; if ( dir == null ) { LOG . warn ( QueryHandlerParams . PARAM_INDEX_DIR + " parameter not found. Using outdated parameter name " + QueryHandlerParams ....
^ Returns index - dir parameter from configuration .
121
9
15,614
@ SuppressWarnings ( "unchecked" ) protected IndexerChangesFilter initializeChangesFilter ( ) throws RepositoryException , RepositoryConfigurationException { IndexerChangesFilter newChangesFilter = null ; Class < ? extends IndexerChangesFilter > changesFilterClass = DefaultChangesFilter . class ; String changesFilterCl...
Initialize changes filter .
443
5
15,615
protected void initializeQueryHandler ( ) throws RepositoryException , RepositoryConfigurationException { // initialize query handler String className = config . getType ( ) ; if ( className == null ) { throw new RepositoryConfigurationException ( "Content hanler configuration fail" ) ; } try { Class < ? > qHandlerClas...
Initializes the query handler .
479
6
15,616
public void setOnline ( boolean isOnline , boolean allowQuery , boolean dropStaleIndexes ) throws IOException { handler . setOnline ( isOnline , allowQuery , dropStaleIndexes ) ; }
Switches index into corresponding ONLINE or OFFLINE mode . Offline mode means that new indexing data is collected but index is guaranteed to be unmodified during offline state . Passing the allowQuery flag can allow or deny performing queries on index during offline mode . AllowQuery is not used when setting index back...
43
93
15,617
public CompletableFuture < Boolean > reindexWorkspace ( final boolean dropExisting , int nThreads ) throws IllegalStateException { // checks if ( handler == null || handler . getIndexerIoModeHandler ( ) == null || changesFilter == null ) { throw new IllegalStateException ( "Index might have not been initialized yet." )...
Perform hot reindexing of the workspace
446
9
15,618
private void cleanIndexDirectory ( String path ) throws IOException { SecurityHelper . doPrivilegedIOExceptionAction ( ( PrivilegedExceptionAction < Void > ) ( ) -> { File newIndexFolder = new File ( path ) ; if ( newIndexFolder . exists ( ) ) { DirectoryHelper . removeDirectory ( newIndexFolder ) ; } return null ; } )...
remove index directory if exist
77
5
15,619
protected void postInit ( Connection connection ) throws SQLException { String select = "select * from " + DBInitializerHelper . getItemTableName ( containerConfig ) + " where ID='" + Constants . ROOT_PARENT_UUID + "' and PARENT_ID='" + Constants . ROOT_PARENT_UUID + "'" ; if ( ! connection . createStatement ( ) . exec...
Init root node parent record .
134
6
15,620
private static Field . Index getIndexParameter ( int flags ) { if ( ( flags & INDEXED_FLAG ) == 0 ) { return Field . Index . NO ; } else if ( ( flags & TOKENIZED_FLAG ) > 0 ) { return Field . Index . ANALYZED ; } else { return Field . Index . NOT_ANALYZED ; } }
Returns the index parameter extracted from the flags .
82
9
15,621
private static Field . Store getStoreParameter ( int flags ) { if ( ( flags & STORED_FLAG ) > 0 ) { return Field . Store . YES ; } else { return Field . Store . NO ; } }
Returns the store parameter extracted from the flags .
46
9
15,622
private static Field . TermVector getTermVectorParameter ( int flags ) { if ( ( ( flags & STORE_POSITION_WITH_TERM_VECTOR_FLAG ) > 0 ) && ( ( flags & STORE_OFFSET_WITH_TERM_VECTOR_FLAG ) > 0 ) ) { return Field . TermVector . WITH_POSITIONS_OFFSETS ; } else if ( ( flags & STORE_POSITION_WITH_TERM_VECTOR_FLAG ) > 0 ) { r...
Returns the term vector parameter extracted from the flags .
212
10
15,623
private void addNamespace ( String prefix , String uri ) { prefixToURI . put ( prefix , uri ) ; uriToPrefix . put ( uri , prefix ) ; }
Adds the given namespace declaration to this resolver .
41
10
15,624
public Response versionControl ( Session session , String path ) { try { Node node = ( Node ) session . getItem ( path ) ; if ( ! node . isNodeType ( "mix:versionable" ) ) { node . addMixin ( "mix:versionable" ) ; session . save ( ) ; } return Response . ok ( ) . build ( ) ; } catch ( LockException exc ) { return Respo...
Webdav Version - Control method implementation .
196
9
15,625
public byte [ ] generateLinkContent ( ) throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; // LINK HEADER for ( int i = 0 ; i < linkHeader . length ; i ++ ) { byte curByteValue = ( byte ) linkHeader [ i ] ; outStream . write ( curByteValue ) ; } // LINK BODY byte [ ] linkContent = ge...
Generates the content of link .
154
7
15,626
private byte [ ] getLinkContent ( ) throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; byte [ ] firstItem = getFirstItem ( ) ; writeInt ( firstItem . length + 2 , outStream ) ; writeBytes ( firstItem , outStream ) ; byte [ ] lastItem = getLastItem ( ) ; writeInt ( lastItem . length +...
Gets the content of the link .
387
8
15,627
private byte [ ] getFirstItem ( ) throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; int [ ] firstItem = { 0x1F , 0x50 , 0xE0 , 0x4F , 0xD0 , 0x20 , 0xEA , 0x3A , 0x69 , 0x10 , 0xA2 , 0xD8 , 0x08 , 0x00 , 0x2B , 0x30 , 0x30 , 0x9D , } ; writeInts ( firstItem , outStream ) ; return ou...
Returns the first item .
140
5
15,628
private byte [ ] getLastItem ( ) throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; int [ ] lastItem = { 0x2E , 0x80 , 0x00 , 0xDF , 0xEA , 0xBD , 0x65 , 0xC2 , 0xD0 , 0x11 , 0xBC , 0xED , 0x00 , 0xA0 , 0xC9 , 0x0A , 0xB5 , 0x0F } ; writeInts ( lastItem , outStream ) ; return outStre...
Returns the last item .
138
5
15,629
private byte [ ] getRootValue ( String rootName ) throws IOException { ByteArrayOutputStream outStream = new ByteArrayOutputStream ( ) ; simpleWriteString ( rootName , outStream ) ; int [ ] rootVal = { 0x20 , 0x00 , 0x3D , 0x04 , 0x30 , 0x04 , 0x20 , 0x00 } ; writeInts ( rootVal , outStream ) ; simpleWriteString ( host...
Returns the root value .
116
5
15,630
private void writeZeroString ( String outString , OutputStream outStream ) throws IOException { simpleWriteString ( outString , outStream ) ; outStream . write ( 0 ) ; outStream . write ( 0 ) ; }
Writes zero - string into stream .
47
8
15,631
private void writeInt ( int intValue , OutputStream outStream ) throws IOException { outStream . write ( intValue & 0xFF ) ; outStream . write ( ( intValue >> 8 ) & 0xFF ) ; }
Writes int into stream .
49
6
15,632
private void writeInts ( int [ ] bytes , OutputStream outStream ) throws IOException { for ( int i = 0 ; i < bytes . length ; i ++ ) { byte curByte = ( byte ) bytes [ i ] ; outStream . write ( curByte ) ; } }
Writes int array into stream .
60
7
15,633
private void commitPending ( ) throws IOException { if ( pending . isEmpty ( ) ) { return ; } super . addDocuments ( ( Document [ ] ) pending . values ( ) . toArray ( new Document [ pending . size ( ) ] ) ) ; pending . clear ( ) ; aggregateIndexes . clear ( ) ; }
Commits pending documents to the index .
70
8
15,634
@ Override public Query rewrite ( IndexReader reader ) throws IOException { @ SuppressWarnings ( "serial" ) Query stdWildcardQuery = new MultiTermQuery ( ) { @ Override protected FilteredTermEnum getEnum ( IndexReader reader ) throws IOException { return new WildcardTermEnum ( reader , field , propName , pattern , tran...
Either rewrites this query to a lucene MultiTermQuery or in case of a TooManyClauses exception to a custom jackrabbit query implementation that uses a BitSet to collect all hits .
225
41
15,635
public BaseXmlExporter getExportVisitor ( XmlMapping type , OutputStream stream , boolean skipBinary , boolean noRecurse , boolean exportChildVersionHistory , ItemDataConsumer dataManager , NamespaceRegistry namespaceRegistry , ValueFactoryImpl systemValueFactory ) throws NamespaceException , RepositoryException , IOEx...
Create export visitor for given type of view . \
294
10
15,636
protected JCRPathMatcher parsePathMatcher ( LocationFactory locFactory , String path ) throws RepositoryException { JCRPath knownPath = null ; boolean forDescendants = false ; boolean forAncestors = false ; if ( path . equals ( "*" ) || path . equals ( ".*" ) ) { // any forDescendants = true ; forAncestors = true ; } e...
Parses JCR path matcher from string .
285
11
15,637
public boolean checkedOut ( ) throws UnsupportedRepositoryOperationException , RepositoryException { // this will also check if item is valid NodeData vancestor = getVersionableAncestor ( ) ; if ( vancestor != null ) { PropertyData isCheckedOut = ( PropertyData ) dataManager . getItemData ( vancestor , new QPathEntry (...
Tell if this node or its nearest versionable ancestor is checked - out .
134
15
15,638
private void doAddMixin ( NodeTypeData type ) throws NoSuchNodeTypeException , ConstraintViolationException , VersionException , LockException , RepositoryException { // Add both to mixinNodeTypes and to jcr:mixinTypes property // Prepare mixin values InternalQName [ ] mixinTypes = nodeData ( ) . getMixinTypeNames ( ) ...
Internal method to add mixin Nodetype to the Node .
804
14
15,639
protected NodeData getCorrespondingNodeData ( SessionImpl corrSession ) throws ItemNotFoundException , AccessDeniedException , RepositoryException { final QPath myPath = nodeData ( ) . getQPath ( ) ; final SessionDataManager corrDataManager = corrSession . getTransientNodesManager ( ) ; if ( this . isNodeType ( Constan...
Return Node corresponding to this Node .
508
7
15,640
public String [ ] getMixinTypeNames ( ) throws RepositoryException { NodeType [ ] mixinTypes = getMixinNodeTypes ( ) ; String [ ] mtNames = new String [ mixinTypes . length ] ; for ( int i = 0 ; i < mtNames . length ; i ++ ) { mtNames [ i ] = mixinTypes [ i ] . getName ( ) ; } return mtNames ; }
Return mixin Nodetype names .
90
9
15,641
private void initDefinition ( NodeData parent ) throws RepositoryException , ConstraintViolationException { if ( this . isRoot ( ) ) { // root - no parent this . definition = new NodeDefinitionData ( null , null , true , true , OnParentVersionAction . ABORT , true , new InternalQName [ ] { Constants . NT_BASE } , null ...
Init NodeDefinition .
211
4
15,642
public VersionHistoryImpl versionHistory ( boolean pool ) throws UnsupportedRepositoryOperationException , RepositoryException { if ( ! this . isNodeType ( Constants . MIX_VERSIONABLE ) ) { throw new UnsupportedRepositoryOperationException ( "Node is not mix:versionable " + getPath ( ) ) ; } PropertyData vhProp = ( Pro...
For internal use . Doesn t check the InvalidItemStateException and may return unpooled VersionHistory object .
197
22
15,643
private List < PropertyData > childPropertiesData ( ) throws RepositoryException , AccessDeniedException { List < PropertyData > storedProps = new ArrayList < PropertyData > ( dataManager . getChildPropertiesData ( nodeData ( ) ) ) ; Collections . sort ( storedProps , new PropertiesDataOrderComparator < PropertyData > ...
Return child Properties list .
83
5
15,644
private List < NodeData > childNodesData ( ) throws RepositoryException , AccessDeniedException { List < NodeData > storedNodes = new ArrayList < NodeData > ( dataManager . getChildNodesData ( nodeData ( ) ) ) ; Collections . sort ( storedNodes , new NodeDataOrderComparator ( ) ) ; return storedNodes ; }
Return child Nodes list .
79
6
15,645
private int getNextChildIndex ( InternalQName nameToAdd , InternalQName primaryTypeName , NodeData parentNode , NodeDefinitionData def ) throws RepositoryException , ItemExistsException { boolean allowSns = def . isAllowsSameNameSiblings ( ) ; int ind = 1 ; boolean hasSibling = dataManager . hasItemData ( parentNode , ...
Calculates next child node index . Is used existed node definition if no - get one based on node name and node type .
194
26
15,646
protected boolean accept ( Node node ) { try { return status == UserStatus . ANY || status . matches ( node . canAddMixin ( JCROrganizationServiceImpl . JOS_DISABLED ) ) ; } catch ( RepositoryException e ) { if ( LOG . isDebugEnabled ( ) ) { String path = "unknown" ; try { path = node . getPath ( ) ; } catch ( Reposito...
Tests whether or not the specified node should be included in the node list .
165
16
15,647
public String getPositionSegment ( ) { HierarchicalProperty position = member . getChild ( new QName ( "DAV:" , "position" ) ) ; return position . getChild ( 0 ) . getChild ( new QName ( "DAV:" , "segment" ) ) . getValue ( ) ; }
Position segment getter .
69
5
15,648
public Response copy ( Session destSession , String sourcePath , String destPath ) { try { Workspace workspace = destSession . getWorkspace ( ) ; workspace . copy ( sourcePath , destPath ) ; // If the source resource was successfully moved // to a pre-existing destination resource. if ( itemExisted ) { return Response ...
Webdav COPY method implementation for the same workspace .
374
12
15,649
public void execute ( ) throws IOException { // Future todo: Use JNI and librsync library? Runtime run = Runtime . getRuntime ( ) ; try { String command ; if ( excludeDir != null && ! excludeDir . isEmpty ( ) ) { command = "rsync -rv --delete --exclude " + excludeDir + " " + src + " " + dst ; } else { command = "rsync ...
Executes RSYNC synchronization job
609
7
15,650
private List < ValueData > parseValues ( ) throws RepositoryException { List < ValueData > values = new ArrayList < ValueData > ( propertyInfo . getValuesSize ( ) ) ; List < String > stringValues = new ArrayList < String > ( ) ; for ( int k = 0 ; k < propertyInfo . getValuesSize ( ) ; k ++ ) { if ( propertyInfo . getTy...
Returns the list of ValueData for current property
412
9
15,651
protected String getAttribute ( Map < String , String > attributes , InternalQName name ) throws RepositoryException { JCRName jname = locationFactory . createJCRName ( name ) ; return attributes . get ( jname . getAsString ( ) ) ; }
Returns the value of the named XML attribute .
56
9
15,652
protected void suspendRepository ( ) throws RepositoryException { SecurityHelper . validateSecurityPermission ( JCRRuntimePermissions . MANAGE_REPOSITORY_PERMISSION ) ; repository . setState ( ManageableRepository . SUSPENDED ) ; }
Suspend repository which means that allow only read operations . All writing threads will wait until resume operations invoked .
57
22
15,653
protected void resumeRepository ( ) throws RepositoryException { // Need privileges to manage repository. SecurityHelper . validateSecurityPermission ( JCRRuntimePermissions . MANAGE_REPOSITORY_PERMISSION ) ; repository . setState ( ManageableRepository . ONLINE ) ; }
Resume repository . All previously suspended threads continue working .
62
11
15,654
public static long getLength ( ValueData value , int propType ) { if ( propType == PropertyType . BINARY ) { return value . getLength ( ) ; } else if ( propType == PropertyType . NAME || propType == PropertyType . PATH ) { return - 1 ; } else { return value . toString ( ) . length ( ) ; } }
Returns length of the internal value .
78
7
15,655
@ Override public void recreateEntry ( final SessionProvider sessionProvider , final String groupPath , final RegistryEntry entry ) throws RepositoryException { final String entryRelPath = EXO_REGISTRY + "/" + groupPath + "/" + entry . getName ( ) ; final String parentFullPath = "/" + EXO_REGISTRY + "/" + groupPath ; t...
Re - creates an entry in the group .
299
9
15,656
public void initRegistryEntry ( String groupName , String entryName ) throws RepositoryException , RepositoryConfigurationException { String relPath = EXO_REGISTRY + "/" + groupName + "/" + entryName ; for ( RepositoryEntry repConfiguration : repConfigurations ( ) ) { String repName = repConfiguration . getName ( ) ; S...
Initializes the registry entry
192
5
15,657
public boolean getForceXMLConfigurationValue ( InitParams initParams ) { ValueParam valueParam = initParams . getValueParam ( "force-xml-configuration" ) ; return ( valueParam != null ? Boolean . valueOf ( valueParam . getValue ( ) ) : false ) ; }
Get value of force - xml - configuration param .
65
10
15,658
private void checkGroup ( final SessionProvider sessionProvider , final String groupPath ) throws RepositoryException { String [ ] groupNames = groupPath . split ( "/" ) ; String prefix = "/" + EXO_REGISTRY ; Session session = session ( sessionProvider , repositoryService . getCurrentRepository ( ) ) ; for ( String nam...
check if group exists and creates one if necessary
211
9
15,659
private PlainChangesLog makeAutoCreatedItems ( final NodeData parent , final InternalQName nodeTypeName , final ItemDataConsumer targetDataManager , final String owner , boolean addedAutoCreatedNodes ) throws RepositoryException { final PlainChangesLogImpl changes = new PlainChangesLogImpl ( ) ; final NodeTypeData type...
Prepares changes log
268
4
15,660
@ GET @ Produces ( MediaType . APPLICATION_JSON ) @ RolesAllowed ( "administrators" ) @ Path ( "/repository-service-configuration" ) public Response getRepositoryServiceConfiguration ( ) { RepositoryServiceConfiguration configuration = repositoryService . getConfig ( ) ; RepositoryServiceConf conf = new RepositoryServi...
Gives the repository service configuration which is composed of the configuration of all the repositories and workspaces
129
19
15,661
@ GET @ Produces ( MediaType . APPLICATION_JSON ) @ RolesAllowed ( "administrators" ) @ Path ( "/default-ws-config/{repositoryName}" ) public Response getDefaultWorkspaceConfig ( @ PathParam ( "repositoryName" ) String repositoryName ) { String errorMessage = new String ( ) ; Status status ; try { String defaultWorkspa...
Gives the configuration of the default workspace of the given repository
398
12
15,662
@ GET @ Produces ( MediaType . APPLICATION_JSON ) @ RolesAllowed ( "administrators" ) @ Path ( "/repositories" ) public Response getRepositoryNames ( ) { List < String > repositories = new ArrayList < String > ( ) ; for ( RepositoryEntry rEntry : repositoryService . getConfig ( ) . getRepositoryConfigurations ( ) ) { r...
Gives the name of all the existing repositories .
126
10
15,663
@ GET @ Produces ( MediaType . APPLICATION_JSON ) @ RolesAllowed ( "administrators" ) @ Path ( "/workspaces/{repositoryName}" ) public Response getWorkspaceNames ( @ PathParam ( "repositoryName" ) String repositoryName ) { String errorMessage = new String ( ) ; Status status ; try { List < String > workspaces = new Arr...
Gives the name of all the existing workspaces for a given repository .
327
15
15,664
@ POST @ Consumes ( MediaType . APPLICATION_JSON ) @ RolesAllowed ( "administrators" ) @ Path ( "/update-workspace-config/{repositoryName}/{workspaceName}" ) public Response updateWorkspaceConfiguration ( @ PathParam ( "repositoryName" ) String repositoryName , @ PathParam ( "workspaceName" ) String workspaceName , Wor...
Updates the configuration of a given workspace .
147
9
15,665
private String setProperty ( Node node , HierarchicalProperty property ) { String propertyName = WebDavNamespaceContext . createName ( property . getName ( ) ) ; if ( READ_ONLY_PROPS . contains ( property . getName ( ) ) ) { return WebDavConst . getStatusDescription ( HTTPStatus . CONFLICT ) ; } try { Workspace ws = no...
Sets changes the property value .
542
7
15,666
private String removeProperty ( Node node , HierarchicalProperty property ) { try { node . getProperty ( property . getStringName ( ) ) . remove ( ) ; node . save ( ) ; return WebDavConst . getStatusDescription ( HTTPStatus . OK ) ; } catch ( AccessDeniedException e ) { return WebDavConst . getStatusDescription ( HTTPS...
Removes the property .
173
5
15,667
public Response head ( Session session , String path , String baseURI ) { try { Node node = ( Node ) session . getItem ( path ) ; WebDavNamespaceContext nsContext = new WebDavNamespaceContext ( session ) ; URI uri = new URI ( TextUtil . escape ( baseURI + node . getPath ( ) , ' ' , true ) ) ; if ( ResourceUtil . isFile...
Webdav Head method implementation .
341
7
15,668
public void remove ( ItemState item ) { if ( item . isNode ( ) ) { remove ( item . getData ( ) . getQPath ( ) ) ; } else { removeProperty ( item , - 1 ) ; } }
Removes the property or node and all descendants from the log
49
12
15,669
public void remove ( QPath rootPath ) { for ( int i = items . size ( ) - 1 ; i >= 0 ; i -- ) { ItemState item = items . get ( i ) ; QPath qPath = item . getData ( ) . getQPath ( ) ; if ( qPath . isDescendantOf ( rootPath ) || item . getAncestorToSave ( ) . isDescendantOf ( rootPath ) || item . getAncestorToSave ( ) . e...
Removes the item at the rootPath and all descendants from the log
154
14
15,670
private void removeNode ( ItemState item , int indexItem ) { items . remove ( indexItem ) ; index . remove ( item . getData ( ) . getIdentifier ( ) ) ; index . remove ( item . getData ( ) . getQPath ( ) ) ; index . remove ( new ParentIDQPathBasedKey ( item ) ) ; index . remove ( new IDStateBasedKey ( item . getData ( )...
Removes the node from the log
574
7
15,671
private void removeProperty ( ItemState item , int indexItem ) { if ( indexItem == - 1 ) { items . remove ( item ) ; } else { items . remove ( indexItem ) ; } index . remove ( item . getData ( ) . getIdentifier ( ) ) ; index . remove ( item . getData ( ) . getQPath ( ) ) ; index . remove ( new ParentIDQPathBasedKey ( i...
Removes the property from the log
341
7
15,672
public Collection < ItemState > getLastChildrenStates ( ItemData rootData , boolean forNodes ) { Map < String , ItemState > children = forNodes ? lastChildNodeStates . get ( rootData . getIdentifier ( ) ) : lastChildPropertyStates . get ( rootData . getIdentifier ( ) ) ; return children == null ? new ArrayList < ItemSt...
Collect last in ChangesLog order item child changes .
91
10
15,673
public ItemState getLastState ( ItemData item , boolean forNode ) { Map < String , ItemState > children = forNode ? lastChildNodeStates . get ( item . getParentIdentifier ( ) ) : lastChildPropertyStates . get ( item . getParentIdentifier ( ) ) ; return children == null ? null : children . get ( item . getIdentifier ( )...
Return the last item state from ChangesLog .
83
9
15,674
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 .
72
14
15,675
public ItemState getItemState ( String itemIdentifier , int state ) { return index . get ( new IDStateBasedKey ( itemIdentifier , state ) ) ; }
Get ItemState by identifier and state .
36
8
15,676
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 .
153
9
15,677
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 .
119
6
15,678
public ItemState findItemState ( String id , Boolean isPersisted , int ... states ) throws IllegalPathException { List < ItemState > allStates = getAllStates ( ) ; // search from the end for state for ( int i = allStates . size ( ) - 1 ; i >= 0 ; i -- ) { ItemState istate = allStates . get ( i ) ; boolean byState = fal...
Search for an item state of item with given id and filter parameters .
195
14
15,679
private String checkIfFile ( Node node ) { return ResourceUtil . isFile ( node ) ? Boolean . TRUE . toString ( ) : Boolean . FALSE . toString ( ) ; }
Checks if node is file or folder .
40
9
15,680
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
85
6
15,681
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 .
219
8
15,682
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 .
71
6
15,683
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 .
79
4
15,684
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
168
9
15,685
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 .
552
10
15,686
private String validateDialect ( String confParam ) { for ( String dbType : DBConstants . DB_DIALECTS ) { if ( confParam . equals ( dbType ) ) { return dbType ; } } return DBConstants . DB_DIALECT_AUTO ; // by default }
Validate dialect .
69
4
15,687
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 .
68
11
15,688
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
56
11
15,689
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 .
603
38
15,690
@ Group 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
85
35
15,691
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 .
64
14
15,692
private PathQueryNode createPathQueryNode ( SimpleNode node ) { root . setLocationNode ( factory . createPathQueryNode ( root ) ) ; node . childrenAccept ( this , root . getLocationNode ( ) ) ; return root . getLocationNode ( ) ; }
Creates the primary path query node .
57
8
15,693
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 .
94
8
15,694
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 .
81
14
15,695
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 .
400
4
15,696
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 .
628
4
15,697
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 .
211
12
15,698
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 .
152
8
15,699
private void readParamsFromFile ( ) { PropertiesParam pps = initParams . getPropertiesParam ( BACKUP_PROPERTIES ) ; backupDir = pps . getProperty ( BACKUP_DIR ) ; // full backup type can be not defined. Using default. fullBackupType = pps . getProperty ( FULL_BACKUP_TYPE ) == null ? DEFAULT_VALUE_FULL_BACKUP_TYPE : pps...
Get parameters which passed from the file .
339
8