Source Code Cross Referenced for Type.java in  » Web-Crawler » heritrix » org » archive » crawler » settings » 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 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Type
002:         *
003:         * $Id: Type.java 4661 2006-09-25 23:11:16Z paul_jack $
004:         *
005:         * Created on Jan 8, 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;
026:
027:        import java.util.ArrayList;
028:        import java.util.Collections;
029:        import java.util.List;
030:
031:        import javax.management.Attribute;
032:
033:        /**
034:         * Interface implemented by all element types.
035:         *
036:         * @author John Erik Halse
037:         */
038:        public abstract class Type extends Attribute {
039:            /** Should this Type be serialized to persistent storage */
040:            private boolean isTransient = false;
041:            /** True if this Type can be overridden */
042:            private boolean overrideable = true;
043:            /** True if this Type should only show up in expert mode in UI */
044:            private boolean isExpertSetting = false;
045:            /** List of constraint that apply for the values of this type */
046:            private List<Constraint> constraints = new ArrayList<Constraint>();
047:            /** The class the value of this type must be an instance of (or instance of
048:             * a subclass.
049:             */
050:            private Class legalValueType;
051:
052:            /** Creates a new instance of Type.
053:             *
054:             * @param name
055:             * @param value
056:             */
057:            public Type(String name, Object value) {
058:                super (name.intern(), value);
059:                legalValueType = value != null ? value.getClass() : this 
060:                        .getClass();
061:                constraints.add(new LegalValueTypeConstraint());
062:            }
063:
064:            /** Get the description of this type
065:             *
066:             * The description should be suitable for showing in a user interface.
067:             *
068:             * @return this type's description
069:             */
070:            abstract String getDescription();
071:
072:            /** The default value for this type
073:             *
074:             * @return this type's default value
075:             */
076:            abstract Object getDefaultValue();
077:
078:            /** Get the legal values for this type.
079:             *
080:             * @return the legal values for this type or null if there are no
081:             *         restrictions.
082:             */
083:            abstract Object[] getLegalValues();
084:
085:            /** Is this an 'overrideable' setting. All settings are overrideable by
086:             * default.
087:             *
088:             * @return True if this is an an overrideable setting.
089:             */
090:            public boolean isOverrideable() {
091:                return overrideable;
092:            }
093:
094:            /** Set if this Type should be overideable.
095:             *
096:             * @param b true if this Type should be overideable.
097:             */
098:            public void setOverrideable(boolean b) {
099:                overrideable = b;
100:            }
101:
102:            /** Returns true if this ComplexType should be saved to persistent storage.
103:             *
104:             * @return true if this ComplexType should be saved to persistent storage.
105:             */
106:            public boolean isTransient() {
107:                return isTransient;
108:            }
109:
110:            /** Set to false if this attribute should not be serialized to persistent
111:             * storage.
112:             *
113:             * @param b if false this complexType will not be saved to persistent
114:             *          storage.
115:             */
116:            public void setTransient(boolean b) {
117:                isTransient = b;
118:            }
119:
120:            /** Returns true if this Type should only show up in expert mode in UI.
121:             *
122:             * @return true if this Type should only show up in expert mode in UI.
123:             */
124:            public boolean isExpertSetting() {
125:                return isExpertSetting;
126:            }
127:
128:            /** Set if this Type should only show up in expert mode in UI.
129:             *
130:             * @param isExpertSetting true if this Type should only show up in
131:             *        expert mode in UI.
132:             */
133:            public void setExpertSetting(boolean isExpertSetting) {
134:                this .isExpertSetting = isExpertSetting;
135:            }
136:
137:            /** Returns a list of constraints for the value of this type.
138:             *
139:             * @return Returns the constraints or null if there aren't any.
140:             */
141:            public List getConstraints() {
142:                return constraints;
143:            }
144:
145:            /** Add a constraint to this type.
146:             *
147:             * Every constraint must be fulfilled for a value of this type to be valid.
148:             *
149:             * @param constraint the constraint to add.
150:             */
151:            public void addConstraint(Constraint constraint) {
152:                constraints.add(constraint);
153:                Collections.sort(constraints);
154:            }
155:
156:            /**
157:             * Get the class values of this Type must be an instance of.
158:             *
159:             * @return Returns the legalValueType.
160:             */
161:            public Class getLegalValueType() {
162:                return legalValueType;
163:            }
164:
165:            /**
166:             * Set the class values of this Type must be an instance of.
167:             *
168:             * @param legalValueType The legalValueType to set.
169:             */
170:            public void setLegalValueType(Class legalValueType) {
171:                this .legalValueType = legalValueType;
172:            }
173:
174:            /**
175:             * The implementation of equals consider to Types as equal if name and
176:             * value are equal. Description is allowed to differ.
177:             */
178:            public boolean equals(Object o) {
179:                return this  == o
180:                        || (o instanceof  Type
181:                                && this .getName().equals(((Type) o).getName()) && this 
182:                                .getValue().equals(((Type) o).getValue()));
183:            }
184:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.