diff --git a/source/java/org/alfresco/linkvalidation/HrefDifference.java b/source/java/org/alfresco/linkvalidation/HrefDifference.java index 1b2f365b3c..1e6fb19f43 100644 --- a/source/java/org/alfresco/linkvalidation/HrefDifference.java +++ b/source/java/org/alfresco/linkvalidation/HrefDifference.java @@ -1,16 +1,16 @@ /*----------------------------------------------------------------------------- * 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 @@ -19,8 +19,8 @@ * 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 * File HrefDifference.java *----------------------------------------------------------------------------*/ @@ -36,20 +36,20 @@ import java.util.Map; public class HrefDifference { /** - * The href_status_map_ is a map of URLs the tuple of their + * 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 - /** + /** * The href_manifest_ contains a List objects. * Each HrefManifestEntry contains a file name, * and possibly a list of hrefs within that file. */ - protected HrefManifest href_manifest_; + protected HrefManifest href_manifest_; - // Lazily computed values - protected HrefManifest broken_in_newmod_; // errors in new files + // Lazily computed values + protected HrefManifest broken_in_newmod_; // errors in new files protected HrefManifest broken_by_deletion_; // err via new deletions // Only computed when merging diffs @@ -60,28 +60,40 @@ public class HrefDifference protected HashMap> broken_manifest_map_; protected HashMap deleted_file_md5_; - + String href_attr_; // href attribute lookup prefix - String src_store_; + + int src_version_; + String src_store_; + + int dst_version_; String dst_store_; + String src_webapp_url_base_; String dst_webapp_url_base_; - + HrefDifference(String href_attr, + int src_version, String src_store, + int dst_version, String dst_store, String src_webapp_url_base, String dst_webapp_url_base) { href_attr_ = href_attr; + + src_version_ = src_version; src_store_ = src_store; + + dst_version_ = dst_version; dst_store_ = dst_store; + src_webapp_url_base_ = src_webapp_url_base; dst_webapp_url_base_ = dst_webapp_url_base; href_manifest_ = new HrefManifest(); href_status_map_ = new HrefStatusMap(); - + broken_manifest_map_ = new HashMap>(); deleted_file_md5_ = new HashMap(); } @@ -89,17 +101,19 @@ public class HrefDifference public HrefManifest getHrefManifest() { return href_manifest_; } public HrefStatusMap getHrefStatusMap() { return href_status_map_; } + public int getSrcVersion() { return src_version_;} + public int getDstVersion() { return dst_version_;} - String getHrefAttr() { return href_attr_;} - String getSrcStore() { return src_store_;} - String getDstStore() { return dst_store_;} - String getSrcWebappUrlBase() { return src_webapp_url_base_; } - String getDstWebappUrlBase() { return dst_webapp_url_base_; } + String getHrefAttr() { return href_attr_;} + String getSrcStore() { return src_store_;} + String getDstStore() { return dst_store_;} + String getSrcWebappUrlBase() { return src_webapp_url_base_; } + String getDstWebappUrlBase() { return dst_webapp_url_base_; } Map getDeletedFileMd5() { return deleted_file_md5_; } - Map> getBrokenManifestMap() - { + Map> getBrokenManifestMap() + { return broken_manifest_map_; } } diff --git a/source/java/org/alfresco/linkvalidation/LinkValidationService.java b/source/java/org/alfresco/linkvalidation/LinkValidationService.java index 448882e996..c147ca910c 100644 --- a/source/java/org/alfresco/linkvalidation/LinkValidationService.java +++ b/source/java/org/alfresco/linkvalidation/LinkValidationService.java @@ -1,16 +1,16 @@ /*----------------------------------------------------------------------------- * 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 @@ -19,8 +19,8 @@ * 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 * File LinkValidationService.java *----------------------------------------------------------------------------*/ @@ -41,7 +41,7 @@ public interface LinkValidationService //------------------------------------------------------------------------- /** - * This function is just a convenience wrapper for calling + * This function is just a convenience wrapper for calling * getHrefManifestEntries with statusGTE=400 and statusLTE=599. *

* Note: Files and urls within this list of manifests pertain to @@ -51,24 +51,26 @@ public interface LinkValidationService * snapshot as new as possible, automatically. */ //------------------------------------------------------------------------- - public List getBrokenHrefManifestEntries( - String storeNameOrWebappPath - ) throws AVMNotFoundException; + public List getBrokenHrefManifestEntries( + String storeNameOrWebappPath) + throws AVMNotFoundException, + SocketException; //------------------------------------------------------------------------- /** - * Returns a manifest consisting of just the broken hrefs - * within each file containing one or more broken href. - * The HrefManifestEntry list is sorted in increasing lexicographic + * Returns a manifest consisting of just the broken hrefs + * within each file containing one or more broken href. + * The HrefManifestEntry list is sorted in increasing lexicographic * order by file name. The hrefs within each HrefManifestEntry * are also sorted in increasing lexicographic order. */ //------------------------------------------------------------------------- - public List getHrefManifestEntries( - String storeNameOrWebappPath, - int statusGTE, - int statusLTE) throws - AVMNotFoundException; + public List getHrefManifestEntries( + String storeNameOrWebappPath, + int statusGTE, + int statusLTE) + throws AVMNotFoundException, + SocketException; //------------------------------------------------------------------------- @@ -80,9 +82,9 @@ public interface LinkValidationService * snapshot, but it's async, so it might be older. */ //------------------------------------------------------------------------- - public HrefDifference getHrefDifference( - String srcWebappPath, - String dstWebappPath, + public HrefDifference getHrefDifference( + String srcWebappPath, + String dstWebappPath, HrefValidationProgress progress) throws AVMNotFoundException, SocketException, @@ -93,16 +95,16 @@ public interface LinkValidationService //------------------------------------------------------------------------- /** - * Fetches a manifest of all hyperlinks broken by files + * Fetches a manifest of all hyperlinks broken by files * deleted in a HrefDifference. Files and hrefs in this * manifest will be in the namespace of the src in the * HrefDifference. For example, suppose the "test" - * web project had a ROOT webapp with a link within + * web project had a ROOT webapp with a link within * "moo.html" that pointed to: "hamlet.html". * Now suppose that user 'alice' proposes to delete "hamlet.html". * Because 'alice' is the 'src' and staging is the 'dst' * in the HrefDifference, all files and hyperlinks appear from - * the perspective of the main working store within + * the perspective of the main working store within * alice's sandbox. Thus, the broken link info is as follows: * *

@@ -113,7 +115,7 @@ public interface LinkValidationService
     *   http://alice.test.www--sandbox.version--v-1.127-0-0-1.ip.alfrescodemo.net:8180/hamlet.html
     * 
* - * @param hdiff The difference between two webapps obtained + * @param hdiff The difference between two webapps obtained * by calling getHrefDifference(). */ //------------------------------------------------------------------------- @@ -125,11 +127,11 @@ public interface LinkValidationService //------------------------------------------------------------------------- /** * Fetches a manifest of all hyperlinks broken in new or modified files in - * an HrefDifference. Similar to getHrefManifestBrokenByDelete(), + * an HrefDifference. Similar to getHrefManifestBrokenByDelete(), * the entries in this manifest are in the 'src' namespace of the * HrefDifference operation (i.e.: files & urls from alice, not staging). * - * @param hdiff The difference between two webapps obtained + * @param hdiff The difference between two webapps obtained * by calling getHrefDifference(). */ //------------------------------------------------------------------------- @@ -140,48 +142,48 @@ public interface LinkValidationService //------------------------------------------------------------------------- /** - * WARNING: this function won't be part of the public interface for long. + * WARNING: this function won't be part of the public interface for long. * Updates href status and href file dependencies for path. * - * @param path + * @param path *
    *
  • If null, do all stores & all webapps in them. *
  • If store, do all webapps in store *
  • If webapp, do webapp. *
- * - * @param incremental - * If true, updates information incrementally, based on the - * files that have changed and prior calculations regarding + * + * @param incremental + * If true, updates information incrementally, based on the + * files that have changed and prior calculations regarding * url-to-file dependencies. If false, first deletes all URL - * info associated with the store/webapp (if any), then does + * info associated with the store/webapp (if any), then does * a full rescan to update info. - * + * * @validateExternal * Currently does nothing. Perhaps one day you'll be able to * turn off validation of external links. * * @param progress - * While updateHrefInfo() is a synchronous function, - * 'status' may be polled in a separate thread to + * While updateHrefInfo() is a synchronous function, + * 'status' may be polled in a separate thread to * observe its progress. */ //------------------------------------------------------------------------- - public void updateHrefInfo( String path, - boolean incremental, - boolean validateExternal, - HrefValidationProgress progress) - throws AVMNotFoundException, - SocketException, - SSLException, - LinkValidationAbortedException; + public void updateHrefInfo( String path, + boolean incremental, + boolean validateExternal, + HrefValidationProgress progress) + throws AVMNotFoundException, + SocketException, + SSLException, + LinkValidationAbortedException; //------------------------------------------------------------------------- /** * Fetch all hyperlinks that rely upon the existence of the file specified - * by 'path', directly or indirectly. The list of hrefs returnd is - * sorted in increasing lexicographic order. For example, in + * by 'path', directly or indirectly. The list of hrefs returnd is + * sorted in increasing lexicographic order. For example, in * alfresco-sample-website.war, the hrefs dependent upon * mysite:/www/avm_webapps/ROOT/assets/footer.html are: *
@@ -191,10 +193,9 @@ public interface LinkValidationService
     *     http://mysite.www--sandbox.version--v-1.127-0-0-1.ip.alfrescodemo.net:8180/media/releases/index.jsp
     *  
* Note that this list may contain links that are functionally equivalent - * (e.g.: the first and third links), and may also contain links that + * (e.g.: the first and third links), and may also contain links that * don't actually appear an any web page, but are implicitly present * in the site because any asset can be "dead reckoned". - * * */ //-------------------------------------------------------------------------