Point checkin.

Augmented AVMRemote to expose lookup that can fetch deleted nodes.
Minor fixup to excluder regex in avm-services-context.xml.
Added excluder to LinkValidationServiceImpl.
Prep to walk difference using SyncService (getting ready for incremental update of link validation tables).


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5898 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jon Cox
2007-06-08 23:21:24 +00:00
parent 813090c69b
commit 9b03b15674
9 changed files with 454 additions and 316 deletions

View File

@@ -249,12 +249,14 @@
class="org.alfresco.repo.avm.wf.AVMSubmitTransactionListener"/> class="org.alfresco.repo.avm.wf.AVMSubmitTransactionListener"/>
<!-- NameMatcher beans for filtering what shows up as different in compares. --> <!-- NameMatcher beans for filtering what shows up as different in compares. -->
<bean id="excludeRegexMatcher" class="org.alfresco.util.RegexNameMatcher"> <bean id="excludeRegexMatcher" class="org.alfresco.util.RegexNameMatcher">
<property name="patterns"> <property name="patterns">
<!--
NOTE: Regexes are implicitly anchored with ^ and $ in this context.
-->
<list> <list>
<value>.*/#.*</value> <value>.*/#[^/]*</value> <!-- A leaf starting with '#' -->
</list> </list>
</property> </property>
</bean> </bean>

View File

