KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > joseki > Joseki


1 /*
2  * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
3  * [See end of file]
4  */

5
6 package org.joseki;
7
8 import java.util.* ;
9
10 /** Constants and other definitions.
11  * @author Andy Seaborne
12  * @version $Id: Joseki.java,v 1.9 2004/04/30 14:13:13 andy_seaborne Exp $
13  */

14 public class Joseki
15 {
16     // TODO automate version number (read from file?)
17
public static String JavaDoc version = "2.1" ;
18     public static String JavaDoc httpHeaderField = "X-Joseki-Server" ;
19     public static String JavaDoc httpHeaderValue = "Joseki-"+version ;
20     
21     // TODO Split constants into client-side and server-side constants.
22
// TODO Shared utils.
23

24     public static final String JavaDoc baseURI = "http://org.joseki/" ;
25
26     public static final String JavaDoc contentTypeN3 = "application/n3" ;
27     public static final String JavaDoc contentTypeRDFXML = "application/rdf+xml" ;
28     public static final String JavaDoc contentTypeNTriples = "application/n-triples" ;
29
30     // Not preferred : cope with on input
31
static final String JavaDoc contentTypeXML = "application/xml" ;
32     static final String JavaDoc contentTypeRDF = "application/rdf" ;
33     
34     public static String JavaDoc serverContentType = contentTypeRDFXML ;
35     public static String JavaDoc clientContentType = contentTypeRDFXML ;
36     
37     // If not null, use this type as the MIME type of the response regardless
38
// of actually encoding (useful when debugging).
39
public static String JavaDoc serverActualContentType = null ;
40
41     //public static final String contentType = "application/rdf+xml" ;
42
//public static final String contentType = "application/n-triples" ;
43

44     public static boolean serverDebug = false ;
45     public static boolean clientDebug = false ;
46     
47     public static String JavaDoc getReaderType(String JavaDoc contentType)
48     {
49         return (String JavaDoc)jenaReaders.get(contentType) ;
50     }
51
52     public static String JavaDoc getWriterType(String JavaDoc contentType)
53     {
54         return (String JavaDoc)jenaWriters.get(contentType) ;
55     }
56
57     public static String JavaDoc setReaderType(String JavaDoc contentType, String JavaDoc writerName)
58     {
59         return (String JavaDoc)jenaReaders.put(contentType, writerName) ;
60     }
61
62     public static String JavaDoc setWriterType(String JavaDoc contentType, String JavaDoc writerName)
63     {
64         return (String JavaDoc)jenaWriters.put(contentType, writerName) ;
65     }
66     
67     static Map jenaReaders = new HashMap() ;
68     static {
69         setReaderType(contentTypeN3, "N3") ;
70         setReaderType(contentTypeRDFXML, "RDF/XML") ;
71         setReaderType(contentTypeNTriples, "N-TRIPLE") ;
72         setReaderType(contentTypeXML, "RDF/XML") ;
73         setReaderType(contentTypeRDF, "RDF/XML") ;
74     }
75     
76     static Map jenaWriters = new HashMap() ;
77     static {
78         setWriterType(contentTypeN3, "N3") ;
79         setWriterType(contentTypeRDFXML, "RDF/XML-ABBREV") ;
80         setWriterType(contentTypeNTriples, "N-TRIPLE") ;
81     }
82 }
83
84
85 /*
86  * (c) Copyright 2003, 2004 Hewlett-Packard Development Company, LP
87  * All rights reserved.
88  *
89  * Redistribution and use in source and binary forms, with or without
90  * modification, are permitted provided that the following conditions
91  * are met:
92  * 1. Redistributions of source code must retain the above copyright
93  * notice, this list of conditions and the following disclaimer.
94  * 2. Redistributions in binary form must reproduce the above copyright
95  * notice, this list of conditions and the following disclaimer in the
96  * documentation and/or other materials provided with the distribution.
97  * 3. The name of the author may not be used to endorse or promote products
98  * derived from this software without specific prior written permission.
99  *
100  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
101  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
102  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
103  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
104  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
105  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
106  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
107  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
108  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
109  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
110  */

111  
112
Popular Tags