01: package org.objectweb.celtix.configuration.impl;
02:
03: import java.util.Collection;
04: import java.util.HashMap;
05: import java.util.Map;
06:
07: public class TypeSchemaHelper {
08:
09: private static Map<String, TypeSchema> map = new HashMap<String, TypeSchema>();
10:
11: private final boolean forceDefaults;
12:
13: public TypeSchemaHelper(boolean fd) {
14: forceDefaults = fd;
15: }
16:
17: public static void clearCache() {
18: map.clear();
19: }
20:
21: public TypeSchema get(String namespaceURI, String base,
22: String location) {
23: TypeSchema ts = map.get(namespaceURI);
24: if (null == ts) {
25: ts = new TypeSchema(namespaceURI, base, location,
26: forceDefaults);
27: map.put(namespaceURI, ts);
28: }
29: return ts;
30: }
31:
32: public TypeSchema get(String namespaceURI) {
33: return map.get(namespaceURI);
34: }
35:
36: public Collection<TypeSchema> getTypeSchemas() {
37: return map.values();
38: }
39:
40: public void put(String namespaceURI, TypeSchema ts) {
41: map.put(namespaceURI, ts);
42: }
43: }
|