mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
Point checkin. Rough cut at href merge op (don't use it yet though).
Also included abort() method on progress object. What's left: o put incremental update in looping thread(s) to let system bootstrap from nothing o deal with store/webapp going away o deal with virt server down o Switch to using virtualized snapshot instead of HEAD in staging o testing... and lots of it git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@6063 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -35,8 +35,18 @@ import java.util.Map;
|
||||
|
||||
public class HrefDifference
|
||||
{
|
||||
/**
|
||||
* The href_status_map_ is a map of URLs the tuple of their
|
||||
* return status & list of dependencies.
|
||||
*/
|
||||
protected HrefStatusMap href_status_map_; // status of links/maybe dep info
|
||||
protected HrefManifest href_manifest_; // overall manifest in of change
|
||||
|
||||
/**
|
||||
* The href_manifest_ contains a List<HrefManifestEntry> objects.
|
||||
* Each HrefManifestEntry contains a file name,
|
||||
* and possibly a list of hrefs within that file.
|
||||
*/
|
||||
protected HrefManifest href_manifest_;
|
||||
|
||||
// Lazily computed values
|
||||
protected HrefManifest broken_in_newmod_; // errors in new files
|
||||
@@ -50,24 +60,33 @@ public class HrefDifference
|
||||
protected HashMap<String, List<String>> broken_manifest_map_;
|
||||
protected HashMap<String,String> deleted_file_md5_;
|
||||
|
||||
// href attribute lookup prefix
|
||||
String href_attr_;
|
||||
|
||||
String href_attr_; // href attribute lookup prefix
|
||||
String src_store_;
|
||||
String dst_store_;
|
||||
String src_webapp_url_base_;
|
||||
String dst_webapp_url_base_;
|
||||
int connect_timeout_;
|
||||
int read_timeout_;
|
||||
int nthreads_;
|
||||
|
||||
HrefDifference(String href_attr,
|
||||
String src_store,
|
||||
String dst_store,
|
||||
String src_webapp_url_base,
|
||||
String dst_webapp_url_base)
|
||||
String dst_webapp_url_base,
|
||||
int connect_timeout,
|
||||
int read_timeout,
|
||||
int nthreads)
|
||||
{
|
||||
href_attr_ = href_attr;
|
||||
src_store_ = src_store;
|
||||
dst_store_ = dst_store;
|
||||
src_webapp_url_base_ = src_webapp_url_base;
|
||||
dst_webapp_url_base_ = dst_webapp_url_base;
|
||||
connect_timeout_ = connect_timeout;
|
||||
read_timeout_ = read_timeout_;
|
||||
nthreads_ = nthreads;
|
||||
|
||||
href_manifest_ = new HrefManifest();
|
||||
href_status_map_ = new HrefStatusMap();
|
||||
@@ -85,6 +104,10 @@ public class HrefDifference
|
||||
String getDstStore() { return dst_store_;}
|
||||
String getSrcWebappUrlBase() { return src_webapp_url_base_; }
|
||||
String getDstWebappUrlBase() { return dst_webapp_url_base_; }
|
||||
int getConnectTimeout() { return connect_timeout_; }
|
||||
int getReadTimeout() { return read_timeout_; }
|
||||
int getNthreads() { return nthreads_; }
|
||||
|
||||
|
||||
Map<String,String> getDeletedFileMd5() { return deleted_file_md5_; }
|
||||
Map<String, List<String>> getBrokenManifestMap()
|
||||
|
@@ -34,8 +34,12 @@ import org.alfresco.util.Pair;
|
||||
|
||||
/**
|
||||
* A synchronized wrapper for the ephemeral cache of href status results.
|
||||
* The key is a url, the value is a pair consisting of the url's status code
|
||||
* and the list of files accessed when the URL is requested, if known.
|
||||
*
|
||||
* The key is the raw url that was tested (not an md5sum),
|
||||
* the value is a pair consisting of the url's status code,
|
||||
* and the list of files accessed when the URL is requested,
|
||||
* if known. Note that all url & file data are in the namespace
|
||||
* of the proposed changeset (e.g.: the workflow).
|
||||
*
|
||||
* This class also allows the non-synchronized map it wraps to be extracted.
|
||||
*/
|
||||
|
@@ -56,6 +56,7 @@ public class HrefValidationProgress implements Serializable
|
||||
AtomicInteger file_update_count_;
|
||||
AtomicInteger url_update_count_;
|
||||
AtomicBoolean is_done_;
|
||||
AtomicBoolean is_aborted_;
|
||||
|
||||
public HrefValidationProgress()
|
||||
{
|
||||
@@ -64,6 +65,7 @@ public class HrefValidationProgress implements Serializable
|
||||
file_update_count_ = new AtomicInteger();
|
||||
url_update_count_ = new AtomicInteger();
|
||||
is_done_ = new AtomicBoolean( false );
|
||||
is_aborted_ = new AtomicBoolean( false );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -81,6 +83,25 @@ public class HrefValidationProgress implements Serializable
|
||||
*/
|
||||
public int getDirUpdateCount() { return dir_update_count_.intValue(); }
|
||||
|
||||
/**
|
||||
* Tell the thread that is validating hrefs to abort its current
|
||||
* operation, and cause that operation to declare it "done" and throw
|
||||
* LinkValidationAbortedException.
|
||||
*
|
||||
* Thus, if you have an observer polling progress & checking isDone(),
|
||||
* they'll also see that things are "finished", and can check to see
|
||||
* whether it's because isAborted() is true.
|
||||
*/
|
||||
public void abort()
|
||||
{
|
||||
is_aborted_.set( true );
|
||||
setDone( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether or not the validation operation was halted by abort().
|
||||
*/
|
||||
public boolean isAborted() { return is_aborted_.get(); }
|
||||
|
||||
/**
|
||||
* Returns the number of files that have been completely
|
||||
|
@@ -0,0 +1,66 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Copyright 2007 Alfresco Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special
|
||||
* exception to the terms and conditions of version 2.0 of the GPL, you may
|
||||
* redistribute this Program in connection with Free/Libre and Open Source
|
||||
* Software ("FLOSS") applications as described in Alfresco's FLOSS exception.
|
||||
* You should have received a copy of the text describing the FLOSS exception,
|
||||
* and it is also available here: http://www.alfresco.com/legal/licensing
|
||||
*
|
||||
*
|
||||
* Author Jon Cox <jcox@alfresco.com>
|
||||
* File LinkValidationException.java
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
package org.alfresco.linkvalidation;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* An exception class thrown when a link validation operation is aborted.
|
||||
*
|
||||
* @author Jon Cox
|
||||
*/
|
||||
public class LinkValidationAbortedException extends LinkValidationException
|
||||
implements Serializable
|
||||
{
|
||||
// serialVersionUID via:
|
||||
//
|
||||
// CLASSPATH=$CLASSPATH:projects/repository/build/classes \
|
||||
// serialver org.alfresco.linkvalidation.LinkValidationAbortedException
|
||||
//
|
||||
static final long serialVersionUID = 8307355006036359098L;
|
||||
|
||||
|
||||
public LinkValidationAbortedException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public LinkValidationAbortedException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public LinkValidationAbortedException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public LinkValidationAbortedException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
}
|
@@ -0,0 +1,65 @@
|
||||
/*-----------------------------------------------------------------------------
|
||||
* Copyright 2007 Alfresco Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special
|
||||
* exception to the terms and conditions of version 2.0 of the GPL, you may
|
||||
* redistribute this Program in connection with Free/Libre and Open Source
|
||||
* Software ("FLOSS") applications as described in Alfresco's FLOSS exception.
|
||||
* You should have received a copy of the text describing the FLOSS exception,
|
||||
* and it is also available here: http://www.alfresco.com/legal/licensing
|
||||
*
|
||||
*
|
||||
* Author Jon Cox <jcox@alfresco.com>
|
||||
* File LinkValidationException.java
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
package org.alfresco.linkvalidation;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Class for generic LinkValidation Exceptions.
|
||||
*
|
||||
* @author Jon Cox
|
||||
*/
|
||||
public class LinkValidationException extends Exception
|
||||
implements Serializable
|
||||
{
|
||||
// serialVersionUID via:
|
||||
//
|
||||
// CLASSPATH=$CLASSPATH:projects/repository/build/classes \
|
||||
// serialver org.alfresco.linkvalidation.LinkValidationException
|
||||
//
|
||||
static final long serialVersionUID = 571631235536445801L;
|
||||
|
||||
public LinkValidationException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public LinkValidationException(String message)
|
||||
{
|
||||
super(message);
|
||||
}
|
||||
|
||||
public LinkValidationException(String message, Throwable cause)
|
||||
{
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public LinkValidationException(Throwable cause)
|
||||
{
|
||||
super(cause);
|
||||
}
|
||||
}
|
@@ -184,8 +184,9 @@ public interface LinkValidationService
|
||||
int connectTimeout,
|
||||
int readTimeout,
|
||||
int nthreads,
|
||||
HrefValidationProgress progress
|
||||
) throws AVMNotFoundException;
|
||||
HrefValidationProgress progress)
|
||||
throws AVMNotFoundException,
|
||||
LinkValidationAbortedException;
|
||||
|
||||
public HrefManifest getHrefManifestBrokenByDelete(HrefDifference hdiff);
|
||||
public HrefManifest getHrefManifestBrokenByNewOrMod(HrefDifference hdiff);
|
||||
|
Reference in New Issue
Block a user