KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > sandesha > server > InvokerFactory


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */

17
18 package org.apache.sandesha.server;
19
20 import org.apache.sandesha.util.PropertyLoader;
21
22 /**
23  * Provides factory access to two main components of invoke layer.
24  * <p/>
25  * The <code>RMInvokerStrategy</code> impl defines a strategy for executing,
26  * most likely in an asynchronous manner, web service invokes. This allows
27  * custom strategies to be configured for different containers (ie threadpools,
28  * work managers, etc.).
29  * <p/>
30  * The <code>InvokeHandler</code> impl actually executes the web service
31  * invoke.
32  *
33  * @author Patrick Collins
34  */

35
36 public class InvokerFactory {
37     // singleton instance
38
private static final InvokerFactory INSTANCE = new InvokerFactory();
39
40     /**
41      * Getter for factory instance.
42      */

43     public static InvokerFactory getInstance() {
44         return INSTANCE;
45     }
46
47     /**
48      * Create the <code>RMInvokerStrategy</code> impl.
49      */

50
51     public InvokeStrategy createInvokerStrategy() throws Exception JavaDoc {
52         String JavaDoc strategyClassName = PropertyLoader.getInvokeStrategyClassName();
53         InvokeStrategy strategy = (InvokeStrategy) Class.forName(strategyClassName).newInstance();
54         strategy.addParams(PropertyLoader.getInvokeStrategyParams());
55         return strategy;
56     }
57
58
59     public InvokeHandler createInvokeHandler() throws Exception JavaDoc {
60         String JavaDoc handlerClassName = PropertyLoader.getInvokeHandlerClassName();
61         InvokeHandler handler = (InvokeHandler) Class.forName(handlerClassName).newInstance();
62         handler.addParams(PropertyLoader.getInvokeHandlerParams());
63         return handler;
64     }
65 }
66
67
Popular Tags