KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > deployment > wsdd > providers > WSDDHandlerProvider


1 /*
2  * Copyright 2001-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 package org.apache.axis.deployment.wsdd.providers;
17
18 import org.apache.axis.ConfigurationException;
19 import org.apache.axis.EngineConfiguration;
20 import org.apache.axis.Handler;
21 import org.apache.axis.deployment.wsdd.WSDDConstants;
22 import org.apache.axis.deployment.wsdd.WSDDProvider;
23 import org.apache.axis.deployment.wsdd.WSDDService;
24 import org.apache.axis.utils.ClassUtils;
25 import org.apache.axis.utils.Messages;
26
27 /**
28  * This is a simple provider for using Handler-based services which don't
29  * need further configuration (such as Java classes, etc).
30  *
31  * @author Glen Daniels (gdaniels@apache.org)
32  */

33 public class WSDDHandlerProvider
34     extends WSDDProvider
35 {
36     public String JavaDoc getName() {
37         return WSDDConstants.PROVIDER_HANDLER;
38     }
39
40     public Handler newProviderInstance(WSDDService service,
41                                        EngineConfiguration registry)
42         throws Exception JavaDoc
43     {
44         String JavaDoc providerClass = service.getParameter("handlerClass");
45         if (providerClass == null) {
46             throw new ConfigurationException(Messages.getMessage("noHandlerClass00"));
47         }
48         
49         Class JavaDoc _class = ClassUtils.forName(providerClass);
50         
51         if (!(Handler.class.isAssignableFrom(_class))) {
52             throw new ConfigurationException(Messages.getMessage("badHandlerClass00",
53                                                        _class.getName()));
54         }
55
56         return (Handler)_class.newInstance();
57     }
58 }
59
Popular Tags