KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > validate > auto > SchemaReceiverLoader


1 package com.thaiopensource.validate.auto;
2
3 import com.thaiopensource.util.PropertyMap;
4 import com.thaiopensource.util.Service;
5 import com.thaiopensource.validate.auto.SchemaReceiver;
6 import com.thaiopensource.validate.auto.SchemaReceiverFactory;
7 import com.thaiopensource.validate.Option;
8
9 import java.util.Enumeration;
10
11 public class SchemaReceiverLoader implements SchemaReceiverFactory {
12   private final Service service = new Service(SchemaReceiverFactory.class);
13   public SchemaReceiver createSchemaReceiver(String namespaceUri,
14                                              PropertyMap properties) {
15     for (Enumeration enum = service.getProviders(); enum.hasMoreElements();) {
16       SchemaReceiverFactory srf = (SchemaReceiverFactory)enum.nextElement();
17       SchemaReceiver sr = srf.createSchemaReceiver(namespaceUri, properties);
18       if (sr != null)
19         return sr;
20     }
21     return null;
22   }
23
24   public Option getOption(String uri) {
25     for (Enumeration enum = service.getProviders(); enum.hasMoreElements();) {
26       SchemaReceiverFactory srf = (SchemaReceiverFactory)enum.nextElement();
27       Option option = srf.getOption(uri);
28       if (option != null)
29         return option;
30     }
31     return null;
32   }
33
34 }
35
Popular Tags