Source Code Cross Referenced for Refinement.java in  » Web-Crawler » heritrix » org » archive » crawler » settings » refinements » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Crawler » heritrix » org.archive.crawler.settings.refinements 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Refinement
002:         *
003:         * $Id: Refinement.java 4663 2006-09-25 23:47:38Z paul_jack $
004:         *
005:         * Created on Apr 2, 2004
006:         *
007:         * Copyright (C) 2004 Internet Archive.
008:         *
009:         * This file is part of the Heritrix web crawler (crawler.archive.org).
010:         *
011:         * Heritrix is free software; you can redistribute it and/or modify
012:         * it under the terms of the GNU Lesser Public License as published by
013:         * the Free Software Foundation; either version 2.1 of the License, or
014:         * any later version.
015:         *
016:         * Heritrix is distributed in the hope that it will be useful,
017:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
018:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
019:         * GNU Lesser Public License for more details.
020:         *
021:         * You should have received a copy of the GNU Lesser Public License
022:         * along with Heritrix; if not, write to the Free Software
023:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
024:         */
025:        package org.archive.crawler.settings.refinements;
026:
027:        import java.util.ArrayList;
028:        import java.util.Iterator;
029:        import java.util.List;
030:        import java.util.ListIterator;
031:
032:        import org.archive.crawler.settings.CrawlerSettings;
033:        import org.archive.net.UURI;
034:
035:        /**
036:         * This class acts as a mapping between refinement criterias and a settings
037:         * object.
038:         *
039:         * @author John Erik Halse
040:         *
041:         */
042:        public class Refinement {
043:            private final CrawlerSettings owner;
044:            private String description;
045:            private String operator = "Admin";
046:            private String organization = "";
047:            private String audience = "";
048:            private String reference;
049:            private List<Criteria> criteria = new ArrayList<Criteria>();
050:
051:            /**
052:             * Create a new instance of Refinement
053:             *
054:             * @param owner the settings object that owns the refinement.
055:             * @param reference a name that combined with the owner uniquely identifies
056:             *            the refinement.
057:             */
058:            public Refinement(CrawlerSettings owner, String reference) {
059:                this .owner = owner;
060:                this .reference = reference;
061:                owner.addRefinement(this );
062:            }
063:
064:            /** Create a new instance of Refinement
065:             *
066:             * @param owner the settings object that owns the refinement.
067:             * @param reference a name that combined with the owner uniquely identifies
068:             *            the refinement.
069:             * @param descr A textual description of the refinement.
070:             */
071:            public Refinement(CrawlerSettings owner, String reference,
072:                    String descr) {
073:                this (owner, reference);
074:                this .description = descr;
075:            }
076:
077:            /**
078:             * Check if a URI is within the bounds of every criteria set for this
079:             * refinement.
080:             *
081:             * @param uri the URI that shoulb be checked.
082:             * @return true if within bounds.
083:             */
084:            public boolean isWithinRefinementBounds(UURI uri) {
085:                if (uri == null || uri == null) {
086:                    return false;
087:                }
088:                for (Iterator it = criteria.iterator(); it.hasNext();) {
089:                    if (!((Criteria) it.next()).isWithinRefinementBounds(uri)) {
090:                        return false;
091:                    }
092:                }
093:                return true;
094:            }
095:
096:            /**
097:             * Return the description of this refinement.
098:             *
099:             * @return Returns the description.
100:             */
101:            public String getDescription() {
102:                return description;
103:            }
104:
105:            /**
106:             * Set the description for this refinement.
107:             *
108:             * @param description The description to set.
109:             */
110:            public void setDescription(String description) {
111:                this .description = description;
112:            }
113:
114:            /**
115:             * Get an <code>ListIterator</code> over the criteria set for this
116:             * refinement.
117:             *
118:             * @return Returns an iterator over the criteria.
119:             */
120:            public ListIterator criteriaIterator() {
121:                return criteria.listIterator();
122:            }
123:
124:            /**
125:             * Add a new criterion to this refinement.
126:             *
127:             * @param criterion the criterion to add.
128:             */
129:            public void addCriteria(Criteria criterion) {
130:                if (!criteria.contains(criterion)) {
131:                    criteria.add(criterion);
132:                }
133:            }
134:
135:            /**
136:             * Get the reference to this refinement's settings object.
137:             *
138:             * @return Returns the reference.
139:             */
140:            public String getReference() {
141:                return reference;
142:            }
143:
144:            /**
145:             * Set the reference to this refinement's settings object.
146:             *
147:             * @param reference The reference to set.
148:             */
149:            public void setReference(String reference) {
150:                this .reference = reference;
151:            }
152:
153:            /**
154:             * Get the <code>CrawlerSettings</code> object this refinement refers to.
155:             *
156:             * @return the settings object this refinement refers to.
157:             */
158:            public CrawlerSettings getSettings() {
159:                String parentScope = owner.getScope() == null ? "" : owner
160:                        .getScope();
161:                CrawlerSettings settings = owner.getSettingsHandler()
162:                        .getOrCreateSettingsObject(parentScope, getReference());
163:                settings.setDescription((getDescription()));
164:                return settings;
165:            }
166:
167:            public boolean equals(Object o) {
168:                if (this  == o
169:                        || (o instanceof  Refinement && this .reference
170:                                .equals(((Refinement) o).reference))) {
171:                    return true;
172:                }
173:                return false;
174:            }
175:
176:            /**
177:             * @return Returns the audience.
178:             */
179:            public String getAudience() {
180:                return this .audience;
181:            }
182:
183:            /**
184:             * @param audience The audience to set.
185:             */
186:            public void setAudience(String audience) {
187:                this .audience = audience;
188:            }
189:
190:            /**
191:             * @return Returns the operator.
192:             */
193:            public String getOperator() {
194:                return this .operator;
195:            }
196:
197:            /**
198:             * @param operator The operator to set.
199:             */
200:            public void setOperator(String operator) {
201:                this .operator = operator;
202:            }
203:
204:            /**
205:             * @return Returns the organziation.
206:             */
207:            public String getOrganization() {
208:                return this .organization;
209:            }
210:
211:            /**
212:             * @param organization The organziation to set.
213:             */
214:            public void setOrganization(String organization) {
215:                this.organization = organization;
216:            }
217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.