Source Code Cross Referenced for ARPOptions.java in  » RSS-RDF » Jena-2.5.5 » com » hp » hpl » jena » rdf » arp » 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 » RSS RDF » Jena 2.5.5 » com.hp.hpl.jena.rdf.arp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003:         * [See end of file]
004:         */
005:
006:        package com.hp.hpl.jena.rdf.arp;
007:
008:        /**
009:         * The interface to set the various options on ARP.
010:         *  User defined
011:         * implementations of this interface are not supported. This is a class rather
012:         * than an interface to have better backward compatibilitiy with earlier
013:         * versions, however constructing instances of this class is deprecated.
014:         * In addition, accessing the fields of {@link ARPErrorNumbers} through this
015:         * class is not supported. The inheritance of this interface will be removed.
016:         * 
017:         * @author Jeremy J. Carroll
018:         *
019:         */
020:        public class ARPOptions implements  ARPErrorNumbers {
021:
022:            /**
023:             * Do not use this constructor.
024:             * An example of not using this constructor is as follows.
025:             * <br/>
026:             * Deprecated usage:
027:             * <br/>
028:             * <pre>
029:                ARP arp = new ARP();
030:                ARPOptions options = new ARPOptions();
031:             </pre>
032:             <br/>
033:             * Preferred code:
034:             * <br/>
035:             * <pre>
036:                ARP arp = new ARP();
037:                ARPOptions options = arp.getOptions();
038:             </pre>
039:             *@deprecated Use {@link ARPConfig#getOptions()}
040:             */
041:            public ARPOptions() {
042:
043:            }
044:
045:            private static int defaultErrorMode[] = new int[400];
046:            static {
047:                for (int i = 0; i < defaultErrorMode.length; i++)
048:                    defaultErrorMode[i] = i / 100;
049:
050:            }
051:            private boolean embedding = false;
052:            private int errorMode[] = (int[]) defaultErrorMode.clone();
053:
054:            /** Sets or gets the error handling mode for a specific error condition.
055:             * Changes that cannot be honoured are silently ignored.
056:             * Illegal error numbers may result in an ArrayIndexOutOfBoundsException but
057:             * are usually ignored.
058:             * Most conditions are associated with one or more specific resources or literals
059:             * formed during the parse. 
060:             * Triples involving resource or literal associated with an error condition 
061:             * are not produced.
062:             * The precise definition of 'associated with' is deliberately 
063:             * undefined, and may change in future releases.
064:             * This method can be used to downgrade an error condition to 
065:             * a warning, or to upgrade a warning to an error.
066:             * Such a change modifies which triples are produced.
067:             * <p>
068:             * 
069:             * When the condition is a violation of the RDF/XML Syntax (Revised) Recommendations, 
070:             * and the error mode is {@link ARPErrorNumbers#EM_IGNORE} or  {@link ARPErrorNumbers#EM_WARNING},
071:             * the precise rules which ARP uses to generate triples for such ill-formed input are 
072:             * not defined by any standard and are subject to change with future releases.
073:             * For input involving no errors, ARP creates triples in accordance with 
074:             * the RDF/XML Syntax Revised Recommendation. 
075:             * <p>
076:             * 
077:             * The mode can have one of the following four values.
078:             * 
079:             * <dl>
080:             * <dt>{@link ARPErrorNumbers#EM_IGNORE}</dt>
081:             * <dd>Ignore this condition. Produce triples.</dd>
082:             * <dt>{@link ARPErrorNumbers#EM_WARNING}</dt>
083:             * <dd>Invoke ErrorHandler.warning() for this condition. Produce triples.</dd>
084:             * <dt>{@link ARPErrorNumbers#EM_ERROR}</dt>
085:             * <dd>Invoke ErrorHandler.error() for this condition. Do not produce triples.</dd>
086:             * <dt>{@link ARPErrorNumbers#EM_FATAL}</dt>
087:             * <dd>Aborts parse and invokes ErrorHandler.fatalError() for this condition.
088:             * Do not produce triples.
089:             * In unusual situations, a few further warnings and errors may be reported.
090:             * </dd>
091:             * </dl>
092:             * 
093:             * 
094:             * @param errno The specific error condition to change.
095:             * @param mode The new mode for this condition.
096:             * @return The old error mode for this condition.
097:             */
098:            public int setErrorMode(int errno, int mode) {
099:                int old = errorMode[errno];
100:                errorMode[errno] = mode;
101:                return old;
102:            }
103:
104:            /** Resets error mode to the default values:
105:             * many errors are reported as warnings, and resulting triples are produced.
106:             */
107:            public void setDefaultErrorMode() {
108:                errorMode = (int[]) defaultErrorMode.clone();
109:            }
110:
111:            /** As many errors as possible are ignored.
112:             * As many triples as possible are produced.
113:             */
114:            public void setLaxErrorMode() {
115:                setDefaultErrorMode();
116:                for (int i = 100; i < 200; i++)
117:                    setErrorMode(i, EM_IGNORE);
118:            }
119:
120:            /** This sets strict conformance to the W3C Recommendations.
121:             */
122:            public void setStrictErrorMode() {
123:                setStrictErrorMode(EM_IGNORE);
124:            }
125:
126:            /**
127:             * This method detects and prohibits errors according to
128:             *the W3C Recommendations.
129:             * For other conditions, such as 
130:             {@link ARPErrorNumbers#WARN_PROCESSING_INSTRUCTION_IN_RDF}, nonErrorMode is used. 
131:             *@param nonErrorMode The way of treating non-error conditions.
132:             */
133:            public void setStrictErrorMode(int nonErrorMode) {
134:                setDefaultErrorMode();
135:                for (int i = 1; i < 100; i++)
136:                    setErrorMode(i, nonErrorMode);
137:                int warning = EM_WARNING;
138:                int error = EM_ERROR;
139:                switch (nonErrorMode) {
140:                case EM_ERROR:
141:                    warning = EM_ERROR;
142:                    break;
143:                case EM_FATAL:
144:                    warning = error = EM_FATAL;
145:                    break;
146:                }
147:                for (int i = 100; i < 200; i++)
148:                    setErrorMode(i, error);
149:                // setErrorMode(IGN_XMLBASE_USED,warning);
150:                // setErrorMode(IGN_XMLBASE_SIGNIFICANT,error);
151:                setErrorMode(WARN_DEPRECATED_XMLLANG, warning);
152:                setErrorMode(WARN_STRING_NOT_NORMAL_FORM_C, warning);
153:                //       setErrorMode(WARN_EMPTY_ABOUT_EACH,nonErrorMode);
154:                setErrorMode(WARN_UNKNOWN_PARSETYPE, warning);
155:                //     setErrorMode(WARN_BAD_XML, nonErrorMode);
156:                setErrorMode(WARN_PROCESSING_INSTRUCTION_IN_RDF, nonErrorMode);
157:                //      setErrorMode(WARN_LEGAL_REUSE_OF_ID, nonErrorMode);
158:                setErrorMode(WARN_RDF_NN_AS_TYPE, nonErrorMode);
159:                setErrorMode(WARN_UNKNOWN_RDF_ELEMENT, warning);
160:                setErrorMode(WARN_UNKNOWN_RDF_ATTRIBUTE, warning);
161:                setErrorMode(WARN_UNQUALIFIED_RDF_ATTRIBUTE, warning);
162:                setErrorMode(WARN_UNKNOWN_XML_ATTRIBUTE, nonErrorMode);
163:                setErrorMode(WARN_NOT_RDF_NAMESPACE, nonErrorMode);
164:                // setErrorMode(WARN_QNAME_AS_ID, error);
165:                //      setErrorMode(WARN_BAD_XML, error);
166:                setErrorMode(WARN_SAX_WARNING, warning);
167:                setErrorMode(IGN_DAML_COLLECTION, error);
168:            }
169:
170:            /**
171:             * Copies this object.
172:             * @return A copy.
173:             * @deprecated Not intended for public use, will be removed from API
174:             */
175:            public ARPOptions copy() {
176:                ARPOptions rslt = new ARPOptions();
177:                rslt.errorMode = (int[]) errorMode.clone();
178:                rslt.embedding = embedding;
179:                return rslt;
180:            }
181:
182:            /** Sets whether the XML document is only RDF, or contains RDF embedded in other XML.
183:             * The default is non-embedded mode.
184:             * Embedded mode also matches RDF documents that use the
185:             * rdf:RDF tag at the top-level.
186:             * Non-embeded mode matches RDF documents which omit that optional tag, and consist of a single rdf:Description or
187:             * typed node.
188:             * To find embedded RDF it is necessary to setEmbedding(true).
189:             * @param embed true: Look for embedded RDF; or false: match a typed node or rdf:Description against the whole document (the default).
190:             * @return Previous setting.
191:             */
192:
193:            public boolean setEmbedding(boolean embed) {
194:                boolean old = embedding;
195:                embedding = embed;
196:                return old;
197:            }
198:
199:            /**
200:             * Returns the error mode for the given error code.
201:             * @param eCode
202:             * @return One of {@link ARPErrorNumbers#EM_IGNORE},
203:             * {@link ARPErrorNumbers#EM_WARNING},
204:             * {@link ARPErrorNumbers#EM_ERROR},
205:             * {@link ARPErrorNumbers#EM_FATAL}
206:             */
207:            public int getErrorMode(int eCode) {
208:                return errorMode[eCode];
209:            }
210:
211:            /**
212:             * True if the embedding flag is set.
213:             * Indicates that the parser should look for rdf:RDF
214:             * element, rather than treat the whole file as an RDF/XML
215:             * document (possibly without rdf:RDF element).
216:             */
217:            public boolean getEmbedding() {
218:                return embedding;
219:            }
220:
221:        }
222:
223:        /*
224:         *  (c) Copyright 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
225:         *  All rights reserved.
226:         *
227:         * Redistribution and use in source and binary forms, with or without
228:         * modification, are permitted provided that the following conditions
229:         * are met:
230:         * 1. Redistributions of source code must retain the above copyright
231:         *    notice, this list of conditions and the following disclaimer.
232:         * 2. Redistributions in binary form must reproduce the above copyright
233:         *    notice, this list of conditions and the following disclaimer in the
234:         *    documentation and/or other materials provided with the distribution.
235:         * 3. The name of the author may not be used to endorse or promote products
236:         *    derived from this software without specific prior written permission.
237:         *
238:         * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
239:         * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
240:         * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
241:         * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
242:         * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
243:         * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
244:         * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
245:         * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
246:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
247:         * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
248:         */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.