From: <bra...@us...> - 2007-07-26 21:47:19
|
Revision: 1894 http://archive-access.svn.sourceforge.net/archive-access/?rev=1894&view=rev Author: bradtofel Date: 2007-07-26 14:47:22 -0700 (Thu, 26 Jul 2007) Log Message: ----------- REFACTOR: moved ExclusionFilterFactory classes under org.archive.wayback.accesscontrol Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/remote/RemoteExclusionFilterFactory.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/robotstxt/RobotExclusionFilterFactory.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/staticmap/StaticMapExclusionFilterFactory.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java Added Paths: ----------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/CompositeExclusionFilterFactory.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactory.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactoryFactory.java Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/CompositeExclusionFilterFactory.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactory.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactoryFactory.java Copied: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/CompositeExclusionFilterFactory.java (from rev 1883, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/CompositeExclusionFilterFactory.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/CompositeExclusionFilterFactory.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/CompositeExclusionFilterFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -0,0 +1,81 @@ +/* CompositeExclusionFilterFactory + * + * $Id$ + * + * Created on 4:53:58 PM Mar 19, 2007. + * + * Copyright (C) 2007 Internet Archive. + * + * This file is part of wayback. + * + * wayback is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * wayback 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with wayback-svn; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package org.archive.wayback.accesscontrol; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.archive.wayback.core.SearchResult; +import org.archive.wayback.resourceindex.filters.CompositeExclusionFilter; +import org.archive.wayback.util.ObjectFilter; + +/** + * Class that provides SearchResult Filtering based on multiple + * ExclusionFilterFactory instances by returning a single composite + * SearchResultFilter based on the results of each ExclusionFilter. + * + * @author brad + * @version $Date$, $Revision$ + */ +public class CompositeExclusionFilterFactory implements ExclusionFilterFactory { + + private ArrayList<ExclusionFilterFactory> factories = + new ArrayList<ExclusionFilterFactory>(); + + /** + * @param factory to be added to the composite + */ + public void addFactory(ExclusionFilterFactory factory) { + factories.add(factory); + } + + /* (non-Javadoc) + * @see org.archive.wayback.resourceindex.ExclusionFilterFactory#get() + */ + public ObjectFilter<SearchResult> get() { + Iterator<ExclusionFilterFactory> itr = factories.iterator(); + CompositeExclusionFilter filter = new CompositeExclusionFilter(); + while(itr.hasNext()) { + filter.addComponent(itr.next().get()); + } + return filter; + } + + + /** + * @return the factories + */ + public ArrayList<ExclusionFilterFactory> getFactories() { + return factories; + } + + + /** + * @param factories the factories to set + */ + public void setFactories(ArrayList<ExclusionFilterFactory> factories) { + this.factories = factories; + } +} Copied: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactory.java (from rev 1883, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactory.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactory.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -0,0 +1,41 @@ +/* ExclusionFilterFactory + * + * $Id$ + * + * Created on 8:14:58 PM Mar 5, 2007. + * + * Copyright (C) 2007 Internet Archive. + * + * This file is part of wayback-svn. + * + * wayback-svn is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * wayback-svn 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with wayback-svn; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package org.archive.wayback.accesscontrol; + +import org.archive.wayback.core.SearchResult; +import org.archive.wayback.util.ObjectFilter; +/** + * + * + * @author brad + * @version $Date$, $Revision$ + */ +public interface ExclusionFilterFactory { + /** + * @return an ObjectFilter object that filters records based on + * some set of exclusion rules. + */ + public ObjectFilter<SearchResult> get(); +} Copied: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactoryFactory.java (from rev 1884, trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactoryFactory.java) =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactoryFactory.java (rev 0) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/ExclusionFilterFactoryFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -0,0 +1,77 @@ +/* ExclusionFilterFactoryFactory + * + * $Id$ + * + * Created on 8:17:48 PM Mar 5, 2007. + * + * Copyright (C) 2007 Internet Archive. + * + * This file is part of wayback-svn. + * + * wayback-svn is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * wayback-svn 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 Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with wayback-svn; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package org.archive.wayback.accesscontrol; + +import java.util.Properties; + +import org.archive.wayback.accesscontrol.robotstxt.RobotExclusionFilterFactory; +import org.archive.wayback.accesscontrol.staticmap.StaticMapExclusionFilterFactory; +import org.archive.wayback.exception.ConfigurationException; + +/** + * + * + * @author brad + * @version $Date$, $Revision$ + */ +public class ExclusionFilterFactoryFactory { + private static final String FACTORY_TYPE = "exclusion.factorytype"; + private static final String FACTORY_TYPE_STATIC_MAP = "static-map"; + private static final String FACTORY_TYPE_ROBOT_EXCLUSION = "robot-cache"; + private static final String FACTORY_TYPE_ROBOT_PLUS_MAP = "robot-plus-map"; + + /** + * @param p + * @return the ExclusionFilterFactory, or null if none is configured. + * @throws ConfigurationException + */ + public static ExclusionFilterFactory get(Properties p) + throws ConfigurationException { + + ExclusionFilterFactory factory = null; + String type = (String) p.getProperty(FACTORY_TYPE); + if(type == null) { + return factory; + } + if(type.equals(FACTORY_TYPE_STATIC_MAP)) { + factory = new StaticMapExclusionFilterFactory(); +// factory.init(p); + } else if(type.equals(FACTORY_TYPE_ROBOT_EXCLUSION)){ + factory = new RobotExclusionFilterFactory(); +// factory.init(p); + } else if(type.equals(FACTORY_TYPE_ROBOT_PLUS_MAP)) { + CompositeExclusionFilterFactory composite = null; + composite = new CompositeExclusionFilterFactory(); + ExclusionFilterFactory robot = new RobotExclusionFilterFactory(); + ExclusionFilterFactory staticMap = new StaticMapExclusionFilterFactory(); +// robot.init(p); +// staticMap.init(p); + composite.addFactory(staticMap); + composite.addFactory(robot); + factory = composite; + } + return factory; + } +} Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/remote/RemoteExclusionFilterFactory.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/remote/RemoteExclusionFilterFactory.java 2007-07-26 21:42:35 UTC (rev 1893) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/remote/RemoteExclusionFilterFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -24,8 +24,8 @@ */ package org.archive.wayback.accesscontrol.remote; +import org.archive.wayback.accesscontrol.ExclusionFilterFactory; import org.archive.wayback.core.SearchResult; -import org.archive.wayback.resourceindex.ExclusionFilterFactory; import org.archive.wayback.util.ObjectFilter; /** Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/robotstxt/RobotExclusionFilterFactory.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/robotstxt/RobotExclusionFilterFactory.java 2007-07-26 21:42:35 UTC (rev 1893) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/robotstxt/RobotExclusionFilterFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -24,9 +24,9 @@ */ package org.archive.wayback.accesscontrol.robotstxt; +import org.archive.wayback.accesscontrol.ExclusionFilterFactory; import org.archive.wayback.core.SearchResult; import org.archive.wayback.liveweb.LiveWebCache; -import org.archive.wayback.resourceindex.ExclusionFilterFactory; import org.archive.wayback.util.ObjectFilter; /** Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/staticmap/StaticMapExclusionFilterFactory.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/staticmap/StaticMapExclusionFilterFactory.java 2007-07-26 21:42:35 UTC (rev 1893) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/accesscontrol/staticmap/StaticMapExclusionFilterFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -30,8 +30,8 @@ import java.util.Map; import java.util.logging.Logger; +import org.archive.wayback.accesscontrol.ExclusionFilterFactory; import org.archive.wayback.core.SearchResult; -import org.archive.wayback.resourceindex.ExclusionFilterFactory; import org.archive.wayback.surt.SURTTokenizer; import org.archive.wayback.util.CloseableIterator; import org.archive.wayback.util.ObjectFilter; Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/CompositeExclusionFilterFactory.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/CompositeExclusionFilterFactory.java 2007-07-26 21:42:35 UTC (rev 1893) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/CompositeExclusionFilterFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -1,81 +0,0 @@ -/* CompositeExclusionFilterFactory - * - * $Id$ - * - * Created on 4:53:58 PM Mar 19, 2007. - * - * Copyright (C) 2007 Internet Archive. - * - * This file is part of wayback. - * - * wayback is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback-svn; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.resourceindex; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.archive.wayback.core.SearchResult; -import org.archive.wayback.resourceindex.filters.CompositeExclusionFilter; -import org.archive.wayback.util.ObjectFilter; - -/** - * Class that provides SearchResult Filtering based on multiple - * ExclusionFilterFactory instances by returning a single composite - * SearchResultFilter based on the results of each ExclusionFilter. - * - * @author brad - * @version $Date$, $Revision$ - */ -public class CompositeExclusionFilterFactory implements ExclusionFilterFactory { - - private ArrayList<ExclusionFilterFactory> factories = - new ArrayList<ExclusionFilterFactory>(); - - /** - * @param factory to be added to the composite - */ - public void addFactory(ExclusionFilterFactory factory) { - factories.add(factory); - } - - /* (non-Javadoc) - * @see org.archive.wayback.resourceindex.ExclusionFilterFactory#get() - */ - public ObjectFilter<SearchResult> get() { - Iterator<ExclusionFilterFactory> itr = factories.iterator(); - CompositeExclusionFilter filter = new CompositeExclusionFilter(); - while(itr.hasNext()) { - filter.addComponent(itr.next().get()); - } - return filter; - } - - - /** - * @return the factories - */ - public ArrayList<ExclusionFilterFactory> getFactories() { - return factories; - } - - - /** - * @param factories the factories to set - */ - public void setFactories(ArrayList<ExclusionFilterFactory> factories) { - this.factories = factories; - } -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactory.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactory.java 2007-07-26 21:42:35 UTC (rev 1893) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -1,41 +0,0 @@ -/* ExclusionFilterFactory - * - * $Id$ - * - * Created on 8:14:58 PM Mar 5, 2007. - * - * Copyright (C) 2007 Internet Archive. - * - * This file is part of wayback-svn. - * - * wayback-svn is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback-svn 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback-svn; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.resourceindex; - -import org.archive.wayback.core.SearchResult; -import org.archive.wayback.util.ObjectFilter; -/** - * - * - * @author brad - * @version $Date$, $Revision$ - */ -public interface ExclusionFilterFactory { - /** - * @return an ObjectFilter object that filters records based on - * some set of exclusion rules. - */ - public ObjectFilter<SearchResult> get(); -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactoryFactory.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactoryFactory.java 2007-07-26 21:42:35 UTC (rev 1893) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/ExclusionFilterFactoryFactory.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -1,77 +0,0 @@ -/* ExclusionFilterFactoryFactory - * - * $Id$ - * - * Created on 8:17:48 PM Mar 5, 2007. - * - * Copyright (C) 2007 Internet Archive. - * - * This file is part of wayback-svn. - * - * wayback-svn is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback-svn 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback-svn; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.resourceindex; - -import java.util.Properties; - -import org.archive.wayback.accesscontrol.robotstxt.RobotExclusionFilterFactory; -import org.archive.wayback.accesscontrol.staticmap.StaticMapExclusionFilterFactory; -import org.archive.wayback.exception.ConfigurationException; - -/** - * - * - * @author brad - * @version $Date$, $Revision$ - */ -public class ExclusionFilterFactoryFactory { - private static final String FACTORY_TYPE = "exclusion.factorytype"; - private static final String FACTORY_TYPE_STATIC_MAP = "static-map"; - private static final String FACTORY_TYPE_ROBOT_EXCLUSION = "robot-cache"; - private static final String FACTORY_TYPE_ROBOT_PLUS_MAP = "robot-plus-map"; - - /** - * @param p - * @return the ExclusionFilterFactory, or null if none is configured. - * @throws ConfigurationException - */ - public static ExclusionFilterFactory get(Properties p) - throws ConfigurationException { - - ExclusionFilterFactory factory = null; - String type = (String) p.getProperty(FACTORY_TYPE); - if(type == null) { - return factory; - } - if(type.equals(FACTORY_TYPE_STATIC_MAP)) { - factory = new StaticMapExclusionFilterFactory(); -// factory.init(p); - } else if(type.equals(FACTORY_TYPE_ROBOT_EXCLUSION)){ - factory = new RobotExclusionFilterFactory(); -// factory.init(p); - } else if(type.equals(FACTORY_TYPE_ROBOT_PLUS_MAP)) { - CompositeExclusionFilterFactory composite = null; - composite = new CompositeExclusionFilterFactory(); - ExclusionFilterFactory robot = new RobotExclusionFilterFactory(); - ExclusionFilterFactory staticMap = new StaticMapExclusionFilterFactory(); -// robot.init(p); -// staticMap.init(p); - composite.addFactory(staticMap); - composite.addFactory(robot); - factory = composite; - } - return factory; - } -} Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java 2007-07-26 21:42:35 UTC (rev 1893) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/LocalResourceIndex.java 2007-07-26 21:47:22 UTC (rev 1894) @@ -43,6 +43,7 @@ import org.archive.wayback.resourceindex.filters.UrlPrefixMatchFilter; import org.archive.wayback.resourceindex.filters.WindowEndFilter; import org.archive.wayback.resourceindex.filters.WindowStartFilter; +import org.archive.wayback.accesscontrol.ExclusionFilterFactory; import org.archive.wayback.core.CaptureSearchResults; import org.archive.wayback.core.SearchResult; import org.archive.wayback.core.SearchResults; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |