KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > bull > eclipse > jonas > utils > xml > 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;
28
29
30 import java.net.URL JavaDoc;
31 import java.util.ArrayList JavaDoc;
32 import java.util.List JavaDoc;
33
34 import com.bull.eclipse.jonas.utils.xml.desc.Schemas;
35
36
37 /**
38  * This class defines the declarations of the default J2EE 1.4 Schemas
39  * @author Florent Benoit
40  */

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

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

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

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

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

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