KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > service > spi > EndpointReferenceFactory


1 package org.jbpm.bpel.service.spi;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.List JavaDoc;
5
6 import javax.xml.namespace.QName JavaDoc;
7
8
9 import org.jbpm.bpel.service.exe.ServiceReference;
10
11 /**
12  * @author Alejandro Guízar
13  * @version $Revision: 1.2 $ $Date: 2005/06/17 01:31:31 $
14  */

15 public abstract class EndpointReferenceFactory {
16   
17   private static List JavaDoc factories = new ArrayList JavaDoc();
18   
19   protected EndpointReferenceFactory() {
20   }
21   
22   public abstract EndpointReference createEndpoint(ServiceReference serviceRef);
23   
24   public abstract boolean acceptsReference(QName JavaDoc endpointRefName, String JavaDoc refScheme);
25   
26   public static EndpointReferenceFactory getInstance(QName JavaDoc endpointRefName, String JavaDoc refScheme) {
27     for (int i = 0, n = factories.size(); i < n; i++) {
28       EndpointReferenceFactory factory = (EndpointReferenceFactory) factories.get(i);
29       if (factory.acceptsReference(endpointRefName, refScheme)) {
30         return factory;
31       }
32     }
33     return null;
34   }
35   
36   public static void registerInstance(EndpointReferenceFactory instance) {
37     factories.add(instance);
38   }
39 }
40
Popular Tags