1 22 package org.jboss.xb.binding.sunday.unmarshalling; 23 24 import java.util.Iterator ; 25 import java.util.Map ; 26 import java.util.Properties ; 27 28 import org.jboss.logging.Logger; 29 import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver; 30 31 37 public class SchemaResolverConfig implements SchemaResolverConfigMBean 38 { 39 40 private static final Logger log = Logger.getLogger(SchemaResolverConfig.class); 41 42 43 protected static DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver(); 44 45 46 protected Properties schemaInitializers; 47 48 49 protected Properties schemaLocations; 50 51 52 protected Properties parseAnnotations; 53 54 public Properties getSchemaInitializers() 55 { 56 return schemaInitializers; 57 } 58 59 public void setSchemaInitializers(Properties schemaInitializers) 60 { 61 this.schemaInitializers = schemaInitializers; 62 if (schemaInitializers != null && schemaInitializers.size() != 0) 63 { 64 for (Iterator i = schemaInitializers.entrySet().iterator(); i.hasNext();) 65 { 66 Map.Entry entry = (Map.Entry ) i.next(); 67 String namespace = (String ) entry.getKey(); 68 String initializer = (String ) entry.getValue(); 69 try 70 { 71 resolver.addSchemaInitializer(namespace, initializer); 72 } 73 catch (Exception ignored) 74 { 75 log.debug("Ignored: ", ignored); 76 } 77 } 78 } 79 } 80 81 public Properties getSchemaLocations() 82 { 83 return schemaLocations; 84 } 85 86 public void setSchemaLocations(Properties schemaLocations) 87 { 88 this.schemaLocations = schemaLocations; 89 if (schemaLocations != null && schemaLocations.size() != 0) 90 { 91 for (Iterator i = schemaLocations.entrySet().iterator(); i.hasNext();) 92 { 93 Map.Entry entry = (Map.Entry ) i.next(); 94 String namespace = (String ) entry.getKey(); 95 String location = (String ) entry.getValue(); 96 resolver.addSchemaLocation(namespace, location); 97 } 98 } 99 } 100 101 public Properties getParseAnnotations() 102 { 103 return parseAnnotations; 104 } 105 106 public void setParseAnnotations(Properties parseAnnotations) 107 { 108 this.parseAnnotations = parseAnnotations; 109 if (parseAnnotations != null && parseAnnotations.size() != 0) 110 { 111 for (Iterator i = parseAnnotations.entrySet().iterator(); i.hasNext();) 112 { 113 Map.Entry entry = (Map.Entry ) i.next(); 114 String namespace = (String ) entry.getKey(); 115 String value = (String ) entry.getValue(); 116 Boolean booleanValue = Boolean.valueOf(value); 117 resolver.addSchemaParseAnnotations(namespace, booleanValue); 118 } 119 } 120 } 121 } 122 | Popular Tags |