Source Code Cross Referenced for BooleanQueryResultFormat.java in  » RSS-RDF » sesame » org » openrdf » query » resultio » 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 » sesame » org.openrdf.query.resultio 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright Aduna (http://www.aduna-software.com/) (c) 2007.
003:         *
004:         * Licensed under the Aduna BSD-style license.
005:         */
006:        package org.openrdf.query.resultio;
007:
008:        import java.nio.charset.Charset;
009:        import java.util.ArrayList;
010:        import java.util.Collection;
011:        import java.util.Collections;
012:        import java.util.List;
013:
014:        import info.aduna.lang.FileFormat;
015:
016:        /**
017:         * Represents the concept of a boolean query result serialization format.
018:         * Boolean query result formats are identified by a {@link #getName() name} and
019:         * can have one or more associated MIME types, zero or more associated file
020:         * extensions and can specify a (default) character encoding.
021:         * 
022:         * @author Arjohn Kampman
023:         */
024:        public class BooleanQueryResultFormat extends FileFormat {
025:
026:            /*-----------*
027:             * Constants *
028:             *-----------*/
029:
030:            /**
031:             * SPARQL Query Results XML Format.
032:             */
033:            public static final BooleanQueryResultFormat SPARQL = new BooleanQueryResultFormat(
034:                    "SPARQL/XML", "application/sparql-results+xml", Charset
035:                            .forName("UTF-8"), "srx");
036:
037:            /**
038:             * Plain text encoding using values "true" and "false" (case-insensitive).
039:             */
040:            public static final BooleanQueryResultFormat TEXT = new BooleanQueryResultFormat(
041:                    "TEXT", "text/boolean", Charset.forName("US-ASCII"), "txt");
042:
043:            /*------------------*
044:             * Static variables *
045:             *------------------*/
046:
047:            /**
048:             * List of known boolean query result formats.
049:             */
050:            private static List<BooleanQueryResultFormat> VALUES = new ArrayList<BooleanQueryResultFormat>(
051:                    8);
052:
053:            /*--------------------*
054:             * Static initializer *
055:             *--------------------*/
056:
057:            static {
058:                register(TEXT);
059:                register(SPARQL);
060:            }
061:
062:            /*----------------*
063:             * Static methods *
064:             *----------------*/
065:
066:            /**
067:             * Returns all known/registered boolean query result formats.
068:             */
069:            public static Collection<BooleanQueryResultFormat> values() {
070:                return Collections.unmodifiableList(VALUES);
071:            }
072:
073:            /**
074:             * Registers the specified boolean query result format.
075:             * 
076:             * @param name
077:             *        The name of the format, e.g. "SPARQL/XML".
078:             * @param mimeType
079:             *        The MIME type of the format, e.g.
080:             *        <tt>application/sparql-results+xml</tt> for the SPARQL/XML file
081:             *        format.
082:             * @param fileExt
083:             *        The (default) file extension for the format, e.g. <tt>srx</tt>
084:             *        for SPARQL/XML files.
085:             */
086:            public static BooleanQueryResultFormat register(String name,
087:                    String mimeType, String fileExt) {
088:                BooleanQueryResultFormat format = new BooleanQueryResultFormat(
089:                        name, mimeType, fileExt);
090:                register(format);
091:                return format;
092:            }
093:
094:            /**
095:             * Registers the specified boolean query result format.
096:             */
097:            public static void register(BooleanQueryResultFormat format) {
098:                VALUES.add(format);
099:            }
100:
101:            /**
102:             * Tries to determine the appropriate boolean file format based on the a MIME
103:             * type that describes the content type.
104:             * 
105:             * @param mimeType
106:             *        A MIME type, e.g. "application/sparql-results+xml".
107:             * @return A TupleQueryResultFormat object if the MIME type was recognized,
108:             *         or <tt>null</tt> otherwise.
109:             * @see #forMIMEType(String,BooleanQueryResultFormat)
110:             * @see #getMIMEType
111:             */
112:            public static BooleanQueryResultFormat forMIMEType(String mimeType) {
113:                return forMIMEType(mimeType, null);
114:            }
115:
116:            /**
117:             * Tries to determine the appropriate boolean file format based on the a MIME
118:             * type that describes the content type. The supplied fallback format will be
119:             * returned when the MIME type was not recognized.
120:             * 
121:             * @param mimeType
122:             *        a MIME type, e.g. "application/sparql-results+xml"
123:             * @param fallback
124:             *        a fallback TupleQueryResultFormat that will be returned by the
125:             *        method if no match for the supplied MIME type can be found.
126:             * @return A TupleQueryResultFormat that matches the MIME type, or the
127:             *         fallback format if the extension was not recognized.
128:             * @see #forMIMEType(String)
129:             * @see #getMIMEType
130:             */
131:            public static BooleanQueryResultFormat forMIMEType(String mimeType,
132:                    BooleanQueryResultFormat fallback) {
133:                return matchMIMEType(mimeType, VALUES, fallback);
134:            }
135:
136:            /**
137:             * Tries to determine the appropriate boolean file format for a file, based
138:             * on the extension specified in a file name.
139:             * 
140:             * @param fileName
141:             *        A file name.
142:             * @return A TupleQueryResultFormat object if the file extension was
143:             *         recognized, or <tt>null</tt> otherwise.
144:             * @see #forFileName(String,BooleanQueryResultFormat)
145:             * @see #getFileExtension
146:             */
147:            public static BooleanQueryResultFormat forFileName(String fileName) {
148:                return forFileName(fileName, null);
149:            }
150:
151:            /**
152:             * Tries to determine the appropriate boolean file format for a file, based
153:             * on the extension specified in a file name. The supplied fallback format
154:             * will be returned when the file name extension was not recognized.
155:             * 
156:             * @param fileName
157:             *        A file name.
158:             * @return A TupleQueryResultFormat that matches the file name extension, or
159:             *         the fallback format if the extension was not recognized.
160:             * @see #forFileName(String)
161:             * @see #getFileExtension
162:             */
163:            public static BooleanQueryResultFormat forFileName(String fileName,
164:                    BooleanQueryResultFormat fallback) {
165:                return matchFileName(fileName, VALUES, fallback);
166:            }
167:
168:            /*--------------*
169:             * Constructors *
170:             *--------------*/
171:
172:            /**
173:             * Creates a new TupleQueryResultFormat object.
174:             * 
175:             * @param name
176:             *        The name of the format, e.g. "SPARQL/XML".
177:             * @param mimeType
178:             *        The MIME type of the format, e.g.
179:             *        <tt>application/sparql-results+xml</tt> for the SPARQL/XML
180:             *        format.
181:             * @param fileExt
182:             *        The (default) file extension for the format, e.g. <tt>srx</tt>
183:             *        for SPARQL/XML.
184:             */
185:            public BooleanQueryResultFormat(String name, String mimeType,
186:                    String fileExt) {
187:                this (name, mimeType, null, fileExt);
188:            }
189:
190:            /**
191:             * Creates a new TupleQueryResultFormat object.
192:             * 
193:             * @param name
194:             *        The name of the format, e.g. "SPARQL/XML".
195:             * @param mimeType
196:             *        The MIME type of the format, e.g.
197:             *        <tt>application/sparql-results+xml</tt> for the SPARQL/XML
198:             *        format.
199:             * @param charset
200:             *        The default character encoding of the format. Specify <tt>null</tt>
201:             *        if not applicable.
202:             * @param fileExt
203:             *        The (default) file extension for the format, e.g. <tt>srx</tt>
204:             *        for SPARQL/XML.
205:             */
206:            public BooleanQueryResultFormat(String name, String mimeType,
207:                    Charset charset, String fileExt) {
208:                super (name, mimeType, charset, fileExt);
209:            }
210:
211:            /**
212:             * Creates a new TupleQueryResultFormat object.
213:             * 
214:             * @param name
215:             *        The name of the format, e.g. "SPARQL/XML".
216:             * @param mimeTypes
217:             *        The MIME types of the format, e.g.
218:             *        <tt>application/sparql-results+xml</tt> for the SPARQL/XML
219:             *        format. The first item in the list is interpreted as the default
220:             *        MIME type for the format.
221:             * @param charset
222:             *        The default character encoding of the format. Specify <tt>null</tt>
223:             *        if not applicable.
224:             * @param fileExtensions
225:             *        The format's file extensions, e.g. <tt>srx</tt> for SPARQL/XML
226:             *        files. The first item in the list is interpreted as the default
227:             *        file extension for the format.
228:             */
229:            public BooleanQueryResultFormat(String name,
230:                    Collection<String> mimeTypes, Charset charset,
231:                    Collection<String> fileExtensions) {
232:                super(name, mimeTypes, charset, fileExtensions);
233:            }
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.