01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19:
20: package org.apache.axis2.jaxws.registry;
21:
22: import org.apache.axis2.jaxws.handler.lifecycle.factory.HandlerLifecycleManagerFactory;
23: import org.apache.axis2.jaxws.message.databinding.impl.JAXBBlockFactoryImpl;
24: import org.apache.axis2.jaxws.message.databinding.impl.OMBlockFactoryImpl;
25: import org.apache.axis2.jaxws.message.databinding.impl.SOAPEnvelopeBlockFactoryImpl;
26: import org.apache.axis2.jaxws.message.databinding.impl.SourceBlockFactoryImpl;
27: import org.apache.axis2.jaxws.message.databinding.impl.XMLStringBlockFactoryImpl;
28: import org.apache.axis2.jaxws.message.factory.ClassFinderFactory;
29: import org.apache.axis2.jaxws.message.factory.JAXBBlockFactory;
30: import org.apache.axis2.jaxws.message.factory.MessageFactory;
31: import org.apache.axis2.jaxws.message.factory.OMBlockFactory;
32: import org.apache.axis2.jaxws.message.factory.SAAJConverterFactory;
33: import org.apache.axis2.jaxws.message.factory.SOAPEnvelopeBlockFactory;
34: import org.apache.axis2.jaxws.message.factory.SourceBlockFactory;
35: import org.apache.axis2.jaxws.message.factory.XMLPartFactory;
36: import org.apache.axis2.jaxws.message.factory.XMLStringBlockFactory;
37: import org.apache.axis2.jaxws.message.impl.MessageFactoryImpl;
38: import org.apache.axis2.jaxws.message.impl.XMLPartFactoryImpl;
39: import org.apache.axis2.jaxws.message.util.impl.SAAJConverterFactoryImpl;
40: import org.apache.axis2.jaxws.server.dispatcher.factory.EndpointDispatcherFactory;
41: import org.apache.axis2.jaxws.server.endpoint.lifecycle.factory.EndpointLifecycleManagerFactory;
42: import org.apache.axis2.jaxws.utility.ExecutorFactory;
43: import org.apache.axis2.jaxws.utility.JAXWSExecutorFactory;
44:
45: import java.util.Hashtable;
46: import java.util.Map;
47:
48: /** FactoryRegistry Registry containing Factories related to the JAX-WS Implementation */
49: public class FactoryRegistry {
50:
51: private final static Map<Class, Object> table;
52:
53: static {
54: table = new Hashtable<Class, Object>();
55: table.put(XMLStringBlockFactory.class,
56: new XMLStringBlockFactoryImpl());
57: table.put(JAXBBlockFactory.class, new JAXBBlockFactoryImpl());
58: table.put(OMBlockFactory.class, new OMBlockFactoryImpl());
59: table.put(SourceBlockFactory.class,
60: new SourceBlockFactoryImpl());
61: table.put(SOAPEnvelopeBlockFactory.class,
62: new SOAPEnvelopeBlockFactoryImpl());
63: table.put(MessageFactory.class, new MessageFactoryImpl());
64: table.put(XMLPartFactory.class, new XMLPartFactoryImpl());
65: table.put(SAAJConverterFactory.class,
66: new SAAJConverterFactoryImpl());
67: table.put(EndpointLifecycleManagerFactory.class,
68: new EndpointLifecycleManagerFactory());
69: table.put(HandlerLifecycleManagerFactory.class,
70: new HandlerLifecycleManagerFactory());
71: table.put(ClassFinderFactory.class, new ClassFinderFactory());
72: table.put(EndpointDispatcherFactory.class,
73: new EndpointDispatcherFactory());
74: table.put(ExecutorFactory.class, new JAXWSExecutorFactory());
75: }
76:
77: /** FactoryRegistry is currently a static singleton */
78: private FactoryRegistry() {
79: }
80:
81: /**
82: * getFactory
83: *
84: * @param intface of the Factory
85: * @return Object that is the factory implementation for the intface
86: */
87: public static Object getFactory(Class intface) {
88: return table.get(intface);
89: }
90:
91: /**
92: * setFactory
93: * @param intface
94: * @param factoryObject
95: */
96: public static void setFactory(Class intface, Object factoryObject) {
97: table.put(intface, factoryObject);
98: }
99: }
|