package pt.ist.renderers.utils; import java.util.Hashtable; import java.util.Map; import pt.ist.renderers.exceptions.NoSuchSchemaException; import pt.ist.renderers.schemas.Schema; public class SchemaRegistry { private Map schemasTable = null; public SchemaRegistry() { super(); schemasTable = new Hashtable(); } public void registerSchema(Schema schema) { schemasTable.put(schema.getName(), schema); } public Schema getSchema(String schemaName) { if (schemaName == null) { return null; } if (! schemasTable.containsKey(schemaName)) { throw new NoSuchSchemaException(schemaName); } return schemasTable.get(schemaName); } }