KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > utils > xml > desc > CommonsSchemas


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or 1any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: CommonsSchemas.java,v 1.2 2003/11/20 13:48:12 coqp Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package com.bull.eclipse.jonas.utils.xml.desc;
28
29
30 import java.net.URL JavaDoc;
31 import java.util.ArrayList JavaDoc;
32 import java.util.List JavaDoc;
33
34
35
36 /**
37  * This class defines the declarations of the default J2EE 1.4 Schemas
38  * @author Florent Benoit
39  */

40 public abstract class CommonsSchemas implements Schemas {
41
42
43     /**
44      * List of schemas used by components
45      */

46     private static final String JavaDoc[] DEFAULT_SCHEMAS = new String JavaDoc[] {
47         "schema/j2ee_1_4.xsd",
48         "schema/j2ee_web_services_client_1_1.xsd",
49         "schema/xml.xsd",
50         "schema/jonas_j2ee_4_0.xsd"
51     };
52
53
54     /**
55      * List where the local schemas URLs are stored
56      */

57     private static ArrayList JavaDoc localSchemas = null;
58
59
60     /**
61      * Build a new object for Schemas handling
62      */

63     public CommonsSchemas() {
64         localSchemas = new ArrayList JavaDoc();
65         addSchemas(DEFAULT_SCHEMAS);
66     }
67
68     /**
69      * Gets the URLs of the local schemas
70      * @return the URLs of the local schemas
71      */

72     public List JavaDoc getlocalSchemas() {
73         return localSchemas;
74     }
75
76
77     /**
78      * Add to our repository the given local schemas
79      * @param schemas schemas to add to the repository
80      * @throws IllegalStateException if the dtds is not found as resource
81      */

82     protected static void addSchemas(String JavaDoc[] schemas) throws IllegalStateException JavaDoc {
83         URL JavaDoc url = null;
84         for (int i = 0; i < schemas.length; i++) {
85             url = CommonsSchemas.class.getResource("/" + schemas[i]);
86             if (!(url == null)) {
87                 localSchemas.add(url.toString()); //MANU
88
//MANU throw new IllegalStateException("'" + schemas[i] + "' was not found in the current classloader !");
89
}
90             //MANU localSchemas.add(url.toString());
91
}
92     }
93
94
95
96 }
97
Popular Tags