View Javadoc

1   package uk.ac.cam.spectra;
2   
3   import java.text.SimpleDateFormat;
4   
5   import nu.xom.XPathContext;
6   
7   /**
8    * Global constants needed throughout the code.
9    * 
10   * @author Jim Downing
11   */
12  public class Constants {
13  
14  	/**
15  	 * Simple ISO day date format.
16  	 */
17  	public static final SimpleDateFormat SIMPLE_ISO_DATE_FORMAT = new SimpleDateFormat(
18  			"yyyy-MM-dd");
19  
20  	/**
21  	 * CIF's mimetype.
22  	 */
23  	public static final String CIF_MIME_TYPE = "chemical/x-cif";
24  
25  	/**
26  	 * The METS namespace.
27  	 */
28  	public static final String METS_NS = "http://www.loc.gov/METS/";
29  
30  	/**
31  	 * The XMLSchema-instance namespace.
32  	 */
33  	static public final String XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
34  
35  	/**
36  	 * The XLink namespace.
37  	 */
38  	static public final String XLINK_NS = "http://www.w3.org/1999/xlink";
39  
40  	/**
41  	 * The Dublin Core element namespace.
42  	 */
43  	public static final String DC_NS = "http://purl.org/dc/elements/1.1/";
44      
45      public static final String DAV_NS = "DAV:";
46      
47      public static final String DSPACE_NS = "http://www.dspace.org/xmlns/dspace";
48  
49  	/**
50  	 * The eBank namespace.
51  	 */
52  	public static final String EBANK_NS = "http://www.rdn.ac.uk/oai/ebank_dc/";
53  
54  	/**
55  	 * SPECTRa's namespace.
56  	 */
57  	public static final String SPECTRA_NS = "http://lib.cam.ac.uk/spectra/elements/";
58  
59  	/**
60  	 * The Premis namespace.
61  	 */
62  	public static final String PREMIS_NS = "http://www.loc.gov/standards/premis";
63  
64  	/**
65  	 * The eBank terms namespace.
66  	 */
67  	public static final String EBANKTERMS_NS = "http://purl.org/ebank/terms/";
68  
69  	/**
70  	 * A XOM XPath context that can be used wherever the standard namespace
71  	 * prefices have been employed.
72  	 */
73  	public static final XPathContext XPATH_CTX = new XPathContext();
74  
75      /**
76       * A XOM XPath context for extracting information from CML.
77       */
78      public static final XPathContext CML_XPATH = new XPathContext("cml",
79              Constants.CML_NS);
80  
81      /**
82       * The CML namespace.
83       */
84      public static final String CML_NS = "http://www.xml-cml.org/schema";
85  
86      public static final String XSI_INTEGER = "http://www.w3.org/2001/XMLSchema#int";
87  
88      public static final String XSI_BOOLEAN = "http://www.w3.org/2001/XMLSchema#boolean";
89  
90      public static final String XSI_DATE = "http://www.w3.org/2001/XMLSchema#date";
91  
92      public static final String SPECTRA_NMR_NS = "http://lib.cam.ac.uk/spectra/nmr/elements/";
93  
94  	static {
95  		XPATH_CTX.addNamespace("mets", METS_NS);
96  		XPATH_CTX.addNamespace("xlink", XLINK_NS);
97  		XPATH_CTX.addNamespace("xsi", XSI_NS);
98  		XPATH_CTX.addNamespace("dc", DC_NS);
99  		XPATH_CTX.addNamespace("ebank", EBANK_NS);
100 		XPATH_CTX.addNamespace("spectra", SPECTRA_NS);
101         XPATH_CTX.addNamespace("cml", CML_NS);
102         XPATH_CTX.addNamespace("dav", DAV_NS);
103         XPATH_CTX.addNamespace("dspace", DSPACE_NS);
104 	}
105 
106 }