@@ -22,7 +22,7 @@
* *
* *
* Author Jon Cox <jcox@alfresco.com> * Author Jon Cox <jcox@alfresco.com>
* File UpdateHrefInfoStatus.java * File HrefValidationProgress.java
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
package org.alfresco.linkvalidation; package org.alfresco.linkvalidation;
@@ -43,10 +43,10 @@ import java.util.concurrent.atomic.AtomicBoolean;
* call to updateHrefInfo() has completed by examining * call to updateHrefInfo() has completed by examining
* the value returned by isDone(). * the value returned by isDone().
* <p> * <p>
* Note: It is safest to instantiate a fresh UpdateHrefInfoStatus * Note: It is safest to instantiate a fresh HrefValidationProgress
* object for every invocation of updateHrefInfo(). * object for every invocation of updateHrefInfo().
*/ */
public class UpdateHrefInfoStatus public class HrefValidationProgress
{ {
AtomicInteger webapp_update_count_; AtomicInteger webapp_update_count_;
AtomicInteger dir_update_count_; AtomicInteger dir_update_count_;
@@ -54,7 +54,7 @@ public class UpdateHrefInfoStatus
AtomicInteger url_update_count_; AtomicInteger url_update_count_;
AtomicBoolean is_done_; AtomicBoolean is_done_;
public UpdateHrefInfoStatus() public HrefValidationProgress()
{ {
webapp_update_count_ = new AtomicInteger(); webapp_update_count_ = new AtomicInteger();
dir_update_count_ = new AtomicInteger(); dir_update_count_ = new AtomicInteger();

View File

@@ -66,12 +66,12 @@ public interface LinkValidationService
* 'status' may be polled in a separate thread to * 'status' may be polled in a separate thread to
* observe its progress. * observe its progress.
*/ */
public void updateHrefInfo( String storeNameOrWebappPath, public void updateHrefInfo( String storeNameOrWebappPath,
boolean incremental, boolean incremental,
int connectTimeout, int connectTimeout,
int readTimeout, int readTimeout,
int nthreads, int nthreads,
UpdateHrefInfoStatus status HrefValidationProgress progress
) )
throws AVMNotFoundException; throws AVMNotFoundException;
@@ -208,9 +208,11 @@ public interface LinkValidationService
* Don't use yet - does nothing at the moment. * Don't use yet - does nothing at the moment.
*/ */
public BrokenHrefConcordanceDifference getBrokenHrefConcordanceDifference( public BrokenHrefConcordanceDifference getBrokenHrefConcordanceDifference(
int srcVersion, String srcPath, int srcVersion,
int dstVersion, String dstPath, String srcPath,
NameMatcher excluder) int dstVersion,
String dstPath,
HrefValidationProgress progress)
throws AVMNotFoundException; throws AVMNotFoundException;
} }

View File

@@ -317,6 +317,14 @@ public class AVMRemoteLocal implements AVMRemote
return fService.lookup(version, path); return fService.lookup(version, path);
} }
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#lookup(int, java.lang.String, boolean)
*/
public AVMNodeDescriptor lookup(int version, String path, boolean includeDeleted)
{
return fService.lookup(version, path, includeDeleted);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String) * @see org.alfresco.repo.avm.AVMRemote#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String)
*/ */
@@ -325,6 +333,14 @@ public class AVMRemoteLocal implements AVMRemote
return fService.lookup(dir, name); return fService.lookup(dir, name);
} }
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String, boolean includeDeleted)
*/
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name, boolean includeDeleted)
{
return fService.lookup(dir, name, includeDeleted);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#makePrimary(java.lang.String) * @see org.alfresco.repo.avm.AVMRemote#makePrimary(java.lang.String)
*/ */

View File

@@ -705,6 +705,23 @@ public class AVMRemoteTransportService implements AVMRemoteTransport, Runnable
return fAVMService.lookup(version, path); return fAVMService.lookup(version, path);
} }
/**
* Lookup a node identified by version ID and path; optionally,
* if the node is deleted, its descriptor can still
* be retrieved.
*
* @param version The version ID to look under.
* @param path The simple absolute path to the parent directory.
* @param includeDeleted Whether to allow a deleted node to be retrieved
* @return An AVMNodeDescriptor, or null if the version does not exist.
*/
public AVMNodeDescriptor lookup(String ticket, int version, String path, boolean includeDeleted)
{
fAuthService.validate(ticket);
return fAVMService.lookup(version, path, includeDeleted);
}
/** /**
* Get a descriptor for the specified node. * Get a descriptor for the specified node.
* @param dir The descriptor for the directory node. * @param dir The descriptor for the directory node.
@@ -717,6 +734,25 @@ public class AVMRemoteTransportService implements AVMRemoteTransport, Runnable
return fAVMService.lookup(dir, name); return fAVMService.lookup(dir, name);
} }
/**
* Lookup a node identified by the directory that contains it, and its name;
* optionally, the lookup can retrive the descriptor of a node even if
* it has been deleted from its containing directory.
*
* @param dir The descriptor for the directory node.
* @param name The name to lookup.
* @param includeDeleted Whether to allow a deleted node to be retrieved via the lookup
* @return The descriptor for the child, null if the child doesn't exist.
* @throws AVMNotFoundException
* @throws AVMWrongTypeException
*/
public AVMNodeDescriptor lookup(String ticket, AVMNodeDescriptor dir, String name, boolean includeDeleted)
{
fAuthService.validate(ticket);
return fAVMService.lookup(dir, name, includeDeleted);
}
/** /**
* Get the indirection path for a node. * Get the indirection path for a node.
* @param version The version to look under. * @param version The version to look under.

View File

@@ -331,6 +331,15 @@ public class AVMRemoteImpl implements AVMRemote
return fTransport.lookup(fTicketHolder.getTicket(), version, path); return fTransport.lookup(fTicketHolder.getTicket(), version, path);
} }
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#lookup(int, java.lang.String, boolean)
*/
public AVMNodeDescriptor lookup(int version, String path, boolean includeDeleted)
{
return fTransport.lookup(fTicketHolder.getTicket(), version, path, includeDeleted);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String) * @see org.alfresco.repo.avm.AVMRemote#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String)
*/ */
@@ -339,6 +348,15 @@ public class AVMRemoteImpl implements AVMRemote
return fTransport.lookup(fTicketHolder.getTicket(), dir, name); return fTransport.lookup(fTicketHolder.getTicket(), dir, name);
} }
/* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#lookup(org.alfresco.service.cmr.avm.AVMNodeDescriptor, java.lang.String, boolean includeDeleted)
*/
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name, boolean includeDeleted)
{
return fTransport.lookup(fTicketHolder.getTicket(), dir, name, includeDeleted);
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.alfresco.repo.avm.AVMRemote#makePrimary(java.lang.String) * @see org.alfresco.repo.avm.AVMRemote#makePrimary(java.lang.String)
*/ */

View File

@@ -253,6 +253,11 @@ public class AVMNodeDescriptor implements Serializable
/** /**
* Determines whether this node corresponds to * Determines whether this node corresponds to
* either a plain or layered file. * either a plain or layered file.
* <p>
* NOTE: A deleted file node is <em>not</em> considered a file
* (i.e.: isFile() returns false when isDeleted() returns true).
* Therefore, use isDeletedFile() to determine if a deleted node
* was a file, not isFile().
* *
* @return true if AVMNodeDescriptor is a plain or layered file, * @return true if AVMNodeDescriptor is a plain or layered file,
* otherwise false. * otherwise false.
@@ -290,6 +295,11 @@ public class AVMNodeDescriptor implements Serializable
/** /**
* Determines whether this node corresponds to * Determines whether this node corresponds to
* either a plain or layered directory. * either a plain or layered directory.
* <p>
* NOTE: A deleted directory node is <em>not</em> considered a directory
* (i.e.: isDirectory() returns false when isDeleted() returns true).
* Therefore, use isDeletedDirectory() to determine if a deleted node
* was a directory, not isDirectory().
* *
* @return true if AVMNodeDescriptor is a plain or layered directory, * @return true if AVMNodeDescriptor is a plain or layered directory,
* otherwise false. * otherwise false.

View File

@@ -245,6 +245,18 @@ public interface AVMRemote
*/ */
public AVMNodeDescriptor lookup(int version, String path); public AVMNodeDescriptor lookup(int version, String path);
/**
* Lookup a node identified by version ID and path; optionally,
* if the node is deleted, its descriptor can still
* be retrieved.
*
* @param version The version ID to look under.
* @param path The simple absolute path to the parent directory.
* @param includeDeleted Whether to allow a deleted node to be retrieved
* @return An AVMNodeDescriptor, or null if the version does not exist.
*/
public AVMNodeDescriptor lookup(int version, String path, boolean includeDeleted);
/** /**
* Get a descriptor for the specified node. * Get a descriptor for the specified node.
* @param dir The descriptor for the directory node. * @param dir The descriptor for the directory node.
@@ -253,6 +265,20 @@ public interface AVMRemote
*/ */
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name); public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name);
/**
* Lookup a node identified by the directory that contains it, and its name;
* optionally, the lookup can retrive the descriptor of a node even if
* it has been deleted from its containing directory.
*
* @param dir The descriptor for the directory node.
* @param name The name to lookup.
* @param includeDeleted Whether to allow a deleted node to be retrieved via the lookup
* @return The descriptor for the child, null if the child doesn't exist.
* @throws AVMNotFoundException
* @throws AVMWrongTypeException
*/
public AVMNodeDescriptor lookup(AVMNodeDescriptor dir, String name, boolean includeDeleted);
/** /**
* Get the indirection path for a node. * Get the indirection path for a node.
* @param version The version to look under. * @param version The version to look under.

View File

@@ -257,6 +257,19 @@ public interface AVMRemoteTransport
*/ */
public AVMNodeDescriptor lookup(String ticket, int version, String path); public AVMNodeDescriptor lookup(String ticket, int version, String path);
/**
* Lookup a node identified by version ID and path; optionally,
* if the node is deleted, its descriptor can still
* be retrieved.
*
* @param version The version ID to look under.
* @param path The simple absolute path to the parent directory.
* @param includeDeleted Whether to allow a deleted node to be retrieved
* @return An AVMNodeDescriptor, or null if the version does not exist.
*/
public AVMNodeDescriptor lookup(String ticket, int version, String path, boolean includeDeleted);
/** /**
* Get a descriptor for the specified node. * Get a descriptor for the specified node.
* @param dir The descriptor for the directory node. * @param dir The descriptor for the directory node.
@@ -265,6 +278,21 @@ public interface AVMRemoteTransport
*/ */
public AVMNodeDescriptor lookup(String ticket, AVMNodeDescriptor dir, String name); public AVMNodeDescriptor lookup(String ticket, AVMNodeDescriptor dir, String name);
/**
* Lookup a node identified by the directory that contains it, and its name;
* optionally, the lookup can retrive the descriptor of a node even if
* it has been deleted from its containing directory.
*
* @param dir The descriptor for the directory node.
* @param name The name to lookup.
* @param includeDeleted Whether to allow a deleted node to be retrieved via the lookup
* @return The descriptor for the child, null if the child doesn't exist.
* @throws AVMNotFoundException
* @throws AVMWrongTypeException
*/
public AVMNodeDescriptor lookup(String ticket, AVMNodeDescriptor dir, String name, boolean includeDeleted);
/** /**
* Get the indirection path for a node. * Get the indirection path for a node.
* @param version The version to look under. * @param version The version to look under.